From 2cdb9e492b0f282b9d9df8a7ea752c0a09e1f0b2 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Fri, 23 Jan 2026 05:34:34 +0000 Subject: [PATCH] Configurations: 'specification/managedoperations/ManagedOps.Management/tspconfig.yaml', API Version: 2025-07-28-preview, SDK Release Type: beta, and CommitSHA: '83408dfe4894a9b5a5d3989023647bce792efc5f' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=5788709 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. --- .../Azure.ResourceManager.ManagedOps.sln | 56 ++ .../CHANGELOG.md | 11 + .../Directory.Build.props | 6 + .../README.md | 80 +++ .../assets.json | 7 + ....ResourceManager.ManagedOps.Samples.csproj | 13 + .../Azure.ResourceManager.ManagedOps.csproj | 9 + .../Generated/ArmManagedOpsModelFactory.cs | 102 ++++ .../Extensions/ManagedOpsExtensions.cs | 142 +++++ .../Extensions/MockableManagedOpsArmClient.cs | 49 ++ .../MockableManagedOpsSubscriptionResource.cs | 105 ++++ .../src/Generated/Internal/Argument.cs | 129 +++++ .../Internal/ChangeTrackingDictionary.cs | 167 ++++++ .../Generated/Internal/ChangeTrackingList.cs | 153 +++++ .../Internal/ModelSerializationExtensions.cs | 409 ++++++++++++++ .../src/Generated/Internal/Optional.cs | 51 ++ .../Internal/Utf8JsonRequestContent.cs | 55 ++ .../ManagedOpOperationSource.cs | 36 ++ .../ManagedOpsArmOperation.cs | 96 ++++ .../ManagedOpsArmOperationOfT.cs | 102 ++++ .../src/Generated/ManagedOpCollection.cs | 494 +++++++++++++++++ .../Generated/ManagedOpData.Serialization.cs | 156 ++++++ .../src/Generated/ManagedOpData.cs | 75 +++ .../ManagedOpResource.Serialization.cs | 29 + .../src/Generated/ManagedOpResource.cs | 347 ++++++++++++ ...AzureMonitorConfiguration.Serialization.cs | 126 +++++ .../Models/AzureMonitorConfiguration.cs | 76 +++ .../AzureMonitorInformation.Serialization.cs | 134 +++++ .../Models/AzureMonitorInformation.cs | 82 +++ .../AzureResourceManagerManagedOpsContext.cs | 41 ++ ...angeTrackingConfiguration.Serialization.cs | 126 +++++ .../Models/ChangeTrackingConfiguration.cs | 76 +++ ...ChangeTrackingInformation.Serialization.cs | 134 +++++ .../Models/ChangeTrackingInformation.cs | 82 +++ ...angeTrackingInformationEnablementStatus.cs | 57 ++ .../DefenderCspmInformation.Serialization.cs | 126 +++++ .../Models/DefenderCspmInformation.cs | 72 +++ ...nderForServersInformation.Serialization.cs | 126 +++++ .../Models/DefenderForServersInformation.cs | 72 +++ .../DesiredConfiguration.Serialization.cs | 178 ++++++ .../Generated/Models/DesiredConfiguration.cs | 112 ++++ .../DesiredConfigurationDefenderForServer.cs | 51 ++ ...tConfigurationInformation.Serialization.cs | 126 +++++ .../Models/GuestConfigurationInformation.cs | 72 +++ .../ManagedOpListResult.Serialization.cs | 151 +++++ .../Generated/Models/ManagedOpListResult.cs | 80 +++ .../Models/ManagedOpPatch.Serialization.cs | 133 +++++ .../src/Generated/Models/ManagedOpPatch.cs | 76 +++ ...ManagedOpUpdateProperties.Serialization.cs | 133 +++++ .../Models/ManagedOpUpdateProperties.cs | 65 +++ .../ManagedOpsProperties.Serialization.cs | 192 +++++++ .../Generated/Models/ManagedOpsProperties.cs | 97 ++++ .../Models/ManagedOpsSku.Serialization.cs | 134 +++++ .../src/Generated/Models/ManagedOpsSku.cs | 82 +++ ...olicyAssignmentProperties.Serialization.cs | 126 +++++ .../Models/PolicyAssignmentProperties.cs | 76 +++ .../src/Generated/Models/ProvisioningState.cs | 60 ++ .../ServiceInformation.Serialization.cs | 215 +++++++ .../Generated/Models/ServiceInformation.cs | 108 ++++ .../UpdateManagerInformation.Serialization.cs | 126 +++++ .../Models/UpdateManagerInformation.cs | 72 +++ .../src/Generated/ProviderConstants.cs | 16 + .../ManagedOpsRestOperations.cs | 524 ++++++++++++++++++ .../src/Properties/AssemblyInfo.cs | 11 + ...re.ResourceManager.ManagedOps.Tests.csproj | 8 + .../Samples/Sample_ManagedOpCollection.cs | 191 +++++++ .../Samples/Sample_ManagedOpResource.cs | 104 ++++ .../tests/ManagedOpsManagementTestBase.cs | 45 ++ .../ManagedOpsManagementTestEnvironment.cs | 11 + .../tsp-location.yaml | 6 + sdk/managedops/ci.yml | 35 ++ 71 files changed, 7625 insertions(+) create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/Azure.ResourceManager.ManagedOps.sln create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/CHANGELOG.md create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/Directory.Build.props create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/README.md create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/assets.json create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/samples/Azure.ResourceManager.ManagedOps.Samples.csproj create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Azure.ResourceManager.ManagedOps.csproj create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/ArmManagedOpsModelFactory.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Extensions/ManagedOpsExtensions.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Extensions/MockableManagedOpsArmClient.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Extensions/MockableManagedOpsSubscriptionResource.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Internal/Argument.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Internal/ChangeTrackingDictionary.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Internal/ChangeTrackingList.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Internal/ModelSerializationExtensions.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Internal/Optional.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Internal/Utf8JsonRequestContent.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/LongRunningOperation/ManagedOpOperationSource.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/LongRunningOperation/ManagedOpsArmOperation.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/LongRunningOperation/ManagedOpsArmOperationOfT.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/ManagedOpCollection.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/ManagedOpData.Serialization.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/ManagedOpData.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/ManagedOpResource.Serialization.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/ManagedOpResource.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/AzureMonitorConfiguration.Serialization.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/AzureMonitorConfiguration.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/AzureMonitorInformation.Serialization.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/AzureMonitorInformation.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/AzureResourceManagerManagedOpsContext.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ChangeTrackingConfiguration.Serialization.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ChangeTrackingConfiguration.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ChangeTrackingInformation.Serialization.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ChangeTrackingInformation.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ChangeTrackingInformationEnablementStatus.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/DefenderCspmInformation.Serialization.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/DefenderCspmInformation.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/DefenderForServersInformation.Serialization.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/DefenderForServersInformation.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/DesiredConfiguration.Serialization.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/DesiredConfiguration.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/DesiredConfigurationDefenderForServer.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/GuestConfigurationInformation.Serialization.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/GuestConfigurationInformation.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ManagedOpListResult.Serialization.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ManagedOpListResult.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ManagedOpPatch.Serialization.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ManagedOpPatch.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ManagedOpUpdateProperties.Serialization.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ManagedOpUpdateProperties.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ManagedOpsProperties.Serialization.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ManagedOpsProperties.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ManagedOpsSku.Serialization.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ManagedOpsSku.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/PolicyAssignmentProperties.Serialization.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/PolicyAssignmentProperties.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ProvisioningState.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ServiceInformation.Serialization.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ServiceInformation.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/UpdateManagerInformation.Serialization.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/UpdateManagerInformation.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/ProviderConstants.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/RestOperations/ManagedOpsRestOperations.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/src/Properties/AssemblyInfo.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/tests/Azure.ResourceManager.ManagedOps.Tests.csproj create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/tests/Generated/Samples/Sample_ManagedOpCollection.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/tests/Generated/Samples/Sample_ManagedOpResource.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/tests/ManagedOpsManagementTestBase.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/tests/ManagedOpsManagementTestEnvironment.cs create mode 100644 sdk/managedops/Azure.ResourceManager.ManagedOps/tsp-location.yaml create mode 100644 sdk/managedops/ci.yml diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/Azure.ResourceManager.ManagedOps.sln b/sdk/managedops/Azure.ResourceManager.ManagedOps/Azure.ResourceManager.ManagedOps.sln new file mode 100644 index 000000000000..0edc8e38dfce --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/Azure.ResourceManager.ManagedOps.sln @@ -0,0 +1,56 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29709.97 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.ManagedOps.Samples", "samples\Azure.ResourceManager.ManagedOps.Samples.csproj", "{7A2DFF15-5746-49F4-BD0F-C6C35337088A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.ResourceManager.ManagedOps", "src\Azure.ResourceManager.ManagedOps.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.ResourceManager.ManagedOps.Tests", "tests\Azure.ResourceManager.ManagedOps.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.Build.0 = Release|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.Build.0 = Release|Any CPU + {7A2DFF15-5746-49F4-BD0F-C6C35337088A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7A2DFF15-5746-49F4-BD0F-C6C35337088A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7A2DFF15-5746-49F4-BD0F-C6C35337088A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7A2DFF15-5746-49F4-BD0F-C6C35337088A}.Release|Any CPU.Build.0 = Release|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.Build.0 = Release|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.Build.0 = Release|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.Build.0 = Release|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.Build.0 = Debug|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.ActiveCfg = Release|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.Build.0 = Release|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A97F4B90-2591-4689-B1F8-5F21FE6D6CAE} + EndGlobalSection +EndGlobal diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/CHANGELOG.md b/sdk/managedops/Azure.ResourceManager.ManagedOps/CHANGELOG.md new file mode 100644 index 000000000000..8b33f0fedccc --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/CHANGELOG.md @@ -0,0 +1,11 @@ +# Release History + +## 1.0.0-beta.1 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes \ No newline at end of file diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/Directory.Build.props b/sdk/managedops/Azure.ResourceManager.ManagedOps/Directory.Build.props new file mode 100644 index 000000000000..63bd836ad44b --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/Directory.Build.props @@ -0,0 +1,6 @@ + + + + diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/README.md b/sdk/managedops/Azure.ResourceManager.ManagedOps/README.md new file mode 100644 index 000000000000..3c946cbf7dc7 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/README.md @@ -0,0 +1,80 @@ +# Microsoft Azure ManagedOps 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 ManagedOps management library for .NET with [NuGet](https://www.nuget.org/): + +```dotnetcli +dotnet add package Azure.ResourceManager.ManagedOps --prerelease +``` + +### Prerequisites + +* You must have an [Microsoft Azure subscription](https://azure.microsoft.com/free/dotnet/). + +### Authenticate the Client + +To create an authenticated client and start interacting with Microsoft Azure resources, see the [quickstart guide here](https://github.com/Azure/azure-sdk-for-net/blob/main/doc/dev/mgmt_quickstart.md). + +## Key concepts + +Key concepts of the Microsoft Azure SDK for .NET can be found [here](https://azure.github.io/azure-sdk/dotnet_introduction.html) + +## Documentation + +Documentation is available to help you learn how to use this package: + +- [Quickstart](https://github.com/Azure/azure-sdk-for-net/blob/main/doc/dev/mgmt_quickstart.md). +- [API References](https://learn.microsoft.com/dotnet/api/?view=azure-dotnet). +- [Authentication](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/identity/Azure.Identity/README.md). + +## Examples + +Code samples for using the management library for .NET can be found in the following locations +- [.NET Management Library Code Samples](https://aka.ms/azuresdk-net-mgmt-samples) + +## Troubleshooting + +- File an issue via [GitHub Issues](https://github.com/Azure/azure-sdk-for-net/issues). +- Check [previous questions](https://stackoverflow.com/questions/tagged/azure+.net) or ask new ones on Stack Overflow using Azure and .NET tags. + +## Next steps + +For more information about Microsoft Azure SDK, see [this website](https://azure.github.io/azure-sdk/). + +## Contributing + +For details on contributing to this repository, see the [contributing +guide][cg]. + +This project welcomes contributions and suggestions. Most contributions +require you to agree to a Contributor License Agreement (CLA) declaring +that you have the right to, and actually do, grant us the rights to use +your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine +whether you need to provide a CLA and decorate the PR appropriately +(for example, label, comment). Follow the instructions provided by the +bot. You'll only need to do this action once across all repositories +using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For +more information, see the [Code of Conduct FAQ][coc_faq] or contact + with any other questions or comments. + + +[cg]: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/resourcemanager/Azure.ResourceManager/docs/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ \ No newline at end of file diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/assets.json b/sdk/managedops/Azure.ResourceManager.ManagedOps/assets.json new file mode 100644 index 000000000000..269186ff85c5 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/assets.json @@ -0,0 +1,7 @@ + +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "net", + "TagPrefix": "net/managedops/Azure.ResourceManager.ManagedOps", + "Tag": "" +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/samples/Azure.ResourceManager.ManagedOps.Samples.csproj b/sdk/managedops/Azure.ResourceManager.ManagedOps/samples/Azure.ResourceManager.ManagedOps.Samples.csproj new file mode 100644 index 000000000000..e0b621579f18 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/samples/Azure.ResourceManager.ManagedOps.Samples.csproj @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Azure.ResourceManager.ManagedOps.csproj b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Azure.ResourceManager.ManagedOps.csproj new file mode 100644 index 000000000000..a3b11d35f0a4 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Azure.ResourceManager.ManagedOps.csproj @@ -0,0 +1,9 @@ + + + Azure Resource Manager client SDK for Azure resource provider ManagedOps. + 1.0.0-beta.1 + azure;management;arm;resource manager;managedops + true + Azure.ResourceManager.ManagedOps + + diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/ArmManagedOpsModelFactory.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/ArmManagedOpsModelFactory.cs new file mode 100644 index 000000000000..b2d11ba60bf4 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/ArmManagedOpsModelFactory.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ManagedOps.Models +{ + /// Model factory for models. + public static partial class ArmManagedOpsModelFactory + { + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static ManagedOpData ManagedOpData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ManagedOpsProperties properties = null) + { + return new ManagedOpData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Product plan details of this resource. + /// Provisioning state of the resource. + /// Desired configuration input by the user. + /// Services provisioned by this resource. + /// Policy assignments created for managing services. + /// A new instance for mocking. + public static ManagedOpsProperties ManagedOpsProperties(ManagedOpsSku sku = null, ProvisioningState? provisioningState = null, DesiredConfiguration desiredConfiguration = null, ServiceInformation services = null, ResourceIdentifier policyInitiativeAssignmentId = null) + { + return new ManagedOpsProperties( + sku, + provisioningState, + desiredConfiguration, + services, + policyInitiativeAssignmentId != null ? new PolicyAssignmentProperties(policyInitiativeAssignmentId, serializedAdditionalRawData: null) : null, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Name of the SKU. + /// Pricing tier of the SKU. + /// A new instance for mocking. + public static ManagedOpsSku ManagedOpsSku(string name = null, string tier = null) + { + return new ManagedOpsSku(name, tier, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Change Tracking and Inventory service information. + /// Azure Monitor Insights service information. + /// Azure Update Manager service information. + /// Azure Policy and Machine Configuration service information. + /// Defender for Servers service information. + /// Defender for Cloud's Cloud security posture management (CSPM) service information. + /// A new instance for mocking. + public static ServiceInformation ServiceInformation(ChangeTrackingInformation changeTrackingAndInventory = null, AzureMonitorInformation azureMonitorInsights = null, ChangeTrackingInformationEnablementStatus? azureUpdateManagerEnablementStatus = null, ChangeTrackingInformationEnablementStatus? azurePolicyAndMachineEnablementStatus = null, ChangeTrackingInformationEnablementStatus? defenderForServersEnablementStatus = null, ChangeTrackingInformationEnablementStatus? defenderCspmEnablementStatus = null) + { + return new ServiceInformation( + changeTrackingAndInventory, + azureMonitorInsights, + azureUpdateManagerEnablementStatus.HasValue ? new UpdateManagerInformation(azureUpdateManagerEnablementStatus.Value, serializedAdditionalRawData: null) : null, + azurePolicyAndMachineEnablementStatus.HasValue ? new GuestConfigurationInformation(azurePolicyAndMachineEnablementStatus.Value, serializedAdditionalRawData: null) : null, + defenderForServersEnablementStatus.HasValue ? new DefenderForServersInformation(defenderForServersEnablementStatus.Value, serializedAdditionalRawData: null) : null, + defenderCspmEnablementStatus.HasValue ? new DefenderCspmInformation(defenderCspmEnablementStatus.Value, serializedAdditionalRawData: null) : null, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// ID of Data Collection Rule (DCR) associated with this service. + /// Indicates whether the service is enabled. + /// A new instance for mocking. + public static ChangeTrackingInformation ChangeTrackingInformation(ResourceIdentifier dcrId = null, ChangeTrackingInformationEnablementStatus enablementStatus = default) + { + return new ChangeTrackingInformation(dcrId, enablementStatus, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// ID of Data Collection Rule (DCR) associated with this service. + /// Indicates whether the service is enabled. + /// A new instance for mocking. + public static AzureMonitorInformation AzureMonitorInformation(ResourceIdentifier dcrId = null, ChangeTrackingInformationEnablementStatus enablementStatus = default) + { + return new AzureMonitorInformation(dcrId, enablementStatus, serializedAdditionalRawData: null); + } + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Extensions/ManagedOpsExtensions.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Extensions/ManagedOpsExtensions.cs new file mode 100644 index 000000000000..6dcf82a7f326 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Extensions/ManagedOpsExtensions.cs @@ -0,0 +1,142 @@ +// 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.ManagedOps.Mocking; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.ManagedOps +{ + /// A class to add extension methods to Azure.ResourceManager.ManagedOps. + public static partial class ManagedOpsExtensions + { + private static MockableManagedOpsArmClient GetMockableManagedOpsArmClient(ArmClient client) + { + return client.GetCachedClient(client0 => new MockableManagedOpsArmClient(client0)); + } + + private static MockableManagedOpsSubscriptionResource GetMockableManagedOpsSubscriptionResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableManagedOpsSubscriptionResource(client, resource.Id)); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ManagedOpResource GetManagedOpResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableManagedOpsArmClient(client).GetManagedOpResource(id); + } + + /// + /// Gets a collection of ManagedOpResources 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 ManagedOpResources and their operations over a ManagedOpResource. + public static ManagedOpCollection GetManagedOps(this SubscriptionResource subscriptionResource) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableManagedOpsSubscriptionResource(subscriptionResource).GetManagedOps(); + } + + /// + /// Gets the information of the ManagedOps instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedOps/managedOps/{managedOpsName} + /// + /// + /// Operation Id + /// ManagedOp_Get + /// + /// + /// Default Api Version + /// 2025-07-28-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Name of the resource. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetManagedOpAsync(this SubscriptionResource subscriptionResource, string managedOpsName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return await GetMockableManagedOpsSubscriptionResource(subscriptionResource).GetManagedOpAsync(managedOpsName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the information of the ManagedOps instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedOps/managedOps/{managedOpsName} + /// + /// + /// Operation Id + /// ManagedOp_Get + /// + /// + /// Default Api Version + /// 2025-07-28-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Name of the resource. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetManagedOp(this SubscriptionResource subscriptionResource, string managedOpsName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableManagedOpsSubscriptionResource(subscriptionResource).GetManagedOp(managedOpsName, cancellationToken); + } + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Extensions/MockableManagedOpsArmClient.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Extensions/MockableManagedOpsArmClient.cs new file mode 100644 index 000000000000..dc6f44bfc198 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Extensions/MockableManagedOpsArmClient.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.ManagedOps.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableManagedOpsArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableManagedOpsArmClient() + { + } + + /// 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 MockableManagedOpsArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableManagedOpsArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ManagedOpResource GetManagedOpResource(ResourceIdentifier id) + { + ManagedOpResource.ValidateResourceId(id); + return new ManagedOpResource(Client, id); + } + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Extensions/MockableManagedOpsSubscriptionResource.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Extensions/MockableManagedOpsSubscriptionResource.cs new file mode 100644 index 000000000000..f0fedf40c06e --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Extensions/MockableManagedOpsSubscriptionResource.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.ManagedOps.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableManagedOpsSubscriptionResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableManagedOpsSubscriptionResource() + { + } + + /// 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 MockableManagedOpsSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ManagedOpResources in the SubscriptionResource. + /// An object representing collection of ManagedOpResources and their operations over a ManagedOpResource. + public virtual ManagedOpCollection GetManagedOps() + { + return GetCachedClient(client => new ManagedOpCollection(client, Id)); + } + + /// + /// Gets the information of the ManagedOps instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedOps/managedOps/{managedOpsName} + /// + /// + /// Operation Id + /// ManagedOp_Get + /// + /// + /// Default Api Version + /// 2025-07-28-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetManagedOpAsync(string managedOpsName, CancellationToken cancellationToken = default) + { + return await GetManagedOps().GetAsync(managedOpsName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the information of the ManagedOps instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedOps/managedOps/{managedOpsName} + /// + /// + /// Operation Id + /// ManagedOp_Get + /// + /// + /// Default Api Version + /// 2025-07-28-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetManagedOp(string managedOpsName, CancellationToken cancellationToken = default) + { + return GetManagedOps().Get(managedOpsName, cancellationToken); + } + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Internal/Argument.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Internal/Argument.cs new file mode 100644 index 000000000000..cbfbe686da94 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/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.ManagedOps +{ + 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/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Internal/ChangeTrackingDictionary.cs new file mode 100644 index 000000000000..ea6cf9b3faa9 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/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.ManagedOps +{ + 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/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Internal/ChangeTrackingList.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Internal/ChangeTrackingList.cs new file mode 100644 index 000000000000..854d641e505d --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/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.ManagedOps +{ + 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/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Internal/ModelSerializationExtensions.cs new file mode 100644 index 000000000000..31ec1781682c --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Internal/ModelSerializationExtensions.cs @@ -0,0 +1,409 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; +using System.Text.Json; +using System.Xml; +using Azure.Core; + +namespace Azure.ResourceManager.ManagedOps +{ + internal static class ModelSerializationExtensions + { + internal static readonly JsonDocumentOptions JsonDocumentOptions = new JsonDocumentOptions { MaxDepth = 256 }; + internal static readonly ModelReaderWriterOptions WireOptions = new ModelReaderWriterOptions("W"); + internal static readonly ModelReaderWriterOptions WireV3Options = new ModelReaderWriterOptions("W|v3"); + internal static readonly ModelReaderWriterOptions JsonV3Options = new ModelReaderWriterOptions("J|v3"); + internal static readonly BinaryData SentinelValue = BinaryData.FromBytes("\"__EMPTY__\""u8.ToArray()); + + 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); + } + + 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/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Internal/Optional.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Internal/Optional.cs new file mode 100644 index 000000000000..95575faf72e3 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/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.ManagedOps +{ + 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/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Internal/Utf8JsonRequestContent.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Internal/Utf8JsonRequestContent.cs new file mode 100644 index 000000000000..c1b1cf1c53fd --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/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.ManagedOps +{ + 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/managedops/Azure.ResourceManager.ManagedOps/src/Generated/LongRunningOperation/ManagedOpOperationSource.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/LongRunningOperation/ManagedOpOperationSource.cs new file mode 100644 index 000000000000..518fb0881380 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/LongRunningOperation/ManagedOpOperationSource.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.ManagedOps +{ + internal class ManagedOpOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal ManagedOpOperationSource(ArmClient client) + { + _client = client; + } + + ManagedOpResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerManagedOpsContext.Default); + return new ManagedOpResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerManagedOpsContext.Default); + return await Task.FromResult(new ManagedOpResource(_client, data)).ConfigureAwait(false); + } + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/LongRunningOperation/ManagedOpsArmOperation.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/LongRunningOperation/ManagedOpsArmOperation.cs new file mode 100644 index 000000000000..8042b406549b --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/LongRunningOperation/ManagedOpsArmOperation.cs @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.ManagedOps +{ +#pragma warning disable SA1649 // File name should match first type name + internal class ManagedOpsArmOperation : 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 ManagedOpsArmOperation for mocking. + protected ManagedOpsArmOperation() + { + } + + internal ManagedOpsArmOperation(Response response, RehydrationToken? rehydrationToken = null) + { + _operation = OperationInternal.Succeeded(response); + _completeRehydrationToken = rehydrationToken; + _operationId = GetOperationId(rehydrationToken); + } + + internal ManagedOpsArmOperation(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, "ManagedOpsArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + } + + private string GetOperationId(RehydrationToken? rehydrationToken) + { + if (rehydrationToken is null) + { + return null; + } + var data = ModelReaderWriter.Write(rehydrationToken, ModelReaderWriterOptions.Json, AzureResourceManagerManagedOpsContext.Default); + using var document = JsonDocument.Parse(data); + var lroDetails = document.RootElement; + return lroDetails.GetProperty("id").GetString(); + } + /// + 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/managedops/Azure.ResourceManager.ManagedOps/src/Generated/LongRunningOperation/ManagedOpsArmOperationOfT.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/LongRunningOperation/ManagedOpsArmOperationOfT.cs new file mode 100644 index 000000000000..08855a54a9d3 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/LongRunningOperation/ManagedOpsArmOperationOfT.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.ManagedOps +{ +#pragma warning disable SA1649 // File name should match first type name + internal class ManagedOpsArmOperation : 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 ManagedOpsArmOperation for mocking. + protected ManagedOpsArmOperation() + { + } + + internal ManagedOpsArmOperation(Response response, RehydrationToken? rehydrationToken = null) + { + _operation = OperationInternal.Succeeded(response.GetRawResponse(), response.Value); + _completeRehydrationToken = rehydrationToken; + _operationId = GetOperationId(rehydrationToken); + } + + internal ManagedOpsArmOperation(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, "ManagedOpsArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + } + + private string GetOperationId(RehydrationToken? rehydrationToken) + { + if (rehydrationToken is null) + { + return null; + } + var data = ModelReaderWriter.Write(rehydrationToken, ModelReaderWriterOptions.Json, AzureResourceManagerManagedOpsContext.Default); + using var document = JsonDocument.Parse(data); + var lroDetails = document.RootElement; + return lroDetails.GetProperty("id").GetString(); + } + /// + 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/managedops/Azure.ResourceManager.ManagedOps/src/Generated/ManagedOpCollection.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/ManagedOpCollection.cs new file mode 100644 index 000000000000..cd941ac1565b --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/ManagedOpCollection.cs @@ -0,0 +1,494 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.ManagedOps +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetManagedOps method from an instance of . + /// + public partial class ManagedOpCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _managedOpClientDiagnostics; + private readonly ManagedOpsRestOperations _managedOpRestClient; + + /// Initializes a new instance of the class for mocking. + protected ManagedOpCollection() + { + } + + /// 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 ManagedOpCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _managedOpClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ManagedOps", ManagedOpResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ManagedOpResource.ResourceType, out string managedOpApiVersion); + _managedOpRestClient = new ManagedOpsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, managedOpApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != SubscriptionResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, SubscriptionResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates the ManagedOps instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedOps/managedOps/{managedOpsName} + /// + /// + /// Operation Id + /// ManagedOp_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-07-28-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Name of the resource. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string managedOpsName, ManagedOpData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managedOpsName, nameof(managedOpsName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _managedOpClientDiagnostics.CreateScope("ManagedOpCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _managedOpRestClient.CreateOrUpdateAsync(Id.SubscriptionId, managedOpsName, data, cancellationToken).ConfigureAwait(false); + var operation = new ManagedOpsArmOperation(new ManagedOpOperationSource(Client), _managedOpClientDiagnostics, Pipeline, _managedOpRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, managedOpsName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates the ManagedOps instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedOps/managedOps/{managedOpsName} + /// + /// + /// Operation Id + /// ManagedOp_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-07-28-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Name of the resource. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string managedOpsName, ManagedOpData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managedOpsName, nameof(managedOpsName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _managedOpClientDiagnostics.CreateScope("ManagedOpCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _managedOpRestClient.CreateOrUpdate(Id.SubscriptionId, managedOpsName, data, cancellationToken); + var operation = new ManagedOpsArmOperation(new ManagedOpOperationSource(Client), _managedOpClientDiagnostics, Pipeline, _managedOpRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, managedOpsName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the information of the ManagedOps instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedOps/managedOps/{managedOpsName} + /// + /// + /// Operation Id + /// ManagedOp_Get + /// + /// + /// Default Api Version + /// 2025-07-28-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string managedOpsName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managedOpsName, nameof(managedOpsName)); + + using var scope = _managedOpClientDiagnostics.CreateScope("ManagedOpCollection.Get"); + scope.Start(); + try + { + var response = await _managedOpRestClient.GetAsync(Id.SubscriptionId, managedOpsName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ManagedOpResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the information of the ManagedOps instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedOps/managedOps/{managedOpsName} + /// + /// + /// Operation Id + /// ManagedOp_Get + /// + /// + /// Default Api Version + /// 2025-07-28-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string managedOpsName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managedOpsName, nameof(managedOpsName)); + + using var scope = _managedOpClientDiagnostics.CreateScope("ManagedOpCollection.Get"); + scope.Start(); + try + { + var response = _managedOpRestClient.Get(Id.SubscriptionId, managedOpsName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ManagedOpResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List all ManagedOps instances in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedOps/managedOps + /// + /// + /// Operation Id + /// ManagedOp_List + /// + /// + /// Default Api Version + /// 2025-07-28-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _managedOpRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _managedOpRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ManagedOpResource(Client, ManagedOpData.DeserializeManagedOpData(e)), _managedOpClientDiagnostics, Pipeline, "ManagedOpCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List all ManagedOps instances in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedOps/managedOps + /// + /// + /// Operation Id + /// ManagedOp_List + /// + /// + /// Default Api Version + /// 2025-07-28-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _managedOpRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _managedOpRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ManagedOpResource(Client, ManagedOpData.DeserializeManagedOpData(e)), _managedOpClientDiagnostics, Pipeline, "ManagedOpCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedOps/managedOps/{managedOpsName} + /// + /// + /// Operation Id + /// ManagedOp_Get + /// + /// + /// Default Api Version + /// 2025-07-28-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string managedOpsName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managedOpsName, nameof(managedOpsName)); + + using var scope = _managedOpClientDiagnostics.CreateScope("ManagedOpCollection.Exists"); + scope.Start(); + try + { + var response = await _managedOpRestClient.GetAsync(Id.SubscriptionId, managedOpsName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedOps/managedOps/{managedOpsName} + /// + /// + /// Operation Id + /// ManagedOp_Get + /// + /// + /// Default Api Version + /// 2025-07-28-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string managedOpsName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managedOpsName, nameof(managedOpsName)); + + using var scope = _managedOpClientDiagnostics.CreateScope("ManagedOpCollection.Exists"); + scope.Start(); + try + { + var response = _managedOpRestClient.Get(Id.SubscriptionId, managedOpsName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedOps/managedOps/{managedOpsName} + /// + /// + /// Operation Id + /// ManagedOp_Get + /// + /// + /// Default Api Version + /// 2025-07-28-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string managedOpsName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managedOpsName, nameof(managedOpsName)); + + using var scope = _managedOpClientDiagnostics.CreateScope("ManagedOpCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedOpRestClient.GetAsync(Id.SubscriptionId, managedOpsName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedOpResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedOps/managedOps/{managedOpsName} + /// + /// + /// Operation Id + /// ManagedOp_Get + /// + /// + /// Default Api Version + /// 2025-07-28-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string managedOpsName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managedOpsName, nameof(managedOpsName)); + + using var scope = _managedOpClientDiagnostics.CreateScope("ManagedOpCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedOpRestClient.Get(Id.SubscriptionId, managedOpsName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedOpResource(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/managedops/Azure.ResourceManager.ManagedOps/src/Generated/ManagedOpData.Serialization.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/ManagedOpData.Serialization.cs new file mode 100644 index 000000000000..60f41e0585f4 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/ManagedOpData.Serialization.cs @@ -0,0 +1,156 @@ +// Copyright (c) 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.ManagedOps.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ManagedOps +{ + public partial class ManagedOpData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(ManagedOpData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + ManagedOpData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedOpData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagedOpData(document.RootElement, options); + } + + internal static ManagedOpData DeserializeManagedOpData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ManagedOpsProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ManagedOpsProperties.DeserializeManagedOpsProperties(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 = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerManagedOpsContext.Default); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ManagedOpData( + id, + name, + type, + systemData, + properties, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerManagedOpsContext.Default); + default: + throw new FormatException($"The model {nameof(ManagedOpData)} does not support writing '{options.Format}' format."); + } + } + + ManagedOpData IPersistableModel.Create(BinaryData 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 DeserializeManagedOpData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagedOpData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/ManagedOpData.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/ManagedOpData.cs new file mode 100644 index 000000000000..cb0af276664a --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/ManagedOpData.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ManagedOps.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ManagedOps +{ + /// + /// A class representing the ManagedOp data model. + /// The Managed Operations resource. + /// + public partial class ManagedOpData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ManagedOpData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal ManagedOpData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ManagedOpsProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource-specific properties for this resource. + public ManagedOpsProperties Properties { get; set; } + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/ManagedOpResource.Serialization.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/ManagedOpResource.Serialization.cs new file mode 100644 index 000000000000..553c1d4505f2 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/ManagedOpResource.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.ManagedOps +{ + public partial class ManagedOpResource : IJsonModel + { + private static ManagedOpData s_dataDeserializationInstance; + private static ManagedOpData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + ManagedOpData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)DataDeserializationInstance).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerManagedOpsContext.Default); + + ManagedOpData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerManagedOpsContext.Default); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)DataDeserializationInstance).GetFormatFromOptions(options); + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/ManagedOpResource.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/ManagedOpResource.cs new file mode 100644 index 000000000000..9934842f975f --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/ManagedOpResource.cs @@ -0,0 +1,347 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ManagedOps.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.ManagedOps +{ + /// + /// A Class representing a ManagedOp along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetManagedOpResource method. + /// Otherwise you can get one from its parent resource using the GetManagedOp method. + /// + public partial class ManagedOpResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The managedOpsName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string managedOpsName) + { + var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.ManagedOps/managedOps/{managedOpsName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _managedOpClientDiagnostics; + private readonly ManagedOpsRestOperations _managedOpRestClient; + private readonly ManagedOpData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ManagedOps/managedOps"; + + /// Initializes a new instance of the class for mocking. + protected ManagedOpResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ManagedOpResource(ArmClient client, ManagedOpData 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 ManagedOpResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _managedOpClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ManagedOps", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string managedOpApiVersion); + _managedOpRestClient = new ManagedOpsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, managedOpApiVersion); +#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 ManagedOpData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the information of the ManagedOps instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedOps/managedOps/{managedOpsName} + /// + /// + /// Operation Id + /// ManagedOp_Get + /// + /// + /// Default Api Version + /// 2025-07-28-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _managedOpClientDiagnostics.CreateScope("ManagedOpResource.Get"); + scope.Start(); + try + { + var response = await _managedOpRestClient.GetAsync(Id.SubscriptionId, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ManagedOpResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the information of the ManagedOps instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedOps/managedOps/{managedOpsName} + /// + /// + /// Operation Id + /// ManagedOp_Get + /// + /// + /// Default Api Version + /// 2025-07-28-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _managedOpClientDiagnostics.CreateScope("ManagedOpResource.Get"); + scope.Start(); + try + { + var response = _managedOpRestClient.Get(Id.SubscriptionId, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ManagedOpResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the ManagedOps instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedOps/managedOps/{managedOpsName} + /// + /// + /// Operation Id + /// ManagedOp_Delete + /// + /// + /// Default Api Version + /// 2025-07-28-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _managedOpClientDiagnostics.CreateScope("ManagedOpResource.Delete"); + scope.Start(); + try + { + var response = await _managedOpRestClient.DeleteAsync(Id.SubscriptionId, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ManagedOpsArmOperation(_managedOpClientDiagnostics, Pipeline, _managedOpRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the ManagedOps instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedOps/managedOps/{managedOpsName} + /// + /// + /// Operation Id + /// ManagedOp_Delete + /// + /// + /// Default Api Version + /// 2025-07-28-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _managedOpClientDiagnostics.CreateScope("ManagedOpResource.Delete"); + scope.Start(); + try + { + var response = _managedOpRestClient.Delete(Id.SubscriptionId, Id.Name, cancellationToken); + var operation = new ManagedOpsArmOperation(_managedOpClientDiagnostics, Pipeline, _managedOpRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the ManagedOps instance with the supplied fields. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedOps/managedOps/{managedOpsName} + /// + /// + /// Operation Id + /// ManagedOp_Update + /// + /// + /// Default Api Version + /// 2025-07-28-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ManagedOpPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _managedOpClientDiagnostics.CreateScope("ManagedOpResource.Update"); + scope.Start(); + try + { + var response = await _managedOpRestClient.UpdateAsync(Id.SubscriptionId, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new ManagedOpsArmOperation(new ManagedOpOperationSource(Client), _managedOpClientDiagnostics, Pipeline, _managedOpRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates the ManagedOps instance with the supplied fields. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ManagedOps/managedOps/{managedOpsName} + /// + /// + /// Operation Id + /// ManagedOp_Update + /// + /// + /// Default Api Version + /// 2025-07-28-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, ManagedOpPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _managedOpClientDiagnostics.CreateScope("ManagedOpResource.Update"); + scope.Start(); + try + { + var response = _managedOpRestClient.Update(Id.SubscriptionId, Id.Name, patch, cancellationToken); + var operation = new ManagedOpsArmOperation(new ManagedOpOperationSource(Client), _managedOpClientDiagnostics, Pipeline, _managedOpRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/AzureMonitorConfiguration.Serialization.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/AzureMonitorConfiguration.Serialization.cs new file mode 100644 index 000000000000..b6c8e3f05d97 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/AzureMonitorConfiguration.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ManagedOps.Models +{ + public partial class AzureMonitorConfiguration : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(AzureMonitorConfiguration)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("azureMonitorWorkspaceId"u8); + writer.WriteStringValue(AzureMonitorWorkspaceId); + 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 + } + } + } + + AzureMonitorConfiguration IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AzureMonitorConfiguration)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAzureMonitorConfiguration(document.RootElement, options); + } + + internal static AzureMonitorConfiguration DeserializeAzureMonitorConfiguration(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier azureMonitorWorkspaceId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("azureMonitorWorkspaceId"u8)) + { + azureMonitorWorkspaceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AzureMonitorConfiguration(azureMonitorWorkspaceId, 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, AzureResourceManagerManagedOpsContext.Default); + default: + throw new FormatException($"The model {nameof(AzureMonitorConfiguration)} does not support writing '{options.Format}' format."); + } + } + + AzureMonitorConfiguration IPersistableModel.Create(BinaryData 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 DeserializeAzureMonitorConfiguration(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AzureMonitorConfiguration)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/AzureMonitorConfiguration.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/AzureMonitorConfiguration.cs new file mode 100644 index 000000000000..00cf08769028 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/AzureMonitorConfiguration.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ManagedOps.Models +{ + /// Configuration for the Azure Monitor Insights service. + public partial class AzureMonitorConfiguration + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// 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 monitor workspace resource ID used by the service. + /// is null. + public AzureMonitorConfiguration(ResourceIdentifier azureMonitorWorkspaceId) + { + Argument.AssertNotNull(azureMonitorWorkspaceId, nameof(azureMonitorWorkspaceId)); + + AzureMonitorWorkspaceId = azureMonitorWorkspaceId; + } + + /// Initializes a new instance of . + /// Azure monitor workspace resource ID used by the service. + /// Keeps track of any properties unknown to the library. + internal AzureMonitorConfiguration(ResourceIdentifier azureMonitorWorkspaceId, IDictionary serializedAdditionalRawData) + { + AzureMonitorWorkspaceId = azureMonitorWorkspaceId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AzureMonitorConfiguration() + { + } + + /// Azure monitor workspace resource ID used by the service. + public ResourceIdentifier AzureMonitorWorkspaceId { get; set; } + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/AzureMonitorInformation.Serialization.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/AzureMonitorInformation.Serialization.cs new file mode 100644 index 000000000000..9939a9057b96 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/AzureMonitorInformation.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ManagedOps.Models +{ + public partial class AzureMonitorInformation : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(AzureMonitorInformation)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("dcrId"u8); + writer.WriteStringValue(DcrId); + writer.WritePropertyName("enablementStatus"u8); + writer.WriteStringValue(EnablementStatus.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 + } + } + } + + AzureMonitorInformation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AzureMonitorInformation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAzureMonitorInformation(document.RootElement, options); + } + + internal static AzureMonitorInformation DeserializeAzureMonitorInformation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier dcrId = default; + ChangeTrackingInformationEnablementStatus enablementStatus = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("dcrId"u8)) + { + dcrId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("enablementStatus"u8)) + { + enablementStatus = new ChangeTrackingInformationEnablementStatus(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AzureMonitorInformation(dcrId, enablementStatus, 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, AzureResourceManagerManagedOpsContext.Default); + default: + throw new FormatException($"The model {nameof(AzureMonitorInformation)} does not support writing '{options.Format}' format."); + } + } + + AzureMonitorInformation IPersistableModel.Create(BinaryData 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 DeserializeAzureMonitorInformation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AzureMonitorInformation)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/AzureMonitorInformation.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/AzureMonitorInformation.cs new file mode 100644 index 000000000000..3d5530a95b54 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/AzureMonitorInformation.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.ManagedOps.Models +{ + /// Azure Monitor Insights service information. + public partial class AzureMonitorInformation + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// ID of Data Collection Rule (DCR) associated with this service. + /// Indicates whether the service is enabled. + /// is null. + internal AzureMonitorInformation(ResourceIdentifier dcrId, ChangeTrackingInformationEnablementStatus enablementStatus) + { + Argument.AssertNotNull(dcrId, nameof(dcrId)); + + DcrId = dcrId; + EnablementStatus = enablementStatus; + } + + /// Initializes a new instance of . + /// ID of Data Collection Rule (DCR) associated with this service. + /// Indicates whether the service is enabled. + /// Keeps track of any properties unknown to the library. + internal AzureMonitorInformation(ResourceIdentifier dcrId, ChangeTrackingInformationEnablementStatus enablementStatus, IDictionary serializedAdditionalRawData) + { + DcrId = dcrId; + EnablementStatus = enablementStatus; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AzureMonitorInformation() + { + } + + /// ID of Data Collection Rule (DCR) associated with this service. + public ResourceIdentifier DcrId { get; } + /// Indicates whether the service is enabled. + public ChangeTrackingInformationEnablementStatus EnablementStatus { get; } + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/AzureResourceManagerManagedOpsContext.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/AzureResourceManagerManagedOpsContext.cs new file mode 100644 index 000000000000..eb3a6551a9fd --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/AzureResourceManagerManagedOpsContext.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.ClientModel.Primitives; +using Azure.ResourceManager.ManagedOps.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ManagedOps +{ + /// + /// 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' + /// + [ModelReaderWriterBuildable(typeof(AzureMonitorConfiguration))] + [ModelReaderWriterBuildable(typeof(AzureMonitorInformation))] + [ModelReaderWriterBuildable(typeof(ChangeTrackingConfiguration))] + [ModelReaderWriterBuildable(typeof(ChangeTrackingInformation))] + [ModelReaderWriterBuildable(typeof(DefenderCspmInformation))] + [ModelReaderWriterBuildable(typeof(DefenderForServersInformation))] + [ModelReaderWriterBuildable(typeof(DesiredConfiguration))] + [ModelReaderWriterBuildable(typeof(GuestConfigurationInformation))] + [ModelReaderWriterBuildable(typeof(ManagedOpData))] + [ModelReaderWriterBuildable(typeof(ManagedOpListResult))] + [ModelReaderWriterBuildable(typeof(ManagedOpPatch))] + [ModelReaderWriterBuildable(typeof(ManagedOpResource))] + [ModelReaderWriterBuildable(typeof(ManagedOpsProperties))] + [ModelReaderWriterBuildable(typeof(ManagedOpsSku))] + [ModelReaderWriterBuildable(typeof(ManagedOpUpdateProperties))] + [ModelReaderWriterBuildable(typeof(PolicyAssignmentProperties))] + [ModelReaderWriterBuildable(typeof(ResponseError))] + [ModelReaderWriterBuildable(typeof(ServiceInformation))] + [ModelReaderWriterBuildable(typeof(SystemData))] + [ModelReaderWriterBuildable(typeof(UpdateManagerInformation))] + public partial class AzureResourceManagerManagedOpsContext : ModelReaderWriterContext + { + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ChangeTrackingConfiguration.Serialization.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ChangeTrackingConfiguration.Serialization.cs new file mode 100644 index 000000000000..adfaf8054737 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ChangeTrackingConfiguration.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ManagedOps.Models +{ + public partial class ChangeTrackingConfiguration : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(ChangeTrackingConfiguration)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("logAnalyticsWorkspaceId"u8); + writer.WriteStringValue(LogAnalyticsWorkspaceId); + 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 + } + } + } + + ChangeTrackingConfiguration IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ChangeTrackingConfiguration)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeChangeTrackingConfiguration(document.RootElement, options); + } + + internal static ChangeTrackingConfiguration DeserializeChangeTrackingConfiguration(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier logAnalyticsWorkspaceId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("logAnalyticsWorkspaceId"u8)) + { + logAnalyticsWorkspaceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ChangeTrackingConfiguration(logAnalyticsWorkspaceId, 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, AzureResourceManagerManagedOpsContext.Default); + default: + throw new FormatException($"The model {nameof(ChangeTrackingConfiguration)} does not support writing '{options.Format}' format."); + } + } + + ChangeTrackingConfiguration IPersistableModel.Create(BinaryData 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 DeserializeChangeTrackingConfiguration(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ChangeTrackingConfiguration)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ChangeTrackingConfiguration.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ChangeTrackingConfiguration.cs new file mode 100644 index 000000000000..dee7ff79effc --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ChangeTrackingConfiguration.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ManagedOps.Models +{ + /// Configuration for the Change Tracking and Inventory service. + public partial class ChangeTrackingConfiguration + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Log analytics workspace resource ID used by the service. + /// is null. + public ChangeTrackingConfiguration(ResourceIdentifier logAnalyticsWorkspaceId) + { + Argument.AssertNotNull(logAnalyticsWorkspaceId, nameof(logAnalyticsWorkspaceId)); + + LogAnalyticsWorkspaceId = logAnalyticsWorkspaceId; + } + + /// Initializes a new instance of . + /// Log analytics workspace resource ID used by the service. + /// Keeps track of any properties unknown to the library. + internal ChangeTrackingConfiguration(ResourceIdentifier logAnalyticsWorkspaceId, IDictionary serializedAdditionalRawData) + { + LogAnalyticsWorkspaceId = logAnalyticsWorkspaceId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ChangeTrackingConfiguration() + { + } + + /// Log analytics workspace resource ID used by the service. + public ResourceIdentifier LogAnalyticsWorkspaceId { get; set; } + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ChangeTrackingInformation.Serialization.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ChangeTrackingInformation.Serialization.cs new file mode 100644 index 000000000000..16d1970b7adb --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ChangeTrackingInformation.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ManagedOps.Models +{ + public partial class ChangeTrackingInformation : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(ChangeTrackingInformation)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("dcrId"u8); + writer.WriteStringValue(DcrId); + writer.WritePropertyName("enablementStatus"u8); + writer.WriteStringValue(EnablementStatus.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 + } + } + } + + ChangeTrackingInformation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ChangeTrackingInformation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeChangeTrackingInformation(document.RootElement, options); + } + + internal static ChangeTrackingInformation DeserializeChangeTrackingInformation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier dcrId = default; + ChangeTrackingInformationEnablementStatus enablementStatus = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("dcrId"u8)) + { + dcrId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("enablementStatus"u8)) + { + enablementStatus = new ChangeTrackingInformationEnablementStatus(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ChangeTrackingInformation(dcrId, enablementStatus, 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, AzureResourceManagerManagedOpsContext.Default); + default: + throw new FormatException($"The model {nameof(ChangeTrackingInformation)} does not support writing '{options.Format}' format."); + } + } + + ChangeTrackingInformation IPersistableModel.Create(BinaryData 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 DeserializeChangeTrackingInformation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ChangeTrackingInformation)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ChangeTrackingInformation.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ChangeTrackingInformation.cs new file mode 100644 index 000000000000..16035987e556 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ChangeTrackingInformation.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.ManagedOps.Models +{ + /// Change Tracking and Inventory service information. + public partial class ChangeTrackingInformation + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// ID of Data Collection Rule (DCR) associated with this service. + /// Indicates whether the service is enabled. + /// is null. + internal ChangeTrackingInformation(ResourceIdentifier dcrId, ChangeTrackingInformationEnablementStatus enablementStatus) + { + Argument.AssertNotNull(dcrId, nameof(dcrId)); + + DcrId = dcrId; + EnablementStatus = enablementStatus; + } + + /// Initializes a new instance of . + /// ID of Data Collection Rule (DCR) associated with this service. + /// Indicates whether the service is enabled. + /// Keeps track of any properties unknown to the library. + internal ChangeTrackingInformation(ResourceIdentifier dcrId, ChangeTrackingInformationEnablementStatus enablementStatus, IDictionary serializedAdditionalRawData) + { + DcrId = dcrId; + EnablementStatus = enablementStatus; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ChangeTrackingInformation() + { + } + + /// ID of Data Collection Rule (DCR) associated with this service. + public ResourceIdentifier DcrId { get; } + /// Indicates whether the service is enabled. + public ChangeTrackingInformationEnablementStatus EnablementStatus { get; } + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ChangeTrackingInformationEnablementStatus.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ChangeTrackingInformationEnablementStatus.cs new file mode 100644 index 000000000000..ba5847593a73 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ChangeTrackingInformationEnablementStatus.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.ManagedOps.Models +{ + /// The ChangeTrackingInformationEnablementStatus. + public readonly partial struct ChangeTrackingInformationEnablementStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ChangeTrackingInformationEnablementStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EnabledValue = "Enabled"; + private const string InProgressValue = "InProgress"; + private const string FailedValue = "Failed"; + private const string DisabledValue = "Disabled"; + + /// Enabled. + public static ChangeTrackingInformationEnablementStatus Enabled { get; } = new ChangeTrackingInformationEnablementStatus(EnabledValue); + /// InProgress. + public static ChangeTrackingInformationEnablementStatus InProgress { get; } = new ChangeTrackingInformationEnablementStatus(InProgressValue); + /// Failed. + public static ChangeTrackingInformationEnablementStatus Failed { get; } = new ChangeTrackingInformationEnablementStatus(FailedValue); + /// Disabled. + public static ChangeTrackingInformationEnablementStatus Disabled { get; } = new ChangeTrackingInformationEnablementStatus(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(ChangeTrackingInformationEnablementStatus left, ChangeTrackingInformationEnablementStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ChangeTrackingInformationEnablementStatus left, ChangeTrackingInformationEnablementStatus right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ChangeTrackingInformationEnablementStatus(string value) => new ChangeTrackingInformationEnablementStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ChangeTrackingInformationEnablementStatus other && Equals(other); + /// + public bool Equals(ChangeTrackingInformationEnablementStatus 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/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/DefenderCspmInformation.Serialization.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/DefenderCspmInformation.Serialization.cs new file mode 100644 index 000000000000..95b1e09b93c4 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/DefenderCspmInformation.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ManagedOps.Models +{ + internal partial class DefenderCspmInformation : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(DefenderCspmInformation)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("enablementStatus"u8); + writer.WriteStringValue(EnablementStatus.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 + } + } + } + + DefenderCspmInformation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DefenderCspmInformation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDefenderCspmInformation(document.RootElement, options); + } + + internal static DefenderCspmInformation DeserializeDefenderCspmInformation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ChangeTrackingInformationEnablementStatus enablementStatus = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("enablementStatus"u8)) + { + enablementStatus = new ChangeTrackingInformationEnablementStatus(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DefenderCspmInformation(enablementStatus, 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, AzureResourceManagerManagedOpsContext.Default); + default: + throw new FormatException($"The model {nameof(DefenderCspmInformation)} does not support writing '{options.Format}' format."); + } + } + + DefenderCspmInformation IPersistableModel.Create(BinaryData 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 DeserializeDefenderCspmInformation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DefenderCspmInformation)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/DefenderCspmInformation.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/DefenderCspmInformation.cs new file mode 100644 index 000000000000..e1204f68c54d --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/DefenderCspmInformation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ManagedOps.Models +{ + /// Defender Cloud Security Posture Management (CSPM) service information. + internal partial class DefenderCspmInformation + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Indicates whether the service is enabled. + internal DefenderCspmInformation(ChangeTrackingInformationEnablementStatus enablementStatus) + { + EnablementStatus = enablementStatus; + } + + /// Initializes a new instance of . + /// Indicates whether the service is enabled. + /// Keeps track of any properties unknown to the library. + internal DefenderCspmInformation(ChangeTrackingInformationEnablementStatus enablementStatus, IDictionary serializedAdditionalRawData) + { + EnablementStatus = enablementStatus; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DefenderCspmInformation() + { + } + + /// Indicates whether the service is enabled. + public ChangeTrackingInformationEnablementStatus EnablementStatus { get; } + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/DefenderForServersInformation.Serialization.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/DefenderForServersInformation.Serialization.cs new file mode 100644 index 000000000000..1a408d7f1ab2 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/DefenderForServersInformation.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ManagedOps.Models +{ + internal partial class DefenderForServersInformation : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(DefenderForServersInformation)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("enablementStatus"u8); + writer.WriteStringValue(EnablementStatus.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 + } + } + } + + DefenderForServersInformation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DefenderForServersInformation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDefenderForServersInformation(document.RootElement, options); + } + + internal static DefenderForServersInformation DeserializeDefenderForServersInformation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ChangeTrackingInformationEnablementStatus enablementStatus = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("enablementStatus"u8)) + { + enablementStatus = new ChangeTrackingInformationEnablementStatus(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DefenderForServersInformation(enablementStatus, 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, AzureResourceManagerManagedOpsContext.Default); + default: + throw new FormatException($"The model {nameof(DefenderForServersInformation)} does not support writing '{options.Format}' format."); + } + } + + DefenderForServersInformation IPersistableModel.Create(BinaryData 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 DeserializeDefenderForServersInformation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DefenderForServersInformation)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/DefenderForServersInformation.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/DefenderForServersInformation.cs new file mode 100644 index 000000000000..1f9afccb9a32 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/DefenderForServersInformation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ManagedOps.Models +{ + /// Defender for Servers service information. + internal partial class DefenderForServersInformation + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Indicates whether the service is enabled. + internal DefenderForServersInformation(ChangeTrackingInformationEnablementStatus enablementStatus) + { + EnablementStatus = enablementStatus; + } + + /// Initializes a new instance of . + /// Indicates whether the service is enabled. + /// Keeps track of any properties unknown to the library. + internal DefenderForServersInformation(ChangeTrackingInformationEnablementStatus enablementStatus, IDictionary serializedAdditionalRawData) + { + EnablementStatus = enablementStatus; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DefenderForServersInformation() + { + } + + /// Indicates whether the service is enabled. + public ChangeTrackingInformationEnablementStatus EnablementStatus { get; } + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/DesiredConfiguration.Serialization.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/DesiredConfiguration.Serialization.cs new file mode 100644 index 000000000000..8b3379a80c0a --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/DesiredConfiguration.Serialization.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ManagedOps.Models +{ + public partial class DesiredConfiguration : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(DesiredConfiguration)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("changeTrackingAndInventory"u8); + writer.WriteObjectValue(ChangeTrackingAndInventory, options); + writer.WritePropertyName("azureMonitorInsights"u8); + writer.WriteObjectValue(AzureMonitorInsights, options); + writer.WritePropertyName("userAssignedManagedIdentityId"u8); + writer.WriteStringValue(UserAssignedManagedIdentityId); + if (Optional.IsDefined(DefenderForServers)) + { + writer.WritePropertyName("defenderForServers"u8); + writer.WriteStringValue(DefenderForServers.Value.ToString()); + } + if (Optional.IsDefined(DefenderCspm)) + { + writer.WritePropertyName("defenderCspm"u8); + writer.WriteStringValue(DefenderCspm.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 + } + } + } + + DesiredConfiguration IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DesiredConfiguration)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDesiredConfiguration(document.RootElement, options); + } + + internal static DesiredConfiguration DeserializeDesiredConfiguration(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ChangeTrackingConfiguration changeTrackingAndInventory = default; + AzureMonitorConfiguration azureMonitorInsights = default; + ResourceIdentifier userAssignedManagedIdentityId = default; + DesiredConfigurationDefenderForServer? defenderForServers = default; + DesiredConfigurationDefenderForServer? defenderCspm = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("changeTrackingAndInventory"u8)) + { + changeTrackingAndInventory = ChangeTrackingConfiguration.DeserializeChangeTrackingConfiguration(property.Value, options); + continue; + } + if (property.NameEquals("azureMonitorInsights"u8)) + { + azureMonitorInsights = AzureMonitorConfiguration.DeserializeAzureMonitorConfiguration(property.Value, options); + continue; + } + if (property.NameEquals("userAssignedManagedIdentityId"u8)) + { + userAssignedManagedIdentityId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("defenderForServers"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + defenderForServers = new DesiredConfigurationDefenderForServer(property.Value.GetString()); + continue; + } + if (property.NameEquals("defenderCspm"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + defenderCspm = new DesiredConfigurationDefenderForServer(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DesiredConfiguration( + changeTrackingAndInventory, + azureMonitorInsights, + userAssignedManagedIdentityId, + defenderForServers, + defenderCspm, + 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, AzureResourceManagerManagedOpsContext.Default); + default: + throw new FormatException($"The model {nameof(DesiredConfiguration)} does not support writing '{options.Format}' format."); + } + } + + DesiredConfiguration IPersistableModel.Create(BinaryData 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 DeserializeDesiredConfiguration(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DesiredConfiguration)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/DesiredConfiguration.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/DesiredConfiguration.cs new file mode 100644 index 000000000000..224e6c2bd5db --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/DesiredConfiguration.cs @@ -0,0 +1,112 @@ +// 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.ManagedOps.Models +{ + /// Desired configuration input by the user. + public partial class DesiredConfiguration + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Configuration for the Change Tracking and Inventory service. + /// Configuration for the Azure Monitor Insights service. + /// User assigned Managed Identity used to perform operations on machines managed by Ops360. + /// , or is null. + public DesiredConfiguration(ChangeTrackingConfiguration changeTrackingAndInventory, AzureMonitorConfiguration azureMonitorInsights, ResourceIdentifier userAssignedManagedIdentityId) + { + Argument.AssertNotNull(changeTrackingAndInventory, nameof(changeTrackingAndInventory)); + Argument.AssertNotNull(azureMonitorInsights, nameof(azureMonitorInsights)); + Argument.AssertNotNull(userAssignedManagedIdentityId, nameof(userAssignedManagedIdentityId)); + + ChangeTrackingAndInventory = changeTrackingAndInventory; + AzureMonitorInsights = azureMonitorInsights; + UserAssignedManagedIdentityId = userAssignedManagedIdentityId; + } + + /// Initializes a new instance of . + /// Configuration for the Change Tracking and Inventory service. + /// Configuration for the Azure Monitor Insights service. + /// User assigned Managed Identity used to perform operations on machines managed by Ops360. + /// Desired enablement state of the Defender For Servers service. + /// Desired enablement state of the Defender Cloud Security Posture Management (CSPM) service. + /// Keeps track of any properties unknown to the library. + internal DesiredConfiguration(ChangeTrackingConfiguration changeTrackingAndInventory, AzureMonitorConfiguration azureMonitorInsights, ResourceIdentifier userAssignedManagedIdentityId, DesiredConfigurationDefenderForServer? defenderForServers, DesiredConfigurationDefenderForServer? defenderCspm, IDictionary serializedAdditionalRawData) + { + ChangeTrackingAndInventory = changeTrackingAndInventory; + AzureMonitorInsights = azureMonitorInsights; + UserAssignedManagedIdentityId = userAssignedManagedIdentityId; + DefenderForServers = defenderForServers; + DefenderCspm = defenderCspm; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DesiredConfiguration() + { + } + + /// Configuration for the Change Tracking and Inventory service. + internal ChangeTrackingConfiguration ChangeTrackingAndInventory { get; set; } + /// Log analytics workspace resource ID used by the service. + public ResourceIdentifier ChangeTrackingAndInventoryLogAnalyticsWorkspaceId + { + get => ChangeTrackingAndInventory is null ? default : ChangeTrackingAndInventory.LogAnalyticsWorkspaceId; + set => ChangeTrackingAndInventory = new ChangeTrackingConfiguration(value); + } + + /// Configuration for the Azure Monitor Insights service. + internal AzureMonitorConfiguration AzureMonitorInsights { get; set; } + /// Azure monitor workspace resource ID used by the service. + public ResourceIdentifier AzureMonitorWorkspaceId + { + get => AzureMonitorInsights is null ? default : AzureMonitorInsights.AzureMonitorWorkspaceId; + set => AzureMonitorInsights = new AzureMonitorConfiguration(value); + } + + /// User assigned Managed Identity used to perform operations on machines managed by Ops360. + public ResourceIdentifier UserAssignedManagedIdentityId { get; set; } + /// Desired enablement state of the Defender For Servers service. + public DesiredConfigurationDefenderForServer? DefenderForServers { get; set; } + /// Desired enablement state of the Defender Cloud Security Posture Management (CSPM) service. + public DesiredConfigurationDefenderForServer? DefenderCspm { get; set; } + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/DesiredConfigurationDefenderForServer.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/DesiredConfigurationDefenderForServer.cs new file mode 100644 index 000000000000..f511fe06a5b2 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/DesiredConfigurationDefenderForServer.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.ManagedOps.Models +{ + /// The DesiredConfigurationDefenderForServers. + public readonly partial struct DesiredConfigurationDefenderForServer : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DesiredConfigurationDefenderForServer(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EnableValue = "Enable"; + private const string DisableValue = "Disable"; + + /// Enable. + public static DesiredConfigurationDefenderForServer Enable { get; } = new DesiredConfigurationDefenderForServer(EnableValue); + /// Disable. + public static DesiredConfigurationDefenderForServer Disable { get; } = new DesiredConfigurationDefenderForServer(DisableValue); + /// Determines if two values are the same. + public static bool operator ==(DesiredConfigurationDefenderForServer left, DesiredConfigurationDefenderForServer right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DesiredConfigurationDefenderForServer left, DesiredConfigurationDefenderForServer right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DesiredConfigurationDefenderForServer(string value) => new DesiredConfigurationDefenderForServer(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DesiredConfigurationDefenderForServer other && Equals(other); + /// + public bool Equals(DesiredConfigurationDefenderForServer 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/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/GuestConfigurationInformation.Serialization.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/GuestConfigurationInformation.Serialization.cs new file mode 100644 index 000000000000..22be75adf7d6 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/GuestConfigurationInformation.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ManagedOps.Models +{ + internal partial class GuestConfigurationInformation : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(GuestConfigurationInformation)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("enablementStatus"u8); + writer.WriteStringValue(EnablementStatus.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 + } + } + } + + GuestConfigurationInformation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GuestConfigurationInformation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGuestConfigurationInformation(document.RootElement, options); + } + + internal static GuestConfigurationInformation DeserializeGuestConfigurationInformation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ChangeTrackingInformationEnablementStatus enablementStatus = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("enablementStatus"u8)) + { + enablementStatus = new ChangeTrackingInformationEnablementStatus(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new GuestConfigurationInformation(enablementStatus, 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, AzureResourceManagerManagedOpsContext.Default); + default: + throw new FormatException($"The model {nameof(GuestConfigurationInformation)} does not support writing '{options.Format}' format."); + } + } + + GuestConfigurationInformation IPersistableModel.Create(BinaryData 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 DeserializeGuestConfigurationInformation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GuestConfigurationInformation)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/GuestConfigurationInformation.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/GuestConfigurationInformation.cs new file mode 100644 index 000000000000..de9044661864 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/GuestConfigurationInformation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ManagedOps.Models +{ + /// Azure Policy and Machine Configuration service information. + internal partial class GuestConfigurationInformation + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Indicates whether the service is enabled. + internal GuestConfigurationInformation(ChangeTrackingInformationEnablementStatus enablementStatus) + { + EnablementStatus = enablementStatus; + } + + /// Initializes a new instance of . + /// Indicates whether the service is enabled. + /// Keeps track of any properties unknown to the library. + internal GuestConfigurationInformation(ChangeTrackingInformationEnablementStatus enablementStatus, IDictionary serializedAdditionalRawData) + { + EnablementStatus = enablementStatus; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal GuestConfigurationInformation() + { + } + + /// Indicates whether the service is enabled. + public ChangeTrackingInformationEnablementStatus EnablementStatus { get; } + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ManagedOpListResult.Serialization.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ManagedOpListResult.Serialization.cs new file mode 100644 index 000000000000..15d3041fcbae --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ManagedOpListResult.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ManagedOps.Models +{ + internal partial class ManagedOpListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(ManagedOpListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ManagedOpListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedOpListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagedOpListResult(document.RootElement, options); + } + + internal static ManagedOpListResult DeserializeManagedOpListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ManagedOpData.DeserializeManagedOpData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ManagedOpListResult(value, nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerManagedOpsContext.Default); + default: + throw new FormatException($"The model {nameof(ManagedOpListResult)} does not support writing '{options.Format}' format."); + } + } + + ManagedOpListResult IPersistableModel.Create(BinaryData 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 DeserializeManagedOpListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagedOpListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ManagedOpListResult.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ManagedOpListResult.cs new file mode 100644 index 000000000000..09ec105d1410 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ManagedOpListResult.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.ManagedOps.Models +{ + /// The response of a ManagedOp list operation. + internal partial class ManagedOpListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// 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 ManagedOp items on this page. + /// is null. + internal ManagedOpListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The ManagedOp items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal ManagedOpListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ManagedOpListResult() + { + } + + /// The ManagedOp items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ManagedOpPatch.Serialization.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ManagedOpPatch.Serialization.cs new file mode 100644 index 000000000000..48a8361cc0e9 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ManagedOpPatch.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.ManagedOps.Models +{ + public partial class ManagedOpPatch : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(ManagedOpPatch)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ManagedOpPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedOpPatch)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagedOpPatch(document.RootElement, options); + } + + internal static ManagedOpPatch DeserializeManagedOpPatch(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ManagedOpUpdateProperties properties = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ManagedOpUpdateProperties.DeserializeManagedOpUpdateProperties(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ManagedOpPatch(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, AzureResourceManagerManagedOpsContext.Default); + default: + throw new FormatException($"The model {nameof(ManagedOpPatch)} does not support writing '{options.Format}' format."); + } + } + + ManagedOpPatch IPersistableModel.Create(BinaryData 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 DeserializeManagedOpPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagedOpPatch)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ManagedOpPatch.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ManagedOpPatch.cs new file mode 100644 index 000000000000..2a388d4f9dc6 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ManagedOpPatch.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.ManagedOps.Models +{ + /// The type used for update operations of the ManagedOp. + public partial class ManagedOpPatch + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// 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 ManagedOpPatch() + { + } + + /// Initializes a new instance of . + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal ManagedOpPatch(ManagedOpUpdateProperties properties, IDictionary serializedAdditionalRawData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource-specific properties for this resource. + internal ManagedOpUpdateProperties Properties { get; set; } + /// Desired configuration input by the user. + public DesiredConfiguration ManagedOpUpdateDesiredConfiguration + { + get => Properties is null ? default : Properties.DesiredConfiguration; + set + { + if (Properties is null) + Properties = new ManagedOpUpdateProperties(); + Properties.DesiredConfiguration = value; + } + } + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ManagedOpUpdateProperties.Serialization.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ManagedOpUpdateProperties.Serialization.cs new file mode 100644 index 000000000000..1397fe293a5a --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ManagedOpUpdateProperties.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.ManagedOps.Models +{ + internal partial class ManagedOpUpdateProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(ManagedOpUpdateProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(DesiredConfiguration)) + { + writer.WritePropertyName("desiredConfiguration"u8); + writer.WriteObjectValue(DesiredConfiguration, 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 + } + } + } + + ManagedOpUpdateProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedOpUpdateProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagedOpUpdateProperties(document.RootElement, options); + } + + internal static ManagedOpUpdateProperties DeserializeManagedOpUpdateProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DesiredConfiguration desiredConfiguration = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("desiredConfiguration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + desiredConfiguration = DesiredConfiguration.DeserializeDesiredConfiguration(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ManagedOpUpdateProperties(desiredConfiguration, 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, AzureResourceManagerManagedOpsContext.Default); + default: + throw new FormatException($"The model {nameof(ManagedOpUpdateProperties)} does not support writing '{options.Format}' format."); + } + } + + ManagedOpUpdateProperties IPersistableModel.Create(BinaryData 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 DeserializeManagedOpUpdateProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagedOpUpdateProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ManagedOpUpdateProperties.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ManagedOpUpdateProperties.cs new file mode 100644 index 000000000000..21982bd68017 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ManagedOpUpdateProperties.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ManagedOps.Models +{ + /// The updatable properties of the ManagedOp. + internal partial class ManagedOpUpdateProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// 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 ManagedOpUpdateProperties() + { + } + + /// Initializes a new instance of . + /// Desired configuration input by the user. + /// Keeps track of any properties unknown to the library. + internal ManagedOpUpdateProperties(DesiredConfiguration desiredConfiguration, IDictionary serializedAdditionalRawData) + { + DesiredConfiguration = desiredConfiguration; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Desired configuration input by the user. + public DesiredConfiguration DesiredConfiguration { get; set; } + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ManagedOpsProperties.Serialization.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ManagedOpsProperties.Serialization.cs new file mode 100644 index 000000000000..75e7769962d7 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ManagedOpsProperties.Serialization.cs @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ManagedOps.Models +{ + public partial class ManagedOpsProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(ManagedOpsProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"u8); + writer.WriteObjectValue(Sku, options); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + writer.WritePropertyName("desiredConfiguration"u8); + writer.WriteObjectValue(DesiredConfiguration, options); + if (options.Format != "W" && Optional.IsDefined(Services)) + { + writer.WritePropertyName("services"u8); + writer.WriteObjectValue(Services, options); + } + if (options.Format != "W" && Optional.IsDefined(PolicyAssignmentProperties)) + { + writer.WritePropertyName("policyAssignmentProperties"u8); + writer.WriteObjectValue(PolicyAssignmentProperties, 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 + } + } + } + + ManagedOpsProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedOpsProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagedOpsProperties(document.RootElement, options); + } + + internal static ManagedOpsProperties DeserializeManagedOpsProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ManagedOpsSku sku = default; + ProvisioningState? provisioningState = default; + DesiredConfiguration desiredConfiguration = default; + ServiceInformation services = default; + PolicyAssignmentProperties policyAssignmentProperties = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sku"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sku = ManagedOpsSku.DeserializeManagedOpsSku(property.Value, options); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("desiredConfiguration"u8)) + { + desiredConfiguration = DesiredConfiguration.DeserializeDesiredConfiguration(property.Value, options); + continue; + } + if (property.NameEquals("services"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + services = ServiceInformation.DeserializeServiceInformation(property.Value, options); + continue; + } + if (property.NameEquals("policyAssignmentProperties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + policyAssignmentProperties = PolicyAssignmentProperties.DeserializePolicyAssignmentProperties(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ManagedOpsProperties( + sku, + provisioningState, + desiredConfiguration, + services, + policyAssignmentProperties, + 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, AzureResourceManagerManagedOpsContext.Default); + default: + throw new FormatException($"The model {nameof(ManagedOpsProperties)} does not support writing '{options.Format}' format."); + } + } + + ManagedOpsProperties IPersistableModel.Create(BinaryData 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 DeserializeManagedOpsProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagedOpsProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ManagedOpsProperties.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ManagedOpsProperties.cs new file mode 100644 index 000000000000..d0f1c4675114 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ManagedOpsProperties.cs @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ManagedOps.Models +{ + /// Properties of the ManagedOps resource. + public partial class ManagedOpsProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Desired configuration input by the user. + /// is null. + public ManagedOpsProperties(DesiredConfiguration desiredConfiguration) + { + Argument.AssertNotNull(desiredConfiguration, nameof(desiredConfiguration)); + + DesiredConfiguration = desiredConfiguration; + } + + /// Initializes a new instance of . + /// Product plan details of this resource. + /// Provisioning state of the resource. + /// Desired configuration input by the user. + /// Services provisioned by this resource. + /// Policy assignments created for managing services. + /// Keeps track of any properties unknown to the library. + internal ManagedOpsProperties(ManagedOpsSku sku, ProvisioningState? provisioningState, DesiredConfiguration desiredConfiguration, ServiceInformation services, PolicyAssignmentProperties policyAssignmentProperties, IDictionary serializedAdditionalRawData) + { + Sku = sku; + ProvisioningState = provisioningState; + DesiredConfiguration = desiredConfiguration; + Services = services; + PolicyAssignmentProperties = policyAssignmentProperties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ManagedOpsProperties() + { + } + + /// Product plan details of this resource. + public ManagedOpsSku Sku { get; } + /// Provisioning state of the resource. + public ProvisioningState? ProvisioningState { get; } + /// Desired configuration input by the user. + public DesiredConfiguration DesiredConfiguration { get; set; } + /// Services provisioned by this resource. + public ServiceInformation Services { get; } + /// Policy assignments created for managing services. + internal PolicyAssignmentProperties PolicyAssignmentProperties { get; } + /// Policy initiative assignment ID. + public ResourceIdentifier PolicyInitiativeAssignmentId + { + get => PolicyAssignmentProperties?.PolicyInitiativeAssignmentId; + } + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ManagedOpsSku.Serialization.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ManagedOpsSku.Serialization.cs new file mode 100644 index 000000000000..9c1acfc34025 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ManagedOpsSku.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ManagedOps.Models +{ + public partial class ManagedOpsSku : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(ManagedOpsSku)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + writer.WritePropertyName("tier"u8); + writer.WriteStringValue(Tier); + 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 + } + } + } + + ManagedOpsSku IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ManagedOpsSku)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagedOpsSku(document.RootElement, options); + } + + internal static ManagedOpsSku DeserializeManagedOpsSku(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string tier = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("tier"u8)) + { + tier = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ManagedOpsSku(name, tier, 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, AzureResourceManagerManagedOpsContext.Default); + default: + throw new FormatException($"The model {nameof(ManagedOpsSku)} does not support writing '{options.Format}' format."); + } + } + + ManagedOpsSku IPersistableModel.Create(BinaryData 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 DeserializeManagedOpsSku(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagedOpsSku)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ManagedOpsSku.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ManagedOpsSku.cs new file mode 100644 index 000000000000..9db1db6abd71 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ManagedOpsSku.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.ManagedOps.Models +{ + /// Specifies the service plan for this resource. + public partial class ManagedOpsSku + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Name of the SKU. + /// Pricing tier of the SKU. + /// or is null. + internal ManagedOpsSku(string name, string tier) + { + Argument.AssertNotNull(name, nameof(name)); + Argument.AssertNotNull(tier, nameof(tier)); + + Name = name; + Tier = tier; + } + + /// Initializes a new instance of . + /// Name of the SKU. + /// Pricing tier of the SKU. + /// Keeps track of any properties unknown to the library. + internal ManagedOpsSku(string name, string tier, IDictionary serializedAdditionalRawData) + { + Name = name; + Tier = tier; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ManagedOpsSku() + { + } + + /// Name of the SKU. + public string Name { get; } + /// Pricing tier of the SKU. + public string Tier { get; } + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/PolicyAssignmentProperties.Serialization.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/PolicyAssignmentProperties.Serialization.cs new file mode 100644 index 000000000000..747ab41c22da --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/PolicyAssignmentProperties.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ManagedOps.Models +{ + internal partial class PolicyAssignmentProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(PolicyAssignmentProperties)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("policyInitiativeAssignmentId"u8); + writer.WriteStringValue(PolicyInitiativeAssignmentId); + 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 + } + } + } + + PolicyAssignmentProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PolicyAssignmentProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePolicyAssignmentProperties(document.RootElement, options); + } + + internal static PolicyAssignmentProperties DeserializePolicyAssignmentProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier policyInitiativeAssignmentId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("policyInitiativeAssignmentId"u8)) + { + policyInitiativeAssignmentId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PolicyAssignmentProperties(policyInitiativeAssignmentId, 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, AzureResourceManagerManagedOpsContext.Default); + default: + throw new FormatException($"The model {nameof(PolicyAssignmentProperties)} does not support writing '{options.Format}' format."); + } + } + + PolicyAssignmentProperties IPersistableModel.Create(BinaryData 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 DeserializePolicyAssignmentProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PolicyAssignmentProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/PolicyAssignmentProperties.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/PolicyAssignmentProperties.cs new file mode 100644 index 000000000000..fb91c218d2f6 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/PolicyAssignmentProperties.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ManagedOps.Models +{ + /// Policy assignments created for managing services. + internal partial class PolicyAssignmentProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Policy initiative assignment ID. + /// is null. + internal PolicyAssignmentProperties(ResourceIdentifier policyInitiativeAssignmentId) + { + Argument.AssertNotNull(policyInitiativeAssignmentId, nameof(policyInitiativeAssignmentId)); + + PolicyInitiativeAssignmentId = policyInitiativeAssignmentId; + } + + /// Initializes a new instance of . + /// Policy initiative assignment ID. + /// Keeps track of any properties unknown to the library. + internal PolicyAssignmentProperties(ResourceIdentifier policyInitiativeAssignmentId, IDictionary serializedAdditionalRawData) + { + PolicyInitiativeAssignmentId = policyInitiativeAssignmentId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PolicyAssignmentProperties() + { + } + + /// Policy initiative assignment ID. + public ResourceIdentifier PolicyInitiativeAssignmentId { get; } + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ProvisioningState.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ProvisioningState.cs new file mode 100644 index 000000000000..dadc2f868fd3 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ProvisioningState.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ManagedOps.Models +{ + /// The provisioning state of a resource. + public readonly partial struct ProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + private const string ProvisioningValue = "Provisioning"; + private const string DeletingValue = "Deleting"; + + /// Resource has been created. + public static ProvisioningState Succeeded { get; } = new ProvisioningState(SucceededValue); + /// Resource creation failed. + public static ProvisioningState Failed { get; } = new ProvisioningState(FailedValue); + /// Resource creation was canceled. + public static ProvisioningState Canceled { get; } = new ProvisioningState(CanceledValue); + /// The resource has begun provisioning. + public static ProvisioningState Provisioning { get; } = new ProvisioningState(ProvisioningValue); + /// The resource is being deleted. + public static ProvisioningState Deleting { get; } = new ProvisioningState(DeletingValue); + /// Determines if two values are the same. + public static bool operator ==(ProvisioningState left, ProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ProvisioningState left, ProvisioningState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ProvisioningState(string value) => new ProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ProvisioningState other && Equals(other); + /// + public bool Equals(ProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ServiceInformation.Serialization.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ServiceInformation.Serialization.cs new file mode 100644 index 000000000000..9d333fc4db27 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ServiceInformation.Serialization.cs @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ManagedOps.Models +{ + public partial class ServiceInformation : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(ServiceInformation)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(ChangeTrackingAndInventory)) + { + writer.WritePropertyName("changeTrackingAndInventory"u8); + writer.WriteObjectValue(ChangeTrackingAndInventory, options); + } + if (options.Format != "W" && Optional.IsDefined(AzureMonitorInsights)) + { + writer.WritePropertyName("azureMonitorInsights"u8); + writer.WriteObjectValue(AzureMonitorInsights, options); + } + if (options.Format != "W" && Optional.IsDefined(AzureUpdateManager)) + { + writer.WritePropertyName("azureUpdateManager"u8); + writer.WriteObjectValue(AzureUpdateManager, options); + } + if (options.Format != "W" && Optional.IsDefined(AzurePolicyAndMachineConfiguration)) + { + writer.WritePropertyName("azurePolicyAndMachineConfiguration"u8); + writer.WriteObjectValue(AzurePolicyAndMachineConfiguration, options); + } + if (options.Format != "W" && Optional.IsDefined(DefenderForServers)) + { + writer.WritePropertyName("defenderForServers"u8); + writer.WriteObjectValue(DefenderForServers, options); + } + if (options.Format != "W" && Optional.IsDefined(DefenderCspm)) + { + writer.WritePropertyName("defenderCspm"u8); + writer.WriteObjectValue(DefenderCspm, 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 + } + } + } + + ServiceInformation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ServiceInformation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeServiceInformation(document.RootElement, options); + } + + internal static ServiceInformation DeserializeServiceInformation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ChangeTrackingInformation changeTrackingAndInventory = default; + AzureMonitorInformation azureMonitorInsights = default; + UpdateManagerInformation azureUpdateManager = default; + GuestConfigurationInformation azurePolicyAndMachineConfiguration = default; + DefenderForServersInformation defenderForServers = default; + DefenderCspmInformation defenderCspm = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("changeTrackingAndInventory"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + changeTrackingAndInventory = ChangeTrackingInformation.DeserializeChangeTrackingInformation(property.Value, options); + continue; + } + if (property.NameEquals("azureMonitorInsights"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + azureMonitorInsights = AzureMonitorInformation.DeserializeAzureMonitorInformation(property.Value, options); + continue; + } + if (property.NameEquals("azureUpdateManager"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + azureUpdateManager = UpdateManagerInformation.DeserializeUpdateManagerInformation(property.Value, options); + continue; + } + if (property.NameEquals("azurePolicyAndMachineConfiguration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + azurePolicyAndMachineConfiguration = GuestConfigurationInformation.DeserializeGuestConfigurationInformation(property.Value, options); + continue; + } + if (property.NameEquals("defenderForServers"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + defenderForServers = DefenderForServersInformation.DeserializeDefenderForServersInformation(property.Value, options); + continue; + } + if (property.NameEquals("defenderCspm"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + defenderCspm = DefenderCspmInformation.DeserializeDefenderCspmInformation(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ServiceInformation( + changeTrackingAndInventory, + azureMonitorInsights, + azureUpdateManager, + azurePolicyAndMachineConfiguration, + defenderForServers, + defenderCspm, + 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, AzureResourceManagerManagedOpsContext.Default); + default: + throw new FormatException($"The model {nameof(ServiceInformation)} does not support writing '{options.Format}' format."); + } + } + + ServiceInformation IPersistableModel.Create(BinaryData 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 DeserializeServiceInformation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ServiceInformation)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ServiceInformation.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ServiceInformation.cs new file mode 100644 index 000000000000..dbae971578fb --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/ServiceInformation.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ManagedOps.Models +{ + /// Services provisioned by this resource. + public partial class ServiceInformation + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// 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 ServiceInformation() + { + } + + /// Initializes a new instance of . + /// Change Tracking and Inventory service information. + /// Azure Monitor Insights service information. + /// Azure Update Manager service information. + /// Azure Policy and Machine Configuration service information. + /// Defender for Servers service information. + /// Defender for Cloud's Cloud security posture management (CSPM) service information. + /// Keeps track of any properties unknown to the library. + internal ServiceInformation(ChangeTrackingInformation changeTrackingAndInventory, AzureMonitorInformation azureMonitorInsights, UpdateManagerInformation azureUpdateManager, GuestConfigurationInformation azurePolicyAndMachineConfiguration, DefenderForServersInformation defenderForServers, DefenderCspmInformation defenderCspm, IDictionary serializedAdditionalRawData) + { + ChangeTrackingAndInventory = changeTrackingAndInventory; + AzureMonitorInsights = azureMonitorInsights; + AzureUpdateManager = azureUpdateManager; + AzurePolicyAndMachineConfiguration = azurePolicyAndMachineConfiguration; + DefenderForServers = defenderForServers; + DefenderCspm = defenderCspm; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Change Tracking and Inventory service information. + public ChangeTrackingInformation ChangeTrackingAndInventory { get; } + /// Azure Monitor Insights service information. + public AzureMonitorInformation AzureMonitorInsights { get; } + /// Azure Update Manager service information. + internal UpdateManagerInformation AzureUpdateManager { get; } + /// Indicates whether the service is enabled. + public ChangeTrackingInformationEnablementStatus? AzureUpdateManagerEnablementStatus + { + get => AzureUpdateManager?.EnablementStatus; + } + + /// Azure Policy and Machine Configuration service information. + internal GuestConfigurationInformation AzurePolicyAndMachineConfiguration { get; } + /// Indicates whether the service is enabled. + public ChangeTrackingInformationEnablementStatus? AzurePolicyAndMachineEnablementStatus + { + get => AzurePolicyAndMachineConfiguration?.EnablementStatus; + } + + /// Defender for Servers service information. + internal DefenderForServersInformation DefenderForServers { get; } + /// Indicates whether the service is enabled. + public ChangeTrackingInformationEnablementStatus? DefenderForServersEnablementStatus + { + get => DefenderForServers?.EnablementStatus; + } + + /// Defender for Cloud's Cloud security posture management (CSPM) service information. + internal DefenderCspmInformation DefenderCspm { get; } + /// Indicates whether the service is enabled. + public ChangeTrackingInformationEnablementStatus? DefenderCspmEnablementStatus + { + get => DefenderCspm?.EnablementStatus; + } + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/UpdateManagerInformation.Serialization.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/UpdateManagerInformation.Serialization.cs new file mode 100644 index 000000000000..767f0e6f24af --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/UpdateManagerInformation.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ManagedOps.Models +{ + internal partial class UpdateManagerInformation : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(UpdateManagerInformation)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("enablementStatus"u8); + writer.WriteStringValue(EnablementStatus.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 + } + } + } + + UpdateManagerInformation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(UpdateManagerInformation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeUpdateManagerInformation(document.RootElement, options); + } + + internal static UpdateManagerInformation DeserializeUpdateManagerInformation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ChangeTrackingInformationEnablementStatus enablementStatus = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("enablementStatus"u8)) + { + enablementStatus = new ChangeTrackingInformationEnablementStatus(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UpdateManagerInformation(enablementStatus, 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, AzureResourceManagerManagedOpsContext.Default); + default: + throw new FormatException($"The model {nameof(UpdateManagerInformation)} does not support writing '{options.Format}' format."); + } + } + + UpdateManagerInformation IPersistableModel.Create(BinaryData 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 DeserializeUpdateManagerInformation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(UpdateManagerInformation)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/UpdateManagerInformation.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/UpdateManagerInformation.cs new file mode 100644 index 000000000000..9216986762d5 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/Models/UpdateManagerInformation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ManagedOps.Models +{ + /// Azure Update Manager service information. + internal partial class UpdateManagerInformation + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Indicates whether the service is enabled. + internal UpdateManagerInformation(ChangeTrackingInformationEnablementStatus enablementStatus) + { + EnablementStatus = enablementStatus; + } + + /// Initializes a new instance of . + /// Indicates whether the service is enabled. + /// Keeps track of any properties unknown to the library. + internal UpdateManagerInformation(ChangeTrackingInformationEnablementStatus enablementStatus, IDictionary serializedAdditionalRawData) + { + EnablementStatus = enablementStatus; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal UpdateManagerInformation() + { + } + + /// Indicates whether the service is enabled. + public ChangeTrackingInformationEnablementStatus EnablementStatus { get; } + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/ProviderConstants.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/ProviderConstants.cs new file mode 100644 index 000000000000..887c6d2bc55d --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/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.ManagedOps +{ + internal static class ProviderConstants + { + public static string DefaultProviderNamespace { get; } = ClientDiagnostics.GetResourceProviderNamespace(typeof(ProviderConstants).Assembly); + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/RestOperations/ManagedOpsRestOperations.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/RestOperations/ManagedOpsRestOperations.cs new file mode 100644 index 000000000000..a5012bdf0e97 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Generated/RestOperations/ManagedOpsRestOperations.cs @@ -0,0 +1,524 @@ +// 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.ManagedOps.Models; + +namespace Azure.ResourceManager.ManagedOps +{ + internal partial class ManagedOpsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ManagedOpsRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public ManagedOpsRestOperations(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-07-28-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string managedOpsName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.ManagedOps/managedOps/", false); + uri.AppendPath(managedOpsName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string managedOpsName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.ManagedOps/managedOps/", false); + uri.AppendPath(managedOpsName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the information of the ManagedOps instance. + /// The ID of the target subscription. The value must be an UUID. + /// Name of the resource. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string managedOpsName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(managedOpsName, nameof(managedOpsName)); + + using var message = CreateGetRequest(subscriptionId, managedOpsName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedOpData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ManagedOpData.DeserializeManagedOpData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ManagedOpData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the information of the ManagedOps instance. + /// The ID of the target subscription. The value must be an UUID. + /// Name of the resource. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string managedOpsName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(managedOpsName, nameof(managedOpsName)); + + using var message = CreateGetRequest(subscriptionId, managedOpsName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedOpData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ManagedOpData.DeserializeManagedOpData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ManagedOpData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string managedOpsName, ManagedOpData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.ManagedOps/managedOps/", false); + uri.AppendPath(managedOpsName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string managedOpsName, ManagedOpData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.ManagedOps/managedOps/", false); + uri.AppendPath(managedOpsName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates the ManagedOps instance. + /// The ID of the target subscription. The value must be an UUID. + /// Name of the resource. + /// Resource create parameters. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string managedOpsName, ManagedOpData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(managedOpsName, nameof(managedOpsName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, managedOpsName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or updates the ManagedOps instance. + /// The ID of the target subscription. The value must be an UUID. + /// Name of the resource. + /// Resource create parameters. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string managedOpsName, ManagedOpData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(managedOpsName, nameof(managedOpsName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, managedOpsName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListRequestUri(string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.ManagedOps/managedOps", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListRequest(string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.ManagedOps/managedOps", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List all ManagedOps instances in the subscription. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListRequest(subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedOpListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ManagedOpListResult.DeserializeManagedOpListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List all ManagedOps instances in the subscription. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListRequest(subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedOpListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ManagedOpListResult.DeserializeManagedOpListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string managedOpsName, ManagedOpPatch patch) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.ManagedOps/managedOps/", false); + uri.AppendPath(managedOpsName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string managedOpsName, ManagedOpPatch patch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.ManagedOps/managedOps/", false); + uri.AppendPath(managedOpsName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates the ManagedOps instance with the supplied fields. + /// The ID of the target subscription. The value must be an UUID. + /// Name of the resource. + /// The resource properties to be updated. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task UpdateAsync(string subscriptionId, string managedOpsName, ManagedOpPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(managedOpsName, nameof(managedOpsName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, managedOpsName, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates the ManagedOps instance with the supplied fields. + /// The ID of the target subscription. The value must be an UUID. + /// Name of the resource. + /// The resource properties to be updated. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string managedOpsName, ManagedOpPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(managedOpsName, nameof(managedOpsName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, managedOpsName, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string managedOpsName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.ManagedOps/managedOps/", false); + uri.AppendPath(managedOpsName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string managedOpsName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.ManagedOps/managedOps/", false); + uri.AppendPath(managedOpsName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + _userAgent.Apply(message); + return message; + } + + /// Deletes the ManagedOps instance. + /// The ID of the target subscription. The value must be an UUID. + /// Name of the resource. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string managedOpsName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(managedOpsName, nameof(managedOpsName)); + + using var message = CreateDeleteRequest(subscriptionId, managedOpsName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the ManagedOps instance. + /// The ID of the target subscription. The value must be an UUID. + /// Name of the resource. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string managedOpsName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(managedOpsName, nameof(managedOpsName)); + + using var message = CreateDeleteRequest(subscriptionId, managedOpsName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List all ManagedOps instances in the subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedOpListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ManagedOpListResult.DeserializeManagedOpListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List all ManagedOps instances in the subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedOpListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ManagedOpListResult.DeserializeManagedOpListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Properties/AssemblyInfo.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..42895fd00200 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/src/Properties/AssemblyInfo.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Azure.ResourceManager.ManagedOps.Tests, PublicKey = 0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] + +// Replace Microsoft.Test with the correct resource provider namepace for your service and uncomment. +// See https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/azure-services-resource-providers +// for the list of possible values. +[assembly: Azure.Core.AzureResourceProviderNamespace("ManagedOps")] diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/tests/Azure.ResourceManager.ManagedOps.Tests.csproj b/sdk/managedops/Azure.ResourceManager.ManagedOps/tests/Azure.ResourceManager.ManagedOps.Tests.csproj new file mode 100644 index 000000000000..1dfb4f01d1a2 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/tests/Azure.ResourceManager.ManagedOps.Tests.csproj @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/tests/Generated/Samples/Sample_ManagedOpCollection.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/tests/Generated/Samples/Sample_ManagedOpCollection.cs new file mode 100644 index 000000000000..72623479c3c4 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/tests/Generated/Samples/Sample_ManagedOpCollection.cs @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.ManagedOps.Models; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.ManagedOps.Samples +{ + public partial class Sample_ManagedOpCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_ManagedOpsCreateOrUpdate() + { + // Generated from example definition: 2025-07-28-preview/ManagedOps_CreateOrUpdate.json + // this example is just showing the usage of "ManagedOp_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "11809CA1-E126-4017-945E-AA795CD5C5A9"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this ManagedOpResource + ManagedOpCollection collection = subscriptionResource.GetManagedOps(); + + // invoke the operation + string managedOpsName = "default"; + ManagedOpData data = new ManagedOpData + { + Properties = new ManagedOpsProperties(new DesiredConfiguration(new ChangeTrackingConfiguration(new ResourceIdentifier("/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/myResourceGroup/providers/Microsoft.OperationalInsights/workspaces/00000000-0000-0000-0000-000000000000-Default")), new AzureMonitorConfiguration(new ResourceIdentifier("/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/myResourceGroup/providers/Microsoft.Monitor/accounts/example")), new ResourceIdentifier("/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myManagedIdentity"))), + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, managedOpsName, data); + ManagedOpResource 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 + ManagedOpData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_ManagedOpsGet() + { + // Generated from example definition: 2025-07-28-preview/ManagedOps_Get.json + // this example is just showing the usage of "ManagedOp_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "11809CA1-E126-4017-945E-AA795CD5C5A9"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this ManagedOpResource + ManagedOpCollection collection = subscriptionResource.GetManagedOps(); + + // invoke the operation + string managedOpsName = "default"; + ManagedOpResource result = await collection.GetAsync(managedOpsName); + + // 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 + ManagedOpData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_ManagedOpsList() + { + // Generated from example definition: 2025-07-28-preview/ManagedOps_List.json + // this example is just showing the usage of "ManagedOp_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "11809CA1-E126-4017-945E-AA795CD5C5A9"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this ManagedOpResource + ManagedOpCollection collection = subscriptionResource.GetManagedOps(); + + // invoke the operation and iterate over the result + await foreach (ManagedOpResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ManagedOpData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_ManagedOpsGet() + { + // Generated from example definition: 2025-07-28-preview/ManagedOps_Get.json + // this example is just showing the usage of "ManagedOp_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "11809CA1-E126-4017-945E-AA795CD5C5A9"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this ManagedOpResource + ManagedOpCollection collection = subscriptionResource.GetManagedOps(); + + // invoke the operation + string managedOpsName = "default"; + bool result = await collection.ExistsAsync(managedOpsName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_ManagedOpsGet() + { + // Generated from example definition: 2025-07-28-preview/ManagedOps_Get.json + // this example is just showing the usage of "ManagedOp_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "11809CA1-E126-4017-945E-AA795CD5C5A9"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this ManagedOpResource + ManagedOpCollection collection = subscriptionResource.GetManagedOps(); + + // invoke the operation + string managedOpsName = "default"; + NullableResponse response = await collection.GetIfExistsAsync(managedOpsName); + ManagedOpResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine("Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ManagedOpData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/tests/Generated/Samples/Sample_ManagedOpResource.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/tests/Generated/Samples/Sample_ManagedOpResource.cs new file mode 100644 index 000000000000..3d4be0bdd889 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/tests/Generated/Samples/Sample_ManagedOpResource.cs @@ -0,0 +1,104 @@ +// 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.ManagedOps.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.ManagedOps.Samples +{ + public partial class Sample_ManagedOpResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_ManagedOpsGet() + { + // Generated from example definition: 2025-07-28-preview/ManagedOps_Get.json + // this example is just showing the usage of "ManagedOp_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ManagedOpResource created on azure + // for more information of creating ManagedOpResource, please refer to the document of ManagedOpResource + string subscriptionId = "11809CA1-E126-4017-945E-AA795CD5C5A9"; + string managedOpsName = "default"; + ResourceIdentifier managedOpResourceId = ManagedOpResource.CreateResourceIdentifier(subscriptionId, managedOpsName); + ManagedOpResource managedOp = client.GetManagedOpResource(managedOpResourceId); + + // invoke the operation + ManagedOpResource result = await managedOp.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ManagedOpData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Delete_ManagedOpsDelete() + { + // Generated from example definition: 2025-07-28-preview/ManagedOps_Delete.json + // this example is just showing the usage of "ManagedOp_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ManagedOpResource created on azure + // for more information of creating ManagedOpResource, please refer to the document of ManagedOpResource + string subscriptionId = "11809CA1-E126-4017-945E-AA795CD5C5A9"; + string managedOpsName = "default"; + ResourceIdentifier managedOpResourceId = ManagedOpResource.CreateResourceIdentifier(subscriptionId, managedOpsName); + ManagedOpResource managedOp = client.GetManagedOpResource(managedOpResourceId); + + // invoke the operation + await managedOp.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_ManagedOpsUpdate() + { + // Generated from example definition: 2025-07-28-preview/ManagedOps_Update.json + // this example is just showing the usage of "ManagedOp_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ManagedOpResource created on azure + // for more information of creating ManagedOpResource, please refer to the document of ManagedOpResource + string subscriptionId = "11809CA1-E126-4017-945E-AA795CD5C5A9"; + string managedOpsName = "default"; + ResourceIdentifier managedOpResourceId = ManagedOpResource.CreateResourceIdentifier(subscriptionId, managedOpsName); + ManagedOpResource managedOp = client.GetManagedOpResource(managedOpResourceId); + + // invoke the operation + ManagedOpPatch patch = new ManagedOpPatch(); + ArmOperation lro = await managedOp.UpdateAsync(WaitUntil.Completed, patch); + ManagedOpResource 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 + ManagedOpData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/tests/ManagedOpsManagementTestBase.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/tests/ManagedOpsManagementTestBase.cs new file mode 100644 index 000000000000..8e5c0a692a9d --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/tests/ManagedOpsManagementTestBase.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure; +using Azure.Core; +using Azure.Core.TestFramework; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.TestFramework; +using NUnit.Framework; +using System.Threading.Tasks; + +namespace Azure.ResourceManager.ManagedOps.Tests +{ + public class ManagedOpsManagementTestBase : ManagementRecordedTestBase + { + protected ArmClient Client { get; private set; } + protected SubscriptionResource DefaultSubscription { get; private set; } + + protected ManagedOpsManagementTestBase(bool isAsync, RecordedTestMode mode) + : base(isAsync, mode) + { + } + + protected ManagedOpsManagementTestBase(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/managedops/Azure.ResourceManager.ManagedOps/tests/ManagedOpsManagementTestEnvironment.cs b/sdk/managedops/Azure.ResourceManager.ManagedOps/tests/ManagedOpsManagementTestEnvironment.cs new file mode 100644 index 000000000000..1ef829816cd6 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/tests/ManagedOpsManagementTestEnvironment.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core.TestFramework; + +namespace Azure.ResourceManager.ManagedOps.Tests +{ + public class ManagedOpsManagementTestEnvironment : TestEnvironment + { + } +} diff --git a/sdk/managedops/Azure.ResourceManager.ManagedOps/tsp-location.yaml b/sdk/managedops/Azure.ResourceManager.ManagedOps/tsp-location.yaml new file mode 100644 index 000000000000..58950f5b4ab6 --- /dev/null +++ b/sdk/managedops/Azure.ResourceManager.ManagedOps/tsp-location.yaml @@ -0,0 +1,6 @@ +directory: specification/managedoperations/ManagedOps.Management +commit: 83408dfe4894a9b5a5d3989023647bce792efc5f +repo: Azure/azure-rest-api-specs +additionalDirectories: + +emitterPackageJsonPath: eng/legacy-emitter-package.json \ No newline at end of file diff --git a/sdk/managedops/ci.yml b/sdk/managedops/ci.yml new file mode 100644 index 000000000000..666223b3d2fc --- /dev/null +++ b/sdk/managedops/ci.yml @@ -0,0 +1,35 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/managedops + - sdk/managedops/ci.yml + - sdk/managedops/Azure.ResourceManager.ManagedOps + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/managedops + - sdk/managedops/ci.yml + - sdk/managedops/Azure.ResourceManager.ManagedOps + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: managedops + ArtifactName: packages + Artifacts: + - name: Azure.ResourceManager.ManagedOps + safeName: AzureResourceManagerManagedOps