From a5177ae6f44512ad6d5bd5d6e3fe8e9f3d44c6cd Mon Sep 17 00:00:00 2001 From: almasak <162407742+almasak@users.noreply.github.com> Date: Wed, 13 Nov 2024 23:54:13 +0530 Subject: [PATCH 1/5] NeonPostgres .NET SDK * Initial Commit --- .github/CODEOWNERS | 6 + .../Azure.ResourceManager.NeonPostgres.sln | 65 ++ .../CHANGELOG.md | 19 + .../Directory.Build.props | 6 + .../README.md | 84 ++ .../assets.json | 6 + ...esourceManager.NeonPostgres.Samples.csproj | 10 + .../Azure.ResourceManager.NeonPostgres.csproj | 8 + .../Generated/ArmNeonPostgresModelFactory.cs | 61 ++ .../MockableNeonPostgresArmClient.cs | 49 ++ ...ckableNeonPostgresResourceGroupResource.cs | 105 +++ ...ockableNeonPostgresSubscriptionResource.cs | 102 +++ .../Extensions/NeonPostgresExtensions.cs | 219 ++++++ .../src/Generated/Internal/Argument.cs | 129 ++++ .../Internal/ChangeTrackingDictionary.cs | 167 ++++ .../Generated/Internal/ChangeTrackingList.cs | 153 ++++ .../Internal/ModelSerializationExtensions.cs | 398 ++++++++++ .../src/Generated/Internal/Optional.cs | 51 ++ .../Internal/Utf8JsonRequestContent.cs | 55 ++ .../NeonOrganizationOperationSource.cs | 38 + .../NeonPostgresArmOperation.cs | 94 +++ .../NeonPostgresArmOperationOfT.cs | 100 +++ .../Models/MarketplaceSubscriptionStatus.cs | 57 ++ .../NeonCompanyDetails.Serialization.cs | 195 +++++ .../Generated/Models/NeonCompanyDetails.cs | 85 ++ .../NeonMarketplaceDetails.Serialization.cs | 152 ++++ .../Models/NeonMarketplaceDetails.cs | 83 ++ .../Models/NeonOfferDetails.Serialization.cs | 182 +++++ .../src/Generated/Models/NeonOfferDetails.cs | 101 +++ ...NeonOrganizationPropertes.Serialization.cs | 178 +++++ .../Models/NeonOrganizationPropertes.cs | 97 +++ .../Models/NeonResourceProvisioningState.cs | 54 ++ ...eonSingleSignOnProperties.Serialization.cs | 180 +++++ .../Models/NeonSingleSignOnProperties.cs | 78 ++ .../Generated/Models/NeonSingleSignOnState.cs | 54 ++ .../Models/NeonUserDetails.Serialization.cs | 179 +++++ .../src/Generated/Models/NeonUserDetails.cs | 81 ++ ...izationResourceListResult.Serialization.cs | 151 ++++ .../Models/OrganizationResourceListResult.cs | 80 ++ ...nerOrganizationProperties.Serialization.cs | 152 ++++ .../Models/PartnerOrganizationProperties.cs | 83 ++ .../Generated/NeonOrganizationCollection.cs | 494 ++++++++++++ .../NeonOrganizationData.Serialization.cs | 178 +++++ .../src/Generated/NeonOrganizationData.cs | 83 ++ .../NeonOrganizationResource.Serialization.cs | 26 + .../src/Generated/NeonOrganizationResource.cs | 706 +++++++++++++++++ .../src/Generated/ProviderConstants.cs | 16 + .../OrganizationsRestOperations.cs | 723 ++++++++++++++++++ .../src/Properties/AssemblyInfo.cs | 9 + ....ResourceManager.NeonPostgres.Tests.csproj | 5 + .../tests/NeonPostgresManagementTestBase.cs | 43 ++ .../NeonPostgresManagementTestEnvironment.cs | 11 + .../tsp-location.yaml | 3 + sdk/neonpostgres/ci.mgmt.yml | 24 + 54 files changed, 6468 insertions(+) create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/Azure.ResourceManager.NeonPostgres.sln create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/CHANGELOG.md create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/Directory.Build.props create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/README.md create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/assets.json create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/samples/Azure.ResourceManager.NeonPostgres.Samples.csproj create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Azure.ResourceManager.NeonPostgres.csproj create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/ArmNeonPostgresModelFactory.cs create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Extensions/MockableNeonPostgresArmClient.cs create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Extensions/MockableNeonPostgresResourceGroupResource.cs create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Extensions/MockableNeonPostgresSubscriptionResource.cs create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Extensions/NeonPostgresExtensions.cs create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Internal/Argument.cs create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Internal/ChangeTrackingDictionary.cs create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Internal/ChangeTrackingList.cs create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Internal/ModelSerializationExtensions.cs create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Internal/Optional.cs create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Internal/Utf8JsonRequestContent.cs create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/LongRunningOperation/NeonOrganizationOperationSource.cs create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/LongRunningOperation/NeonPostgresArmOperation.cs create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/LongRunningOperation/NeonPostgresArmOperationOfT.cs create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/MarketplaceSubscriptionStatus.cs create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonCompanyDetails.Serialization.cs create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonCompanyDetails.cs create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonMarketplaceDetails.Serialization.cs create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonMarketplaceDetails.cs create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonOfferDetails.Serialization.cs create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonOfferDetails.cs create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonOrganizationPropertes.Serialization.cs create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonOrganizationPropertes.cs create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonResourceProvisioningState.cs create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonSingleSignOnProperties.Serialization.cs create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonSingleSignOnProperties.cs create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonSingleSignOnState.cs create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonUserDetails.Serialization.cs create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonUserDetails.cs create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/OrganizationResourceListResult.Serialization.cs create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/OrganizationResourceListResult.cs create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/PartnerOrganizationProperties.Serialization.cs create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/PartnerOrganizationProperties.cs create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/NeonOrganizationCollection.cs create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/NeonOrganizationData.Serialization.cs create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/NeonOrganizationData.cs create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/NeonOrganizationResource.Serialization.cs create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/NeonOrganizationResource.cs create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/ProviderConstants.cs create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/RestOperations/OrganizationsRestOperations.cs create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Properties/AssemblyInfo.cs create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/tests/Azure.ResourceManager.NeonPostgres.Tests.csproj create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/tests/NeonPostgresManagementTestBase.cs create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/tests/NeonPostgresManagementTestEnvironment.cs create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/tsp-location.yaml create mode 100644 sdk/neonpostgres/ci.mgmt.yml diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index a0f851f68e0b..c512fc42e011 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1003,6 +1003,12 @@ # ServiceLabel: %Large Instance %Mgmt # ServiceOwners: @8Gitbrix +# PRLabel: %Neon Postgres +/sdk/neonpostgres/Azure.ResourceManager.*/ @almasak + +# ServiceLabel: %Neon Postgres %Mgmt +# ServiceOwners: @almasak + # PRLabel: %Network - CDN /sdk/cdn/Azure.ResourceManager.*/ @ptnan7 diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/Azure.ResourceManager.NeonPostgres.sln b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/Azure.ResourceManager.NeonPostgres.sln new file mode 100644 index 000000000000..e023f7cc3093 --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/Azure.ResourceManager.NeonPostgres.sln @@ -0,0 +1,65 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30309.148 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{B572BAAD-0D4F-4AD9-8B3A-505A171C7A37}") = "Azure.ResourceManager.NeonPostgres", "src\Azure.ResourceManager.NeonPostgres.csproj", "{82F01D64-CB06-4F3A-ADE3-F0A1B82EF068}" +EndProject +Project("{B572BAAD-0D4F-4AD9-8B3A-505A171C7A37}") = "Azure.ResourceManager.NeonPostgres.Tests", "tests\Azure.ResourceManager.NeonPostgres.Tests.csproj", "{307BCD2D-A761-4156-8284-B821130D18D1}" +EndProject +Project("{B572BAAD-0D4F-4AD9-8B3A-505A171C7A37}") = "Azure.ResourceManager.NeonPostgres.Samples", "samples\Azure.ResourceManager.NeonPostgres.Samples.csproj", "{2F3CC342-8ECE-4C5F-B3E8-EA7E157ED20F}" +EndProject +Global + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {9E3460F6-1887-4CE9-BCF8-C22E1D6DB9A6} + EndGlobalSection + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {82F01D64-CB06-4F3A-ADE3-F0A1B82EF068}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {82F01D64-CB06-4F3A-ADE3-F0A1B82EF068}.Debug|Any CPU.Build.0 = Debug|Any CPU + {82F01D64-CB06-4F3A-ADE3-F0A1B82EF068}.Debug|x64.ActiveCfg = Debug|Any CPU + {82F01D64-CB06-4F3A-ADE3-F0A1B82EF068}.Debug|x64.Build.0 = Debug|Any CPU + {82F01D64-CB06-4F3A-ADE3-F0A1B82EF068}.Debug|x86.ActiveCfg = Debug|Any CPU + {82F01D64-CB06-4F3A-ADE3-F0A1B82EF068}.Debug|x86.Build.0 = Debug|Any CPU + {82F01D64-CB06-4F3A-ADE3-F0A1B82EF068}.Release|Any CPU.ActiveCfg = Release|Any CPU + {82F01D64-CB06-4F3A-ADE3-F0A1B82EF068}.Release|Any CPU.Build.0 = Release|Any CPU + {82F01D64-CB06-4F3A-ADE3-F0A1B82EF068}.Release|x64.ActiveCfg = Release|Any CPU + {82F01D64-CB06-4F3A-ADE3-F0A1B82EF068}.Release|x64.Build.0 = Release|Any CPU + {82F01D64-CB06-4F3A-ADE3-F0A1B82EF068}.Release|x86.ActiveCfg = Release|Any CPU + {82F01D64-CB06-4F3A-ADE3-F0A1B82EF068}.Release|x86.Build.0 = Release|Any CPU + {307BCD2D-A761-4156-8284-B821130D18D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {307BCD2D-A761-4156-8284-B821130D18D1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {307BCD2D-A761-4156-8284-B821130D18D1}.Debug|x64.ActiveCfg = Debug|Any CPU + {307BCD2D-A761-4156-8284-B821130D18D1}.Debug|x64.Build.0 = Debug|Any CPU + {307BCD2D-A761-4156-8284-B821130D18D1}.Debug|x86.ActiveCfg = Debug|Any CPU + {307BCD2D-A761-4156-8284-B821130D18D1}.Debug|x86.Build.0 = Debug|Any CPU + {307BCD2D-A761-4156-8284-B821130D18D1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {307BCD2D-A761-4156-8284-B821130D18D1}.Release|Any CPU.Build.0 = Release|Any CPU + {307BCD2D-A761-4156-8284-B821130D18D1}.Release|x64.ActiveCfg = Release|Any CPU + {307BCD2D-A761-4156-8284-B821130D18D1}.Release|x64.Build.0 = Release|Any CPU + {307BCD2D-A761-4156-8284-B821130D18D1}.Release|x86.ActiveCfg = Release|Any CPU + {307BCD2D-A761-4156-8284-B821130D18D1}.Release|x86.Build.0 = Release|Any CPU + {2F3CC342-8ECE-4C5F-B3E8-EA7E157ED20F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2F3CC342-8ECE-4C5F-B3E8-EA7E157ED20F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2F3CC342-8ECE-4C5F-B3E8-EA7E157ED20F}.Debug|x64.ActiveCfg = Debug|Any CPU + {2F3CC342-8ECE-4C5F-B3E8-EA7E157ED20F}.Debug|x64.Build.0 = Debug|Any CPU + {2F3CC342-8ECE-4C5F-B3E8-EA7E157ED20F}.Debug|x86.ActiveCfg = Debug|Any CPU + {2F3CC342-8ECE-4C5F-B3E8-EA7E157ED20F}.Debug|x86.Build.0 = Debug|Any CPU + {2F3CC342-8ECE-4C5F-B3E8-EA7E157ED20F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2F3CC342-8ECE-4C5F-B3E8-EA7E157ED20F}.Release|Any CPU.Build.0 = Release|Any CPU + {2F3CC342-8ECE-4C5F-B3E8-EA7E157ED20F}.Release|x64.ActiveCfg = Release|Any CPU + {2F3CC342-8ECE-4C5F-B3E8-EA7E157ED20F}.Release|x64.Build.0 = Release|Any CPU + {2F3CC342-8ECE-4C5F-B3E8-EA7E157ED20F}.Release|x86.ActiveCfg = Release|Any CPU + {2F3CC342-8ECE-4C5F-B3E8-EA7E157ED20F}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/CHANGELOG.md b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/CHANGELOG.md new file mode 100644 index 000000000000..9fb488d738c8 --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/CHANGELOG.md @@ -0,0 +1,19 @@ +# Release History + +## 1.0.0-beta.1 (2024-11-22) + + + +### Features Added + +This package follows the [new Azure SDK guidelines](https://azure.github.io/azure-sdk/general_introduction.html), and provides many core capabilities: + + - Support MSAL.NET, Azure.Identity is out of box for supporting MSAL.NET. + - Support [OpenTelemetry](https://opentelemetry.io/) for distributed tracing. + - HTTP pipeline with custom policies. + - Better error-handling. + - Support uniform telemetry across all languages. + +This package is a Public Preview version, so expect incompatible changes in subsequent releases as we improve the product. To provide feedback, submit an issue in our [Azure SDK for .NET GitHub repo](https://github.com/Azure/azure-sdk-for-net/issues). + +> NOTE: For more information about unified authentication, please refer to [Microsoft Azure Identity documentation for .NET](https://docs.microsoft.com//dotnet/api/overview/azure/identity-readme?view=azure-dotnet). diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/Directory.Build.props b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/Directory.Build.props new file mode 100644 index 000000000000..1a9611bd4924 --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/Directory.Build.props @@ -0,0 +1,6 @@ + + + + diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/README.md b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/README.md new file mode 100644 index 000000000000..9dc2f33b462f --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/README.md @@ -0,0 +1,84 @@ +# Microsoft Azure NeonPostgres management client library for .NET + +Neon is a modern Postgres database service that takes the world’s most-loved database and delivers it as a serverless platform designed to optimize both performance and cost. It eliminates the need for manual server resizing by offering compute and storage autoscaling, including scale-to-zero for inactive databases to save costs. Additionally, Neon supports database branching, enabling iterative CI/CD workflows and instant point-in-time recovery. + +Efficient autoscaling for Postgres. Neon’s autoscaling adjusts resources dynamically based on actual usage, boosting performance during traffic spikes. +Faster developer workflows. Via database branching, developers can instantly create database copies for testing, feature development, and schema migrations. +Perfect for AI apps and agents. With pgvector for vector embeddings, serverless speed for agentic infrastructure, and optimal price performance due to scale-to-zero. + +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 NeonPostgres management library for .NET with [NuGet](https://www.nuget.org/): + +```dotnetcli +dotnet add package Azure.ResourceManager.NeonPostgres --prerelease +``` + +### Prerequisites + +* You must have an [Microsoft Azure subscription](https://azure.microsoft.com/free/dotnet/). + +### Authenticate the Client + +To create an authenticated client and start interacting with Microsoft Azure resources, see the [quickstart guide here](https://github.com/Azure/azure-sdk-for-net/blob/main/doc/dev/mgmt_quickstart.md). + +## Key concepts + +Key concepts of the Microsoft Azure SDK for .NET can be found [here](https://azure.github.io/azure-sdk/dotnet_introduction.html) + +## Documentation + +Documentation is available to help you learn how to use this package: + +- [Quickstart](https://github.com/Azure/azure-sdk-for-net/blob/main/doc/dev/mgmt_quickstart.md). +- [API References](https://docs.microsoft.com/dotnet/api/?view=azure-dotnet). +- [Authentication](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/identity/Azure.Identity/README.md). + +## Examples + +Code samples for using the management library for .NET can be found in the following locations +- [.NET Management Library Code Samples](https://aka.ms/azuresdk-net-mgmt-samples) + +## Troubleshooting + +- File an issue via [GitHub Issues](https://github.com/Azure/azure-sdk-for-net/issues). +- Check [previous questions](https://stackoverflow.com/questions/tagged/azure+.net) or ask new ones on Stack Overflow using Azure and .NET tags. + +## Next steps + +For more information about Microsoft Azure SDK, see [this website](https://azure.github.io/azure-sdk/). + +## Contributing + +For details on contributing to this repository, see the [contributing +guide][cg]. + +This project welcomes contributions and suggestions. Most contributions +require you to agree to a Contributor License Agreement (CLA) declaring +that you have the right to, and actually do, grant us the rights to use +your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine +whether you need to provide a CLA and decorate the PR appropriately +(for example, label, comment). Follow the instructions provided by the +bot. You'll only need to do this action once across all repositories +using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For +more information, see the [Code of Conduct FAQ][coc_faq] or contact + with any other questions or comments. + + +[cg]: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/resourcemanager/Azure.ResourceManager/docs/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/assets.json b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/assets.json new file mode 100644 index 000000000000..746a60d8a4f1 --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/assets.json @@ -0,0 +1,6 @@ +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "net", + "TagPrefix": "net/neonpostgres/Azure.ResourceManager.NeonPostgres", + "Tag": "" +} diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/samples/Azure.ResourceManager.NeonPostgres.Samples.csproj b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/samples/Azure.ResourceManager.NeonPostgres.Samples.csproj new file mode 100644 index 000000000000..2572bae02b16 --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/samples/Azure.ResourceManager.NeonPostgres.Samples.csproj @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Azure.ResourceManager.NeonPostgres.csproj b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Azure.ResourceManager.NeonPostgres.csproj new file mode 100644 index 000000000000..0ed45a5c8181 --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Azure.ResourceManager.NeonPostgres.csproj @@ -0,0 +1,8 @@ + + + 1.0.0-beta.1 + Azure.ResourceManager.NeonPostgres + Azure Resource Manager client SDK for Azure resource provider NeonPostgres. + azure;management;arm;resource manager;neonpostgres + + diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/ArmNeonPostgresModelFactory.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/ArmNeonPostgresModelFactory.cs new file mode 100644 index 000000000000..2f104ec08d05 --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/ArmNeonPostgresModelFactory.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.NeonPostgres.Models +{ + /// Model factory for models. + public static partial class ArmNeonPostgresModelFactory + { + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static NeonOrganizationData NeonOrganizationData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, NeonOrganizationPropertes properties = null) + { + tags ??= new Dictionary(); + + return new NeonOrganizationData( + id, + name, + resourceType, + systemData, + tags, + location, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Marketplace details of the resource. + /// Details of the user. + /// Details of the company. + /// Provisioning state of the resource. + /// Organization properties. + /// A new instance for mocking. + public static NeonOrganizationPropertes NeonOrganizationPropertes(NeonMarketplaceDetails marketplaceDetails = null, NeonUserDetails userDetails = null, NeonCompanyDetails companyDetails = null, NeonResourceProvisioningState? provisioningState = null, PartnerOrganizationProperties partnerOrganizationProperties = null) + { + return new NeonOrganizationPropertes( + marketplaceDetails, + userDetails, + companyDetails, + provisioningState, + partnerOrganizationProperties, + serializedAdditionalRawData: null); + } + } +} diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Extensions/MockableNeonPostgresArmClient.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Extensions/MockableNeonPostgresArmClient.cs new file mode 100644 index 000000000000..5a92c8fc6b3a --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Extensions/MockableNeonPostgresArmClient.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.NeonPostgres.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableNeonPostgresArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableNeonPostgresArmClient() + { + } + + /// 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 MockableNeonPostgresArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableNeonPostgresArmClient(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 NeonOrganizationResource GetNeonOrganizationResource(ResourceIdentifier id) + { + NeonOrganizationResource.ValidateResourceId(id); + return new NeonOrganizationResource(Client, id); + } + } +} diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Extensions/MockableNeonPostgresResourceGroupResource.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Extensions/MockableNeonPostgresResourceGroupResource.cs new file mode 100644 index 000000000000..54b0de3692f3 --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Extensions/MockableNeonPostgresResourceGroupResource.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.NeonPostgres.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableNeonPostgresResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableNeonPostgresResourceGroupResource() + { + } + + /// 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 MockableNeonPostgresResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of NeonOrganizationResources in the ResourceGroupResource. + /// An object representing collection of NeonOrganizationResources and their operations over a NeonOrganizationResource. + public virtual NeonOrganizationCollection GetNeonOrganizations() + { + return GetCachedClient(client => new NeonOrganizationCollection(client, Id)); + } + + /// + /// Get a OrganizationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName} + /// + /// + /// Operation Id + /// OrganizationResource_Get + /// + /// + /// Default Api Version + /// 2024-08-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the Neon Organizations resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetNeonOrganizationAsync(string organizationName, CancellationToken cancellationToken = default) + { + return await GetNeonOrganizations().GetAsync(organizationName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a OrganizationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName} + /// + /// + /// Operation Id + /// OrganizationResource_Get + /// + /// + /// Default Api Version + /// 2024-08-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the Neon Organizations resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetNeonOrganization(string organizationName, CancellationToken cancellationToken = default) + { + return GetNeonOrganizations().Get(organizationName, cancellationToken); + } + } +} diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Extensions/MockableNeonPostgresSubscriptionResource.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Extensions/MockableNeonPostgresSubscriptionResource.cs new file mode 100644 index 000000000000..abc57a2d6f31 --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Extensions/MockableNeonPostgresSubscriptionResource.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.NeonPostgres.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableNeonPostgresSubscriptionResource : ArmResource + { + private ClientDiagnostics _neonOrganizationOrganizationsClientDiagnostics; + private OrganizationsRestOperations _neonOrganizationOrganizationsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableNeonPostgresSubscriptionResource() + { + } + + /// 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 MockableNeonPostgresSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics NeonOrganizationOrganizationsClientDiagnostics => _neonOrganizationOrganizationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.NeonPostgres", NeonOrganizationResource.ResourceType.Namespace, Diagnostics); + private OrganizationsRestOperations NeonOrganizationOrganizationsRestClient => _neonOrganizationOrganizationsRestClient ??= new OrganizationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(NeonOrganizationResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List OrganizationResource resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Neon.Postgres/organizations + /// + /// + /// Operation Id + /// OrganizationResource_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-08-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetNeonOrganizationsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NeonOrganizationOrganizationsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NeonOrganizationOrganizationsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NeonOrganizationResource(Client, NeonOrganizationData.DeserializeNeonOrganizationData(e)), NeonOrganizationOrganizationsClientDiagnostics, Pipeline, "MockableNeonPostgresSubscriptionResource.GetNeonOrganizations", "value", "nextLink", cancellationToken); + } + + /// + /// List OrganizationResource resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Neon.Postgres/organizations + /// + /// + /// Operation Id + /// OrganizationResource_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-08-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetNeonOrganizations(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => NeonOrganizationOrganizationsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => NeonOrganizationOrganizationsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NeonOrganizationResource(Client, NeonOrganizationData.DeserializeNeonOrganizationData(e)), NeonOrganizationOrganizationsClientDiagnostics, Pipeline, "MockableNeonPostgresSubscriptionResource.GetNeonOrganizations", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Extensions/NeonPostgresExtensions.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Extensions/NeonPostgresExtensions.cs new file mode 100644 index 000000000000..9037e7c839eb --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Extensions/NeonPostgresExtensions.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.ResourceManager.NeonPostgres.Mocking; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.NeonPostgres +{ + /// A class to add extension methods to Azure.ResourceManager.NeonPostgres. + public static partial class NeonPostgresExtensions + { + private static MockableNeonPostgresArmClient GetMockableNeonPostgresArmClient(ArmClient client) + { + return client.GetCachedClient(client0 => new MockableNeonPostgresArmClient(client0)); + } + + private static MockableNeonPostgresResourceGroupResource GetMockableNeonPostgresResourceGroupResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableNeonPostgresResourceGroupResource(client, resource.Id)); + } + + private static MockableNeonPostgresSubscriptionResource GetMockableNeonPostgresSubscriptionResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableNeonPostgresSubscriptionResource(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 NeonOrganizationResource GetNeonOrganizationResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableNeonPostgresArmClient(client).GetNeonOrganizationResource(id); + } + + /// + /// Gets a collection of NeonOrganizationResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// is null. + /// An object representing collection of NeonOrganizationResources and their operations over a NeonOrganizationResource. + public static NeonOrganizationCollection GetNeonOrganizations(this ResourceGroupResource resourceGroupResource) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableNeonPostgresResourceGroupResource(resourceGroupResource).GetNeonOrganizations(); + } + + /// + /// Get a OrganizationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName} + /// + /// + /// Operation Id + /// OrganizationResource_Get + /// + /// + /// Default Api Version + /// 2024-08-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Name of the Neon Organizations 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> GetNeonOrganizationAsync(this ResourceGroupResource resourceGroupResource, string organizationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return await GetMockableNeonPostgresResourceGroupResource(resourceGroupResource).GetNeonOrganizationAsync(organizationName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a OrganizationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName} + /// + /// + /// Operation Id + /// OrganizationResource_Get + /// + /// + /// Default Api Version + /// 2024-08-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Name of the Neon Organizations resource. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetNeonOrganization(this ResourceGroupResource resourceGroupResource, string organizationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableNeonPostgresResourceGroupResource(resourceGroupResource).GetNeonOrganization(organizationName, cancellationToken); + } + + /// + /// List OrganizationResource resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Neon.Postgres/organizations + /// + /// + /// Operation Id + /// OrganizationResource_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-08-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetNeonOrganizationsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableNeonPostgresSubscriptionResource(subscriptionResource).GetNeonOrganizationsAsync(cancellationToken); + } + + /// + /// List OrganizationResource resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Neon.Postgres/organizations + /// + /// + /// Operation Id + /// OrganizationResource_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-08-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetNeonOrganizations(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableNeonPostgresSubscriptionResource(subscriptionResource).GetNeonOrganizations(cancellationToken); + } + } +} diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Internal/Argument.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Internal/Argument.cs new file mode 100644 index 000000000000..606ae902a9c6 --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/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.NeonPostgres +{ + 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/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Internal/ChangeTrackingDictionary.cs new file mode 100644 index 000000000000..8ba9395be5bb --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/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.NeonPostgres +{ + 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/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Internal/ChangeTrackingList.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Internal/ChangeTrackingList.cs new file mode 100644 index 000000000000..7460c1da0ba8 --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/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.NeonPostgres +{ + 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/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Internal/ModelSerializationExtensions.cs new file mode 100644 index 000000000000..aafb973a8389 --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Internal/ModelSerializationExtensions.cs @@ -0,0 +1,398 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; +using System.Text.Json; +using System.Xml; +using Azure.Core; + +namespace Azure.ResourceManager.NeonPostgres +{ + internal static class ModelSerializationExtensions + { + internal static readonly ModelReaderWriterOptions WireOptions = new ModelReaderWriterOptions("W"); + + public static object GetObject(this JsonElement element) + { + switch (element.ValueKind) + { + case JsonValueKind.String: + return element.GetString(); + case JsonValueKind.Number: + if (element.TryGetInt32(out int intValue)) + { + return intValue; + } + if (element.TryGetInt64(out long longValue)) + { + return longValue; + } + return element.GetDouble(); + case JsonValueKind.True: + return true; + case JsonValueKind.False: + return false; + case JsonValueKind.Undefined: + case JsonValueKind.Null: + return null; + case JsonValueKind.Object: + var dictionary = new Dictionary(); + foreach (var jsonProperty in element.EnumerateObject()) + { + dictionary.Add(jsonProperty.Name, jsonProperty.Value.GetObject()); + } + return dictionary; + case JsonValueKind.Array: + var list = new List(); + foreach (var item in element.EnumerateArray()) + { + list.Add(item.GetObject()); + } + return list.ToArray(); + default: + throw new NotSupportedException($"Not supported value kind {element.ValueKind}"); + } + } + + public static byte[] GetBytesFromBase64(this JsonElement element, string format) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + + return format switch + { + "U" => TypeFormatters.FromBase64UrlString(element.GetRequiredString()), + "D" => element.GetBytesFromBase64(), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + } + + public static DateTimeOffset GetDateTimeOffset(this JsonElement element, string format) => format switch + { + "U" when element.ValueKind == JsonValueKind.Number => DateTimeOffset.FromUnixTimeSeconds(element.GetInt64()), + _ => TypeFormatters.ParseDateTimeOffset(element.GetString(), format) + }; + + public static TimeSpan GetTimeSpan(this JsonElement element, string format) => TypeFormatters.ParseTimeSpan(element.GetString(), format); + + public static char GetChar(this JsonElement element) + { + if (element.ValueKind == JsonValueKind.String) + { + var text = element.GetString(); + if (text == null || text.Length != 1) + { + throw new NotSupportedException($"Cannot convert \"{text}\" to a char"); + } + return text[0]; + } + else + { + throw new NotSupportedException($"Cannot convert {element.ValueKind} to a char"); + } + } + + [Conditional("DEBUG")] + public static void ThrowNonNullablePropertyIsNull(this JsonProperty property) + { + throw new JsonException($"A property '{property.Name}' defined as non-nullable but received as null from the service. This exception only happens in DEBUG builds of the library and would be ignored in the release build"); + } + + public static string GetRequiredString(this JsonElement element) + { + var value = element.GetString(); + if (value == null) + { + throw new InvalidOperationException($"The requested operation requires an element of type 'String', but the target element has type '{element.ValueKind}'."); + } + return value; + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTime value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, TimeSpan value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, char value) + { + writer.WriteStringValue(value.ToString(CultureInfo.InvariantCulture)); + } + + public static void WriteBase64StringValue(this Utf8JsonWriter writer, byte[] value, string format) + { + if (value == null) + { + writer.WriteNullValue(); + return; + } + switch (format) + { + case "U": + writer.WriteStringValue(TypeFormatters.ToBase64UrlString(value)); + break; + case "D": + writer.WriteBase64StringValue(value); + break; + default: + throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)); + } + } + + public static void WriteNumberValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + if (format != "U") + { + throw new ArgumentOutOfRangeException(nameof(format), "Only 'U' format is supported when writing a DateTimeOffset as a Number."); + } + writer.WriteNumberValue(value.ToUnixTimeSeconds()); + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, T value, ModelReaderWriterOptions options = null) + { + switch (value) + { + case null: + writer.WriteNullValue(); + break; + case IJsonModel jsonModel: + jsonModel.Write(writer, options ?? WireOptions); + break; + case IUtf8JsonSerializable serializable: + serializable.Write(writer); + break; + case byte[] bytes: + writer.WriteBase64StringValue(bytes); + break; + case BinaryData bytes0: + writer.WriteBase64StringValue(bytes0); + break; + case JsonElement json: + json.WriteTo(writer); + break; + case int i: + writer.WriteNumberValue(i); + break; + case decimal d: + writer.WriteNumberValue(d); + break; + case double d0: + if (double.IsNaN(d0)) + { + writer.WriteStringValue("NaN"); + } + else + { + writer.WriteNumberValue(d0); + } + break; + case float f: + writer.WriteNumberValue(f); + break; + case long l: + writer.WriteNumberValue(l); + break; + case string s: + writer.WriteStringValue(s); + break; + case bool b: + writer.WriteBooleanValue(b); + break; + case Guid g: + writer.WriteStringValue(g); + break; + case DateTimeOffset dateTimeOffset: + writer.WriteStringValue(dateTimeOffset, "O"); + break; + case DateTime dateTime: + writer.WriteStringValue(dateTime, "O"); + break; + case IEnumerable> enumerable: + writer.WriteStartObject(); + foreach (var pair in enumerable) + { + writer.WritePropertyName(pair.Key); + writer.WriteObjectValue(pair.Value, options); + } + writer.WriteEndObject(); + break; + case IEnumerable objectEnumerable: + writer.WriteStartArray(); + foreach (var item in objectEnumerable) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + break; + case TimeSpan timeSpan: + writer.WriteStringValue(timeSpan, "P"); + break; + default: + throw new NotSupportedException($"Not supported type {value.GetType()}"); + } + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, object value, ModelReaderWriterOptions options = null) + { + writer.WriteObjectValue(value, options); + } + + internal static class TypeFormatters + { + private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; + public const string DefaultNumberFormat = "G"; + + public static string ToString(bool value) => value ? "true" : "false"; + + public static string ToString(DateTime value, string format) => value.Kind switch + { + DateTimeKind.Utc => ToString((DateTimeOffset)value, format), + _ => throw new NotSupportedException($"DateTime {value} has a Kind of {value.Kind}. Azure SDK requires it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.") + }; + + public static string ToString(DateTimeOffset value, string format) => format switch + { + "D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), + "U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture), + "O" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "o" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "R" => value.ToString("r", CultureInfo.InvariantCulture), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(TimeSpan value, string format) => format switch + { + "P" => XmlConvert.ToString(value), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(byte[] value, string format) => format switch + { + "U" => ToBase64UrlString(value), + "D" => Convert.ToBase64String(value), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + + public static string ToBase64UrlString(byte[] value) + { + int numWholeOrPartialInputBlocks = checked(value.Length + 2) / 3; + int size = checked(numWholeOrPartialInputBlocks * 4); + char[] output = new char[size]; + + int numBase64Chars = Convert.ToBase64CharArray(value, 0, value.Length, output, 0); + + int i = 0; + for (; i < numBase64Chars; i++) + { + char ch = output[i]; + if (ch == '+') + { + output[i] = '-'; + } + else + { + if (ch == '/') + { + output[i] = '_'; + } + else + { + if (ch == '=') + { + break; + } + } + } + } + + return new string(output, 0, i); + } + + public static byte[] FromBase64UrlString(string value) + { + int paddingCharsToAdd = (value.Length % 4) switch + { + 0 => 0, + 2 => 2, + 3 => 1, + _ => throw new InvalidOperationException("Malformed input") + }; + char[] output = new char[(value.Length + paddingCharsToAdd)]; + int i = 0; + for (; i < value.Length; i++) + { + char ch = value[i]; + if (ch == '-') + { + output[i] = '+'; + } + else + { + if (ch == '_') + { + output[i] = '/'; + } + else + { + output[i] = ch; + } + } + } + + for (; i < output.Length; i++) + { + output[i] = '='; + } + + return Convert.FromBase64CharArray(output, 0, output.Length); + } + + public static DateTimeOffset ParseDateTimeOffset(string value, string format) => format switch + { + "U" => DateTimeOffset.FromUnixTimeSeconds(long.Parse(value, CultureInfo.InvariantCulture)), + _ => DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) + }; + + public static TimeSpan ParseTimeSpan(string value, string format) => format switch + { + "P" => XmlConvert.ToTimeSpan(value), + _ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture) + }; + + public static string ConvertToString(object value, string format = null) => value switch + { + null => "null", + string s => s, + bool b => ToString(b), + int or float or double or long or decimal => ((IFormattable)value).ToString(DefaultNumberFormat, CultureInfo.InvariantCulture), + byte[] b0 when format != null => ToString(b0, format), + IEnumerable s0 => string.Join(",", s0), + DateTimeOffset dateTime when format != null => ToString(dateTime, format), + TimeSpan timeSpan when format != null => ToString(timeSpan, format), + TimeSpan timeSpan0 => XmlConvert.ToString(timeSpan0), + Guid guid => guid.ToString(), + BinaryData binaryData => ConvertToString(binaryData.ToArray(), format), + _ => value.ToString() + }; + } + } +} diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Internal/Optional.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Internal/Optional.cs new file mode 100644 index 000000000000..84b6bed77003 --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/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.NeonPostgres +{ + 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/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Internal/Utf8JsonRequestContent.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Internal/Utf8JsonRequestContent.cs new file mode 100644 index 000000000000..0632aa27e14b --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/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.NeonPostgres +{ + 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/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/LongRunningOperation/NeonOrganizationOperationSource.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/LongRunningOperation/NeonOrganizationOperationSource.cs new file mode 100644 index 000000000000..abbaf83875ca --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/LongRunningOperation/NeonOrganizationOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.NeonPostgres +{ + internal class NeonOrganizationOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal NeonOrganizationOperationSource(ArmClient client) + { + _client = client; + } + + NeonOrganizationResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = NeonOrganizationData.DeserializeNeonOrganizationData(document.RootElement); + return new NeonOrganizationResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = NeonOrganizationData.DeserializeNeonOrganizationData(document.RootElement); + return new NeonOrganizationResource(_client, data); + } + } +} diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/LongRunningOperation/NeonPostgresArmOperation.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/LongRunningOperation/NeonPostgresArmOperation.cs new file mode 100644 index 000000000000..d6405f97666c --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/LongRunningOperation/NeonPostgresArmOperation.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.NeonPostgres +{ +#pragma warning disable SA1649 // File name should match first type name + internal class NeonPostgresArmOperation : 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 NeonPostgresArmOperation for mocking. + protected NeonPostgresArmOperation() + { + } + + internal NeonPostgresArmOperation(Response response, RehydrationToken? rehydrationToken = null) + { + _operation = OperationInternal.Succeeded(response); + _completeRehydrationToken = rehydrationToken; + _operationId = GetOperationId(rehydrationToken); + } + + internal NeonPostgresArmOperation(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, "NeonPostgresArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + } + + private string GetOperationId(RehydrationToken? rehydrationToken) + { + if (rehydrationToken is null) + { + return null; + } + var lroDetails = ModelReaderWriter.Write(rehydrationToken, ModelReaderWriterOptions.Json).ToObjectFromJson>(); + return lroDetails["id"]; + } + /// + public override string Id => _operationId ?? NextLinkOperationImplementation.NotSet; + + /// + public override RehydrationToken? GetRehydrationToken() => _nextLinkOperation?.GetRehydrationToken() ?? _completeRehydrationToken; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override Response GetRawResponse() => _operation.RawResponse; + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override Response WaitForCompletionResponse(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponse(cancellationToken); + + /// + public override Response WaitForCompletionResponse(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponse(pollingInterval, cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/LongRunningOperation/NeonPostgresArmOperationOfT.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/LongRunningOperation/NeonPostgresArmOperationOfT.cs new file mode 100644 index 000000000000..833c06ce3f65 --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/LongRunningOperation/NeonPostgresArmOperationOfT.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.NeonPostgres +{ +#pragma warning disable SA1649 // File name should match first type name + internal class NeonPostgresArmOperation : 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 NeonPostgresArmOperation for mocking. + protected NeonPostgresArmOperation() + { + } + + internal NeonPostgresArmOperation(Response response, RehydrationToken? rehydrationToken = null) + { + _operation = OperationInternal.Succeeded(response.GetRawResponse(), response.Value); + _completeRehydrationToken = rehydrationToken; + _operationId = GetOperationId(rehydrationToken); + } + + internal NeonPostgresArmOperation(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, "NeonPostgresArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + } + + private string GetOperationId(RehydrationToken? rehydrationToken) + { + if (rehydrationToken is null) + { + return null; + } + var lroDetails = ModelReaderWriter.Write(rehydrationToken, ModelReaderWriterOptions.Json).ToObjectFromJson>(); + return lroDetails["id"]; + } + /// + public override string Id => _operationId ?? NextLinkOperationImplementation.NotSet; + + /// + public override RehydrationToken? GetRehydrationToken() => _nextLinkOperation?.GetRehydrationToken() ?? _completeRehydrationToken; + + /// + public override T Value => _operation.Value; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override Response GetRawResponse() => _operation.RawResponse; + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override Response WaitForCompletion(CancellationToken cancellationToken = default) => _operation.WaitForCompletion(cancellationToken); + + /// + public override Response WaitForCompletion(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletion(pollingInterval, cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/MarketplaceSubscriptionStatus.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/MarketplaceSubscriptionStatus.cs new file mode 100644 index 000000000000..87d045e459cb --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/MarketplaceSubscriptionStatus.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.NeonPostgres.Models +{ + /// Marketplace subscription status of a resource. + public readonly partial struct MarketplaceSubscriptionStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public MarketplaceSubscriptionStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PendingFulfillmentStartValue = "PendingFulfillmentStart"; + private const string SubscribedValue = "Subscribed"; + private const string SuspendedValue = "Suspended"; + private const string UnsubscribedValue = "Unsubscribed"; + + /// Purchased but not yet activated. + public static MarketplaceSubscriptionStatus PendingFulfillmentStart { get; } = new MarketplaceSubscriptionStatus(PendingFulfillmentStartValue); + /// Marketplace subscription is activated. + public static MarketplaceSubscriptionStatus Subscribed { get; } = new MarketplaceSubscriptionStatus(SubscribedValue); + /// This state indicates that a customer's payment for the Marketplace service was not received. + public static MarketplaceSubscriptionStatus Suspended { get; } = new MarketplaceSubscriptionStatus(SuspendedValue); + /// Customer has cancelled the subscription. + public static MarketplaceSubscriptionStatus Unsubscribed { get; } = new MarketplaceSubscriptionStatus(UnsubscribedValue); + /// Determines if two values are the same. + public static bool operator ==(MarketplaceSubscriptionStatus left, MarketplaceSubscriptionStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(MarketplaceSubscriptionStatus left, MarketplaceSubscriptionStatus right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator MarketplaceSubscriptionStatus(string value) => new MarketplaceSubscriptionStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is MarketplaceSubscriptionStatus other && Equals(other); + /// + public bool Equals(MarketplaceSubscriptionStatus 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/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonCompanyDetails.Serialization.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonCompanyDetails.Serialization.cs new file mode 100644 index 000000000000..7f2798402d2b --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonCompanyDetails.Serialization.cs @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.NeonPostgres.Models +{ + public partial class NeonCompanyDetails : 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(NeonCompanyDetails)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(CompanyName)) + { + writer.WritePropertyName("companyName"u8); + writer.WriteStringValue(CompanyName); + } + if (Optional.IsDefined(Country)) + { + writer.WritePropertyName("country"u8); + writer.WriteStringValue(Country); + } + if (Optional.IsDefined(OfficeAddress)) + { + writer.WritePropertyName("officeAddress"u8); + writer.WriteStringValue(OfficeAddress); + } + if (Optional.IsDefined(BusinessPhone)) + { + writer.WritePropertyName("businessPhone"u8); + writer.WriteStringValue(BusinessPhone); + } + if (Optional.IsDefined(Domain)) + { + writer.WritePropertyName("domain"u8); + writer.WriteStringValue(Domain); + } + if (Optional.IsDefined(NumberOfEmployees)) + { + writer.WritePropertyName("numberOfEmployees"u8); + writer.WriteNumberValue(NumberOfEmployees.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + NeonCompanyDetails 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(NeonCompanyDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNeonCompanyDetails(document.RootElement, options); + } + + internal static NeonCompanyDetails DeserializeNeonCompanyDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string companyName = default; + string country = default; + string officeAddress = default; + string businessPhone = default; + string domain = default; + long? numberOfEmployees = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("companyName"u8)) + { + companyName = property.Value.GetString(); + continue; + } + if (property.NameEquals("country"u8)) + { + country = property.Value.GetString(); + continue; + } + if (property.NameEquals("officeAddress"u8)) + { + officeAddress = property.Value.GetString(); + continue; + } + if (property.NameEquals("businessPhone"u8)) + { + businessPhone = property.Value.GetString(); + continue; + } + if (property.NameEquals("domain"u8)) + { + domain = property.Value.GetString(); + continue; + } + if (property.NameEquals("numberOfEmployees"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + numberOfEmployees = property.Value.GetInt64(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new NeonCompanyDetails( + companyName, + country, + officeAddress, + businessPhone, + domain, + numberOfEmployees, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(NeonCompanyDetails)} does not support writing '{options.Format}' format."); + } + } + + NeonCompanyDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeNeonCompanyDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NeonCompanyDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonCompanyDetails.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonCompanyDetails.cs new file mode 100644 index 000000000000..f79630c688cf --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonCompanyDetails.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NeonPostgres.Models +{ + /// Company details for an organization. + public partial class NeonCompanyDetails + { + /// + /// 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 NeonCompanyDetails() + { + } + + /// Initializes a new instance of . + /// Company name. + /// Country name of the company. + /// Office address of the company. + /// Business phone number of the company. + /// Domain of the user. + /// Number of employees in the company. + /// Keeps track of any properties unknown to the library. + internal NeonCompanyDetails(string companyName, string country, string officeAddress, string businessPhone, string domain, long? numberOfEmployees, IDictionary serializedAdditionalRawData) + { + CompanyName = companyName; + Country = country; + OfficeAddress = officeAddress; + BusinessPhone = businessPhone; + Domain = domain; + NumberOfEmployees = numberOfEmployees; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Company name. + public string CompanyName { get; set; } + /// Country name of the company. + public string Country { get; set; } + /// Office address of the company. + public string OfficeAddress { get; set; } + /// Business phone number of the company. + public string BusinessPhone { get; set; } + /// Domain of the user. + public string Domain { get; set; } + /// Number of employees in the company. + public long? NumberOfEmployees { get; set; } + } +} diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonMarketplaceDetails.Serialization.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonMarketplaceDetails.Serialization.cs new file mode 100644 index 000000000000..6415badcf5d3 --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonMarketplaceDetails.Serialization.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.NeonPostgres.Models +{ + public partial class NeonMarketplaceDetails : 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(NeonMarketplaceDetails)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(SubscriptionId)) + { + writer.WritePropertyName("subscriptionId"u8); + writer.WriteStringValue(SubscriptionId); + } + if (Optional.IsDefined(SubscriptionStatus)) + { + writer.WritePropertyName("subscriptionStatus"u8); + writer.WriteStringValue(SubscriptionStatus.Value.ToString()); + } + writer.WritePropertyName("offerDetails"u8); + writer.WriteObjectValue(OfferDetails, options); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + NeonMarketplaceDetails 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(NeonMarketplaceDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNeonMarketplaceDetails(document.RootElement, options); + } + + internal static NeonMarketplaceDetails DeserializeNeonMarketplaceDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string subscriptionId = default; + MarketplaceSubscriptionStatus? subscriptionStatus = default; + NeonOfferDetails offerDetails = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("subscriptionId"u8)) + { + subscriptionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("subscriptionStatus"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + subscriptionStatus = new MarketplaceSubscriptionStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("offerDetails"u8)) + { + offerDetails = NeonOfferDetails.DeserializeNeonOfferDetails(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new NeonMarketplaceDetails(subscriptionId, subscriptionStatus, offerDetails, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(NeonMarketplaceDetails)} does not support writing '{options.Format}' format."); + } + } + + NeonMarketplaceDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeNeonMarketplaceDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NeonMarketplaceDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonMarketplaceDetails.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonMarketplaceDetails.cs new file mode 100644 index 000000000000..5b74feedbe71 --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonMarketplaceDetails.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NeonPostgres.Models +{ + /// Marketplace details for an organization. + public partial class NeonMarketplaceDetails + { + /// + /// 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 . + /// Offer details for the marketplace that is selected by the user. + /// is null. + public NeonMarketplaceDetails(NeonOfferDetails offerDetails) + { + Argument.AssertNotNull(offerDetails, nameof(offerDetails)); + + OfferDetails = offerDetails; + } + + /// Initializes a new instance of . + /// SaaS subscription id for the the marketplace offer. + /// Marketplace subscription status. + /// Offer details for the marketplace that is selected by the user. + /// Keeps track of any properties unknown to the library. + internal NeonMarketplaceDetails(string subscriptionId, MarketplaceSubscriptionStatus? subscriptionStatus, NeonOfferDetails offerDetails, IDictionary serializedAdditionalRawData) + { + SubscriptionId = subscriptionId; + SubscriptionStatus = subscriptionStatus; + OfferDetails = offerDetails; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal NeonMarketplaceDetails() + { + } + + /// SaaS subscription id for the the marketplace offer. + public string SubscriptionId { get; set; } + /// Marketplace subscription status. + public MarketplaceSubscriptionStatus? SubscriptionStatus { get; set; } + /// Offer details for the marketplace that is selected by the user. + public NeonOfferDetails OfferDetails { get; set; } + } +} diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonOfferDetails.Serialization.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonOfferDetails.Serialization.cs new file mode 100644 index 000000000000..11cf0f44ddef --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonOfferDetails.Serialization.cs @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.NeonPostgres.Models +{ + public partial class NeonOfferDetails : 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(NeonOfferDetails)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("publisherId"u8); + writer.WriteStringValue(PublisherId); + writer.WritePropertyName("offerId"u8); + writer.WriteStringValue(OfferId); + writer.WritePropertyName("planId"u8); + writer.WriteStringValue(PlanId); + if (Optional.IsDefined(PlanName)) + { + writer.WritePropertyName("planName"u8); + writer.WriteStringValue(PlanName); + } + if (Optional.IsDefined(TermUnit)) + { + writer.WritePropertyName("termUnit"u8); + writer.WriteStringValue(TermUnit); + } + if (Optional.IsDefined(TermId)) + { + writer.WritePropertyName("termId"u8); + writer.WriteStringValue(TermId); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + NeonOfferDetails 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(NeonOfferDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNeonOfferDetails(document.RootElement, options); + } + + internal static NeonOfferDetails DeserializeNeonOfferDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string publisherId = default; + string offerId = default; + string planId = default; + string planName = default; + string termUnit = default; + string termId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("publisherId"u8)) + { + publisherId = property.Value.GetString(); + continue; + } + if (property.NameEquals("offerId"u8)) + { + offerId = property.Value.GetString(); + continue; + } + if (property.NameEquals("planId"u8)) + { + planId = property.Value.GetString(); + continue; + } + if (property.NameEquals("planName"u8)) + { + planName = property.Value.GetString(); + continue; + } + if (property.NameEquals("termUnit"u8)) + { + termUnit = property.Value.GetString(); + continue; + } + if (property.NameEquals("termId"u8)) + { + termId = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new NeonOfferDetails( + publisherId, + offerId, + planId, + planName, + termUnit, + termId, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(NeonOfferDetails)} does not support writing '{options.Format}' format."); + } + } + + NeonOfferDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeNeonOfferDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NeonOfferDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonOfferDetails.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonOfferDetails.cs new file mode 100644 index 000000000000..2bc149e7cc83 --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonOfferDetails.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NeonPostgres.Models +{ + /// Offer details for the marketplace that is selected by the user. + public partial class NeonOfferDetails + { + /// + /// 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 . + /// Publisher Id for the marketplace offer. + /// Offer Id for the marketplace offer. + /// Plan Id for the marketplace offer. + /// , or is null. + public NeonOfferDetails(string publisherId, string offerId, string planId) + { + Argument.AssertNotNull(publisherId, nameof(publisherId)); + Argument.AssertNotNull(offerId, nameof(offerId)); + Argument.AssertNotNull(planId, nameof(planId)); + + PublisherId = publisherId; + OfferId = offerId; + PlanId = planId; + } + + /// Initializes a new instance of . + /// Publisher Id for the marketplace offer. + /// Offer Id for the marketplace offer. + /// Plan Id for the marketplace offer. + /// Plan Name for the marketplace offer. + /// Term Name for the marketplace offer. + /// Term Id for the marketplace offer. + /// Keeps track of any properties unknown to the library. + internal NeonOfferDetails(string publisherId, string offerId, string planId, string planName, string termUnit, string termId, IDictionary serializedAdditionalRawData) + { + PublisherId = publisherId; + OfferId = offerId; + PlanId = planId; + PlanName = planName; + TermUnit = termUnit; + TermId = termId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal NeonOfferDetails() + { + } + + /// Publisher Id for the marketplace offer. + public string PublisherId { get; set; } + /// Offer Id for the marketplace offer. + public string OfferId { get; set; } + /// Plan Id for the marketplace offer. + public string PlanId { get; set; } + /// Plan Name for the marketplace offer. + public string PlanName { get; set; } + /// Term Name for the marketplace offer. + public string TermUnit { get; set; } + /// Term Id for the marketplace offer. + public string TermId { get; set; } + } +} diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonOrganizationPropertes.Serialization.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonOrganizationPropertes.Serialization.cs new file mode 100644 index 000000000000..0d5b3d333645 --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonOrganizationPropertes.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.NeonPostgres.Models +{ + public partial class NeonOrganizationPropertes : 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(NeonOrganizationPropertes)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("marketplaceDetails"u8); + writer.WriteObjectValue(MarketplaceDetails, options); + writer.WritePropertyName("userDetails"u8); + writer.WriteObjectValue(UserDetails, options); + writer.WritePropertyName("companyDetails"u8); + writer.WriteObjectValue(CompanyDetails, options); + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (Optional.IsDefined(PartnerOrganizationProperties)) + { + writer.WritePropertyName("partnerOrganizationProperties"u8); + writer.WriteObjectValue(PartnerOrganizationProperties, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + NeonOrganizationPropertes 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(NeonOrganizationPropertes)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNeonOrganizationPropertes(document.RootElement, options); + } + + internal static NeonOrganizationPropertes DeserializeNeonOrganizationPropertes(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + NeonMarketplaceDetails marketplaceDetails = default; + NeonUserDetails userDetails = default; + NeonCompanyDetails companyDetails = default; + NeonResourceProvisioningState? provisioningState = default; + PartnerOrganizationProperties partnerOrganizationProperties = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("marketplaceDetails"u8)) + { + marketplaceDetails = NeonMarketplaceDetails.DeserializeNeonMarketplaceDetails(property.Value, options); + continue; + } + if (property.NameEquals("userDetails"u8)) + { + userDetails = NeonUserDetails.DeserializeNeonUserDetails(property.Value, options); + continue; + } + if (property.NameEquals("companyDetails"u8)) + { + companyDetails = NeonCompanyDetails.DeserializeNeonCompanyDetails(property.Value, options); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new NeonResourceProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("partnerOrganizationProperties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + partnerOrganizationProperties = PartnerOrganizationProperties.DeserializePartnerOrganizationProperties(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new NeonOrganizationPropertes( + marketplaceDetails, + userDetails, + companyDetails, + provisioningState, + partnerOrganizationProperties, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(NeonOrganizationPropertes)} does not support writing '{options.Format}' format."); + } + } + + NeonOrganizationPropertes IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeNeonOrganizationPropertes(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NeonOrganizationPropertes)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonOrganizationPropertes.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonOrganizationPropertes.cs new file mode 100644 index 000000000000..723eab333f1f --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonOrganizationPropertes.cs @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NeonPostgres.Models +{ + /// Properties specific to Data Organization resource. + public partial class NeonOrganizationPropertes + { + /// + /// 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 . + /// Marketplace details of the resource. + /// Details of the user. + /// Details of the company. + /// , or is null. + public NeonOrganizationPropertes(NeonMarketplaceDetails marketplaceDetails, NeonUserDetails userDetails, NeonCompanyDetails companyDetails) + { + Argument.AssertNotNull(marketplaceDetails, nameof(marketplaceDetails)); + Argument.AssertNotNull(userDetails, nameof(userDetails)); + Argument.AssertNotNull(companyDetails, nameof(companyDetails)); + + MarketplaceDetails = marketplaceDetails; + UserDetails = userDetails; + CompanyDetails = companyDetails; + } + + /// Initializes a new instance of . + /// Marketplace details of the resource. + /// Details of the user. + /// Details of the company. + /// Provisioning state of the resource. + /// Organization properties. + /// Keeps track of any properties unknown to the library. + internal NeonOrganizationPropertes(NeonMarketplaceDetails marketplaceDetails, NeonUserDetails userDetails, NeonCompanyDetails companyDetails, NeonResourceProvisioningState? provisioningState, PartnerOrganizationProperties partnerOrganizationProperties, IDictionary serializedAdditionalRawData) + { + MarketplaceDetails = marketplaceDetails; + UserDetails = userDetails; + CompanyDetails = companyDetails; + ProvisioningState = provisioningState; + PartnerOrganizationProperties = partnerOrganizationProperties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal NeonOrganizationPropertes() + { + } + + /// Marketplace details of the resource. + public NeonMarketplaceDetails MarketplaceDetails { get; set; } + /// Details of the user. + public NeonUserDetails UserDetails { get; set; } + /// Details of the company. + public NeonCompanyDetails CompanyDetails { get; set; } + /// Provisioning state of the resource. + public NeonResourceProvisioningState? ProvisioningState { get; } + /// Organization properties. + public PartnerOrganizationProperties PartnerOrganizationProperties { get; set; } + } +} diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonResourceProvisioningState.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonResourceProvisioningState.cs new file mode 100644 index 000000000000..fa0839a0a93c --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonResourceProvisioningState.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.NeonPostgres.Models +{ + /// The provisioning state of a resource type. + public readonly partial struct NeonResourceProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public NeonResourceProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + + /// Resource has been created. + public static NeonResourceProvisioningState Succeeded { get; } = new NeonResourceProvisioningState(SucceededValue); + /// Resource creation failed. + public static NeonResourceProvisioningState Failed { get; } = new NeonResourceProvisioningState(FailedValue); + /// Resource creation was canceled. + public static NeonResourceProvisioningState Canceled { get; } = new NeonResourceProvisioningState(CanceledValue); + /// Determines if two values are the same. + public static bool operator ==(NeonResourceProvisioningState left, NeonResourceProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(NeonResourceProvisioningState left, NeonResourceProvisioningState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator NeonResourceProvisioningState(string value) => new NeonResourceProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is NeonResourceProvisioningState other && Equals(other); + /// + public bool Equals(NeonResourceProvisioningState 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/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonSingleSignOnProperties.Serialization.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonSingleSignOnProperties.Serialization.cs new file mode 100644 index 000000000000..22ffcbbbb660 --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonSingleSignOnProperties.Serialization.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.NeonPostgres.Models +{ + public partial class NeonSingleSignOnProperties : 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(NeonSingleSignOnProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(SingleSignOnState)) + { + writer.WritePropertyName("singleSignOnState"u8); + writer.WriteStringValue(SingleSignOnState.Value.ToString()); + } + if (Optional.IsDefined(EnterpriseAppId)) + { + writer.WritePropertyName("enterpriseAppId"u8); + writer.WriteStringValue(EnterpriseAppId); + } + if (Optional.IsDefined(SingleSignOnUri)) + { + writer.WritePropertyName("singleSignOnUrl"u8); + writer.WriteStringValue(SingleSignOnUri); + } + if (Optional.IsCollectionDefined(AadDomains)) + { + writer.WritePropertyName("aadDomains"u8); + writer.WriteStartArray(); + foreach (var item in AadDomains) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + NeonSingleSignOnProperties 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(NeonSingleSignOnProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNeonSingleSignOnProperties(document.RootElement, options); + } + + internal static NeonSingleSignOnProperties DeserializeNeonSingleSignOnProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + NeonSingleSignOnState? singleSignOnState = default; + string enterpriseAppId = default; + string singleSignOnUrl = default; + IList aadDomains = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("singleSignOnState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + singleSignOnState = new NeonSingleSignOnState(property.Value.GetString()); + continue; + } + if (property.NameEquals("enterpriseAppId"u8)) + { + enterpriseAppId = property.Value.GetString(); + continue; + } + if (property.NameEquals("singleSignOnUrl"u8)) + { + singleSignOnUrl = property.Value.GetString(); + continue; + } + if (property.NameEquals("aadDomains"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + aadDomains = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new NeonSingleSignOnProperties(singleSignOnState, enterpriseAppId, singleSignOnUrl, aadDomains ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(NeonSingleSignOnProperties)} does not support writing '{options.Format}' format."); + } + } + + NeonSingleSignOnProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeNeonSingleSignOnProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NeonSingleSignOnProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonSingleSignOnProperties.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonSingleSignOnProperties.cs new file mode 100644 index 000000000000..be9b3e69811c --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonSingleSignOnProperties.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NeonPostgres.Models +{ + /// Properties specific to Single Sign On Resource. + public partial class NeonSingleSignOnProperties + { + /// + /// 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 NeonSingleSignOnProperties() + { + AadDomains = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// State of the Single Sign On for the organization. + /// AAD enterprise application Id used to setup SSO. + /// URL for SSO to be used by the partner to redirect the user to their system. + /// List of AAD domains fetched from Microsoft Graph for user. + /// Keeps track of any properties unknown to the library. + internal NeonSingleSignOnProperties(NeonSingleSignOnState? singleSignOnState, string enterpriseAppId, string singleSignOnUri, IList aadDomains, IDictionary serializedAdditionalRawData) + { + SingleSignOnState = singleSignOnState; + EnterpriseAppId = enterpriseAppId; + SingleSignOnUri = singleSignOnUri; + AadDomains = aadDomains; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// State of the Single Sign On for the organization. + public NeonSingleSignOnState? SingleSignOnState { get; set; } + /// AAD enterprise application Id used to setup SSO. + public string EnterpriseAppId { get; set; } + /// URL for SSO to be used by the partner to redirect the user to their system. + public string SingleSignOnUri { get; set; } + /// List of AAD domains fetched from Microsoft Graph for user. + public IList AadDomains { get; } + } +} diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonSingleSignOnState.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonSingleSignOnState.cs new file mode 100644 index 000000000000..52e92e41b67e --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonSingleSignOnState.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.NeonPostgres.Models +{ + /// Various states of the SSO resource. + public readonly partial struct NeonSingleSignOnState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public NeonSingleSignOnState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string InitialValue = "Initial"; + private const string EnableValue = "Enable"; + private const string DisableValue = "Disable"; + + /// Initial state of the SSO resource. + public static NeonSingleSignOnState Initial { get; } = new NeonSingleSignOnState(InitialValue); + /// SSO is enabled for the organization. + public static NeonSingleSignOnState Enable { get; } = new NeonSingleSignOnState(EnableValue); + /// SSO is disabled for the organization. + public static NeonSingleSignOnState Disable { get; } = new NeonSingleSignOnState(DisableValue); + /// Determines if two values are the same. + public static bool operator ==(NeonSingleSignOnState left, NeonSingleSignOnState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(NeonSingleSignOnState left, NeonSingleSignOnState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator NeonSingleSignOnState(string value) => new NeonSingleSignOnState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is NeonSingleSignOnState other && Equals(other); + /// + public bool Equals(NeonSingleSignOnState 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/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonUserDetails.Serialization.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonUserDetails.Serialization.cs new file mode 100644 index 000000000000..856ff78d3078 --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonUserDetails.Serialization.cs @@ -0,0 +1,179 @@ +// 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.NeonPostgres.Models +{ + public partial class NeonUserDetails : 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(NeonUserDetails)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(FirstName)) + { + writer.WritePropertyName("firstName"u8); + writer.WriteStringValue(FirstName); + } + if (Optional.IsDefined(LastName)) + { + writer.WritePropertyName("lastName"u8); + writer.WriteStringValue(LastName); + } + if (Optional.IsDefined(EmailAddress)) + { + writer.WritePropertyName("emailAddress"u8); + writer.WriteStringValue(EmailAddress); + } + if (Optional.IsDefined(Upn)) + { + writer.WritePropertyName("upn"u8); + writer.WriteStringValue(Upn); + } + if (Optional.IsDefined(PhoneNumber)) + { + writer.WritePropertyName("phoneNumber"u8); + writer.WriteStringValue(PhoneNumber); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + NeonUserDetails 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(NeonUserDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNeonUserDetails(document.RootElement, options); + } + + internal static NeonUserDetails DeserializeNeonUserDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string firstName = default; + string lastName = default; + string emailAddress = default; + string upn = default; + string phoneNumber = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("firstName"u8)) + { + firstName = property.Value.GetString(); + continue; + } + if (property.NameEquals("lastName"u8)) + { + lastName = property.Value.GetString(); + continue; + } + if (property.NameEquals("emailAddress"u8)) + { + emailAddress = property.Value.GetString(); + continue; + } + if (property.NameEquals("upn"u8)) + { + upn = property.Value.GetString(); + continue; + } + if (property.NameEquals("phoneNumber"u8)) + { + phoneNumber = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new NeonUserDetails( + firstName, + lastName, + emailAddress, + upn, + phoneNumber, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(NeonUserDetails)} does not support writing '{options.Format}' format."); + } + } + + NeonUserDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeNeonUserDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NeonUserDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonUserDetails.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonUserDetails.cs new file mode 100644 index 000000000000..a7bd230c3091 --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonUserDetails.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NeonPostgres.Models +{ + /// User details for an organization. + public partial class NeonUserDetails + { + /// + /// 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 NeonUserDetails() + { + } + + /// Initializes a new instance of . + /// First name of the user. + /// Last name of the user. + /// Email address of the user. + /// User's principal name. + /// User's phone number. + /// Keeps track of any properties unknown to the library. + internal NeonUserDetails(string firstName, string lastName, string emailAddress, string upn, string phoneNumber, IDictionary serializedAdditionalRawData) + { + FirstName = firstName; + LastName = lastName; + EmailAddress = emailAddress; + Upn = upn; + PhoneNumber = phoneNumber; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// First name of the user. + public string FirstName { get; set; } + /// Last name of the user. + public string LastName { get; set; } + /// Email address of the user. + public string EmailAddress { get; set; } + /// User's principal name. + public string Upn { get; set; } + /// User's phone number. + public string PhoneNumber { get; set; } + } +} diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/OrganizationResourceListResult.Serialization.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/OrganizationResourceListResult.Serialization.cs new file mode 100644 index 000000000000..72ee824d6886 --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/OrganizationResourceListResult.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.NeonPostgres.Models +{ + internal partial class OrganizationResourceListResult : 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(OrganizationResourceListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + OrganizationResourceListResult 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(OrganizationResourceListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOrganizationResourceListResult(document.RootElement, options); + } + + internal static OrganizationResourceListResult DeserializeOrganizationResourceListResult(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(NeonOrganizationData.DeserializeNeonOrganizationData(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 OrganizationResourceListResult(value, nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(OrganizationResourceListResult)} does not support writing '{options.Format}' format."); + } + } + + OrganizationResourceListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeOrganizationResourceListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OrganizationResourceListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/OrganizationResourceListResult.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/OrganizationResourceListResult.cs new file mode 100644 index 000000000000..02ff689714ce --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/OrganizationResourceListResult.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.NeonPostgres.Models +{ + /// The response of a OrganizationResource list operation. + internal partial class OrganizationResourceListResult + { + /// + /// 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 OrganizationResource items on this page. + /// is null. + internal OrganizationResourceListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The OrganizationResource items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal OrganizationResourceListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal OrganizationResourceListResult() + { + } + + /// The OrganizationResource items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/PartnerOrganizationProperties.Serialization.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/PartnerOrganizationProperties.Serialization.cs new file mode 100644 index 000000000000..6b58a434e16d --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/PartnerOrganizationProperties.Serialization.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.NeonPostgres.Models +{ + public partial class PartnerOrganizationProperties : 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(PartnerOrganizationProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(OrganizationId)) + { + writer.WritePropertyName("organizationId"u8); + writer.WriteStringValue(OrganizationId); + } + writer.WritePropertyName("organizationName"u8); + writer.WriteStringValue(OrganizationName); + if (Optional.IsDefined(SingleSignOnProperties)) + { + writer.WritePropertyName("singleSignOnProperties"u8); + writer.WriteObjectValue(SingleSignOnProperties, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + PartnerOrganizationProperties 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(PartnerOrganizationProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePartnerOrganizationProperties(document.RootElement, options); + } + + internal static PartnerOrganizationProperties DeserializePartnerOrganizationProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string organizationId = default; + string organizationName = default; + NeonSingleSignOnProperties singleSignOnProperties = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("organizationId"u8)) + { + organizationId = property.Value.GetString(); + continue; + } + if (property.NameEquals("organizationName"u8)) + { + organizationName = property.Value.GetString(); + continue; + } + if (property.NameEquals("singleSignOnProperties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + singleSignOnProperties = NeonSingleSignOnProperties.DeserializeNeonSingleSignOnProperties(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PartnerOrganizationProperties(organizationId, organizationName, singleSignOnProperties, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(PartnerOrganizationProperties)} does not support writing '{options.Format}' format."); + } + } + + PartnerOrganizationProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializePartnerOrganizationProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PartnerOrganizationProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/PartnerOrganizationProperties.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/PartnerOrganizationProperties.cs new file mode 100644 index 000000000000..efbdd84e33b9 --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/PartnerOrganizationProperties.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.NeonPostgres.Models +{ + /// Properties specific to Partner's organization. + public partial class PartnerOrganizationProperties + { + /// + /// 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 . + /// Organization name in partner's system. + /// is null. + public PartnerOrganizationProperties(string organizationName) + { + Argument.AssertNotNull(organizationName, nameof(organizationName)); + + OrganizationName = organizationName; + } + + /// Initializes a new instance of . + /// Organization Id in partner's system. + /// Organization name in partner's system. + /// Single Sign On properties for the organization. + /// Keeps track of any properties unknown to the library. + internal PartnerOrganizationProperties(string organizationId, string organizationName, NeonSingleSignOnProperties singleSignOnProperties, IDictionary serializedAdditionalRawData) + { + OrganizationId = organizationId; + OrganizationName = organizationName; + SingleSignOnProperties = singleSignOnProperties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PartnerOrganizationProperties() + { + } + + /// Organization Id in partner's system. + public string OrganizationId { get; set; } + /// Organization name in partner's system. + public string OrganizationName { get; set; } + /// Single Sign On properties for the organization. + public NeonSingleSignOnProperties SingleSignOnProperties { get; set; } + } +} diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/NeonOrganizationCollection.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/NeonOrganizationCollection.cs new file mode 100644 index 000000000000..29184c380db9 --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/NeonOrganizationCollection.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.NeonPostgres +{ + /// + /// 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 GetNeonOrganizations method from an instance of . + /// + public partial class NeonOrganizationCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _neonOrganizationOrganizationsClientDiagnostics; + private readonly OrganizationsRestOperations _neonOrganizationOrganizationsRestClient; + + /// Initializes a new instance of the class for mocking. + protected NeonOrganizationCollection() + { + } + + /// 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 NeonOrganizationCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _neonOrganizationOrganizationsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NeonPostgres", NeonOrganizationResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(NeonOrganizationResource.ResourceType, out string neonOrganizationOrganizationsApiVersion); + _neonOrganizationOrganizationsRestClient = new OrganizationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, neonOrganizationOrganizationsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceGroupResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), nameof(id)); + } + + /// + /// Create a OrganizationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName} + /// + /// + /// Operation Id + /// OrganizationResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-08-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Name of the Neon Organizations 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 organizationName, NeonOrganizationData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(organizationName, nameof(organizationName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _neonOrganizationOrganizationsClientDiagnostics.CreateScope("NeonOrganizationCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _neonOrganizationOrganizationsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, organizationName, data, cancellationToken).ConfigureAwait(false); + var operation = new NeonPostgresArmOperation(new NeonOrganizationOperationSource(Client), _neonOrganizationOrganizationsClientDiagnostics, Pipeline, _neonOrganizationOrganizationsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, organizationName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a OrganizationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName} + /// + /// + /// Operation Id + /// OrganizationResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-08-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Name of the Neon Organizations 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 organizationName, NeonOrganizationData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(organizationName, nameof(organizationName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _neonOrganizationOrganizationsClientDiagnostics.CreateScope("NeonOrganizationCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _neonOrganizationOrganizationsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, organizationName, data, cancellationToken); + var operation = new NeonPostgresArmOperation(new NeonOrganizationOperationSource(Client), _neonOrganizationOrganizationsClientDiagnostics, Pipeline, _neonOrganizationOrganizationsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, organizationName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a OrganizationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName} + /// + /// + /// Operation Id + /// OrganizationResource_Get + /// + /// + /// Default Api Version + /// 2024-08-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the Neon Organizations 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 organizationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(organizationName, nameof(organizationName)); + + using var scope = _neonOrganizationOrganizationsClientDiagnostics.CreateScope("NeonOrganizationCollection.Get"); + scope.Start(); + try + { + var response = await _neonOrganizationOrganizationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, organizationName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NeonOrganizationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a OrganizationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName} + /// + /// + /// Operation Id + /// OrganizationResource_Get + /// + /// + /// Default Api Version + /// 2024-08-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the Neon Organizations resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string organizationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(organizationName, nameof(organizationName)); + + using var scope = _neonOrganizationOrganizationsClientDiagnostics.CreateScope("NeonOrganizationCollection.Get"); + scope.Start(); + try + { + var response = _neonOrganizationOrganizationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, organizationName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NeonOrganizationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List OrganizationResource resources by resource group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations + /// + /// + /// Operation Id + /// OrganizationResource_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-08-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _neonOrganizationOrganizationsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _neonOrganizationOrganizationsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new NeonOrganizationResource(Client, NeonOrganizationData.DeserializeNeonOrganizationData(e)), _neonOrganizationOrganizationsClientDiagnostics, Pipeline, "NeonOrganizationCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List OrganizationResource resources by resource group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations + /// + /// + /// Operation Id + /// OrganizationResource_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-08-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _neonOrganizationOrganizationsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _neonOrganizationOrganizationsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new NeonOrganizationResource(Client, NeonOrganizationData.DeserializeNeonOrganizationData(e)), _neonOrganizationOrganizationsClientDiagnostics, Pipeline, "NeonOrganizationCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName} + /// + /// + /// Operation Id + /// OrganizationResource_Get + /// + /// + /// Default Api Version + /// 2024-08-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the Neon Organizations 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 organizationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(organizationName, nameof(organizationName)); + + using var scope = _neonOrganizationOrganizationsClientDiagnostics.CreateScope("NeonOrganizationCollection.Exists"); + scope.Start(); + try + { + var response = await _neonOrganizationOrganizationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, organizationName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName} + /// + /// + /// Operation Id + /// OrganizationResource_Get + /// + /// + /// Default Api Version + /// 2024-08-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the Neon Organizations resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string organizationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(organizationName, nameof(organizationName)); + + using var scope = _neonOrganizationOrganizationsClientDiagnostics.CreateScope("NeonOrganizationCollection.Exists"); + scope.Start(); + try + { + var response = _neonOrganizationOrganizationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, organizationName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName} + /// + /// + /// Operation Id + /// OrganizationResource_Get + /// + /// + /// Default Api Version + /// 2024-08-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the Neon Organizations 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 organizationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(organizationName, nameof(organizationName)); + + using var scope = _neonOrganizationOrganizationsClientDiagnostics.CreateScope("NeonOrganizationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _neonOrganizationOrganizationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, organizationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NeonOrganizationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName} + /// + /// + /// Operation Id + /// OrganizationResource_Get + /// + /// + /// Default Api Version + /// 2024-08-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the Neon Organizations resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string organizationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(organizationName, nameof(organizationName)); + + using var scope = _neonOrganizationOrganizationsClientDiagnostics.CreateScope("NeonOrganizationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _neonOrganizationOrganizationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, organizationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new NeonOrganizationResource(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/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/NeonOrganizationData.Serialization.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/NeonOrganizationData.Serialization.cs new file mode 100644 index 000000000000..daeb5054bbab --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/NeonOrganizationData.Serialization.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NeonPostgres.Models; + +namespace Azure.ResourceManager.NeonPostgres +{ + public partial class NeonOrganizationData : 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(NeonOrganizationData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + NeonOrganizationData 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(NeonOrganizationData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNeonOrganizationData(document.RootElement, options); + } + + internal static NeonOrganizationData DeserializeNeonOrganizationData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + NeonOrganizationPropertes properties = default; + IDictionary tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = NeonOrganizationPropertes.DeserializeNeonOrganizationPropertes(property.Value, options); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("location"u8)) + { + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new NeonOrganizationData( + id, + name, + type, + systemData, + tags ?? new ChangeTrackingDictionary(), + location, + properties, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(NeonOrganizationData)} does not support writing '{options.Format}' format."); + } + } + + NeonOrganizationData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeNeonOrganizationData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NeonOrganizationData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/NeonOrganizationData.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/NeonOrganizationData.cs new file mode 100644 index 000000000000..5940b592ab19 --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/NeonOrganizationData.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.NeonPostgres.Models; + +namespace Azure.ResourceManager.NeonPostgres +{ + /// + /// A class representing the NeonOrganization data model. + /// Organization Resource by Neon + /// + public partial class NeonOrganizationData : TrackedResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The location. + public NeonOrganizationData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal NeonOrganizationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, NeonOrganizationPropertes properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal NeonOrganizationData() + { + } + + /// The resource-specific properties for this resource. + public NeonOrganizationPropertes Properties { get; set; } + } +} diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/NeonOrganizationResource.Serialization.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/NeonOrganizationResource.Serialization.cs new file mode 100644 index 000000000000..80af8b3f4b00 --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/NeonOrganizationResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.NeonPostgres +{ + public partial class NeonOrganizationResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + NeonOrganizationData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + NeonOrganizationData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/NeonOrganizationResource.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/NeonOrganizationResource.cs new file mode 100644 index 000000000000..ac4517a26e4a --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/NeonOrganizationResource.cs @@ -0,0 +1,706 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.NeonPostgres +{ + /// + /// A Class representing a NeonOrganization 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 GetNeonOrganizationResource method. + /// Otherwise you can get one from its parent resource using the GetNeonOrganization method. + /// + public partial class NeonOrganizationResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The organizationName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string organizationName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _neonOrganizationOrganizationsClientDiagnostics; + private readonly OrganizationsRestOperations _neonOrganizationOrganizationsRestClient; + private readonly NeonOrganizationData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Neon.Postgres/organizations"; + + /// Initializes a new instance of the class for mocking. + protected NeonOrganizationResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal NeonOrganizationResource(ArmClient client, NeonOrganizationData 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 NeonOrganizationResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _neonOrganizationOrganizationsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.NeonPostgres", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string neonOrganizationOrganizationsApiVersion); + _neonOrganizationOrganizationsRestClient = new OrganizationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, neonOrganizationOrganizationsApiVersion); +#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 NeonOrganizationData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get a OrganizationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName} + /// + /// + /// Operation Id + /// OrganizationResource_Get + /// + /// + /// Default Api Version + /// 2024-08-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _neonOrganizationOrganizationsClientDiagnostics.CreateScope("NeonOrganizationResource.Get"); + scope.Start(); + try + { + var response = await _neonOrganizationOrganizationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NeonOrganizationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a OrganizationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName} + /// + /// + /// Operation Id + /// OrganizationResource_Get + /// + /// + /// Default Api Version + /// 2024-08-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _neonOrganizationOrganizationsClientDiagnostics.CreateScope("NeonOrganizationResource.Get"); + scope.Start(); + try + { + var response = _neonOrganizationOrganizationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new NeonOrganizationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a OrganizationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName} + /// + /// + /// Operation Id + /// OrganizationResource_Delete + /// + /// + /// Default Api Version + /// 2024-08-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _neonOrganizationOrganizationsClientDiagnostics.CreateScope("NeonOrganizationResource.Delete"); + scope.Start(); + try + { + var response = await _neonOrganizationOrganizationsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new NeonPostgresArmOperation(_neonOrganizationOrganizationsClientDiagnostics, Pipeline, _neonOrganizationOrganizationsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a OrganizationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName} + /// + /// + /// Operation Id + /// OrganizationResource_Delete + /// + /// + /// Default Api Version + /// 2024-08-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _neonOrganizationOrganizationsClientDiagnostics.CreateScope("NeonOrganizationResource.Delete"); + scope.Start(); + try + { + var response = _neonOrganizationOrganizationsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new NeonPostgresArmOperation(_neonOrganizationOrganizationsClientDiagnostics, Pipeline, _neonOrganizationOrganizationsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a OrganizationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName} + /// + /// + /// Operation Id + /// OrganizationResource_Update + /// + /// + /// Default Api Version + /// 2024-08-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, NeonOrganizationData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _neonOrganizationOrganizationsClientDiagnostics.CreateScope("NeonOrganizationResource.Update"); + scope.Start(); + try + { + var response = await _neonOrganizationOrganizationsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new NeonPostgresArmOperation(new NeonOrganizationOperationSource(Client), _neonOrganizationOrganizationsClientDiagnostics, Pipeline, _neonOrganizationOrganizationsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a OrganizationResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName} + /// + /// + /// Operation Id + /// OrganizationResource_Update + /// + /// + /// Default Api Version + /// 2024-08-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, NeonOrganizationData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _neonOrganizationOrganizationsClientDiagnostics.CreateScope("NeonOrganizationResource.Update"); + scope.Start(); + try + { + var response = _neonOrganizationOrganizationsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data, cancellationToken); + var operation = new NeonPostgresArmOperation(new NeonOrganizationOperationSource(Client), _neonOrganizationOrganizationsClientDiagnostics, Pipeline, _neonOrganizationOrganizationsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName} + /// + /// + /// Operation Id + /// OrganizationResource_Get + /// + /// + /// Default Api Version + /// 2024-08-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _neonOrganizationOrganizationsClientDiagnostics.CreateScope("NeonOrganizationResource.AddTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues[key] = value; + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _neonOrganizationOrganizationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NeonOrganizationResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new NeonOrganizationData(current.Location); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName} + /// + /// + /// Operation Id + /// OrganizationResource_Get + /// + /// + /// Default Api Version + /// 2024-08-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _neonOrganizationOrganizationsClientDiagnostics.CreateScope("NeonOrganizationResource.AddTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _neonOrganizationOrganizationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new NeonOrganizationResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new NeonOrganizationData(current.Location); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName} + /// + /// + /// Operation Id + /// OrganizationResource_Get + /// + /// + /// Default Api Version + /// 2024-08-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _neonOrganizationOrganizationsClientDiagnostics.CreateScope("NeonOrganizationResource.SetTags"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _neonOrganizationOrganizationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NeonOrganizationResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new NeonOrganizationData(current.Location); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName} + /// + /// + /// Operation Id + /// OrganizationResource_Get + /// + /// + /// Default Api Version + /// 2024-08-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _neonOrganizationOrganizationsClientDiagnostics.CreateScope("NeonOrganizationResource.SetTags"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _neonOrganizationOrganizationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new NeonOrganizationResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new NeonOrganizationData(current.Location); + patch.Tags.ReplaceWith(tags); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName} + /// + /// + /// Operation Id + /// OrganizationResource_Get + /// + /// + /// Default Api Version + /// 2024-08-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _neonOrganizationOrganizationsClientDiagnostics.CreateScope("NeonOrganizationResource.RemoveTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.Remove(key); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _neonOrganizationOrganizationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new NeonOrganizationResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new NeonOrganizationData(current.Location); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName} + /// + /// + /// Operation Id + /// OrganizationResource_Get + /// + /// + /// Default Api Version + /// 2024-08-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _neonOrganizationOrganizationsClientDiagnostics.CreateScope("NeonOrganizationResource.RemoveTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _neonOrganizationOrganizationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new NeonOrganizationResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new NeonOrganizationData(current.Location); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/ProviderConstants.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/ProviderConstants.cs new file mode 100644 index 000000000000..dee8d0019650 --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/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.NeonPostgres +{ + internal static class ProviderConstants + { + public static string DefaultProviderNamespace { get; } = ClientDiagnostics.GetResourceProviderNamespace(typeof(ProviderConstants).Assembly); + } +} diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/RestOperations/OrganizationsRestOperations.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/RestOperations/OrganizationsRestOperations.cs new file mode 100644 index 000000000000..fd873b95bc3d --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/RestOperations/OrganizationsRestOperations.cs @@ -0,0 +1,723 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.NeonPostgres.Models; + +namespace Azure.ResourceManager.NeonPostgres +{ + internal partial class OrganizationsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of OrganizationsRestOperations. + /// 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 OrganizationsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2024-08-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string organizationName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Neon.Postgres/organizations/", false); + uri.AppendPath(organizationName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string organizationName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Neon.Postgres/organizations/", false); + uri.AppendPath(organizationName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a OrganizationResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the Neon Organizations resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string organizationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(organizationName, nameof(organizationName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, organizationName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NeonOrganizationData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = NeonOrganizationData.DeserializeNeonOrganizationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((NeonOrganizationData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a OrganizationResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the Neon Organizations resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string organizationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(organizationName, nameof(organizationName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, organizationName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NeonOrganizationData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = NeonOrganizationData.DeserializeNeonOrganizationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((NeonOrganizationData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string organizationName, NeonOrganizationData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Neon.Postgres/organizations/", false); + uri.AppendPath(organizationName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string organizationName, NeonOrganizationData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Neon.Postgres/organizations/", false); + uri.AppendPath(organizationName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create a OrganizationResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the Neon Organizations resource. + /// Resource create parameters. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string organizationName, NeonOrganizationData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(organizationName, nameof(organizationName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, organizationName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create a OrganizationResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the Neon Organizations resource. + /// Resource create parameters. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string organizationName, NeonOrganizationData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(organizationName, nameof(organizationName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, organizationName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string organizationName, NeonOrganizationData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Neon.Postgres/organizations/", false); + uri.AppendPath(organizationName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string organizationName, NeonOrganizationData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Neon.Postgres/organizations/", false); + uri.AppendPath(organizationName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update a OrganizationResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the Neon Organizations resource. + /// The resource properties to be updated. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string organizationName, NeonOrganizationData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(organizationName, nameof(organizationName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, organizationName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update a OrganizationResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the Neon Organizations resource. + /// The resource properties to be updated. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string organizationName, NeonOrganizationData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(organizationName, nameof(organizationName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, organizationName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string organizationName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Neon.Postgres/organizations/", false); + uri.AppendPath(organizationName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string organizationName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Neon.Postgres/organizations/", false); + uri.AppendPath(organizationName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a OrganizationResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the Neon Organizations resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string organizationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(organizationName, nameof(organizationName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, organizationName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a OrganizationResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the Neon Organizations resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string organizationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(organizationName, nameof(organizationName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, organizationName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Neon.Postgres/organizations", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Neon.Postgres/organizations", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List OrganizationResource resources by resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + OrganizationResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = OrganizationResourceListResult.DeserializeOrganizationResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List OrganizationResource resources by resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + OrganizationResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = OrganizationResourceListResult.DeserializeOrganizationResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Neon.Postgres/organizations", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Neon.Postgres/organizations", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List OrganizationResource resources by subscription ID. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionAsync(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + OrganizationResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = OrganizationResourceListResult.DeserializeOrganizationResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List OrganizationResource resources by subscription ID. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscription(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + OrganizationResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = OrganizationResourceListResult.DeserializeOrganizationResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List OrganizationResource resources by resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + OrganizationResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = OrganizationResourceListResult.DeserializeOrganizationResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List OrganizationResource resources by resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + OrganizationResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = OrganizationResourceListResult.DeserializeOrganizationResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List OrganizationResource resources by subscription ID. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + OrganizationResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = OrganizationResourceListResult.DeserializeOrganizationResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List OrganizationResource resources by subscription ID. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + OrganizationResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = OrganizationResourceListResult.DeserializeOrganizationResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Properties/AssemblyInfo.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..fe973a372f85 --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Properties/AssemblyInfo.cs @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Runtime.CompilerServices; + +[assembly: Azure.Core.AzureResourceProviderNamespace("Neon.Postgres")] + +[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] +[assembly: InternalsVisibleTo("Azure.ResourceManager.NeonPostgres.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/tests/Azure.ResourceManager.NeonPostgres.Tests.csproj b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/tests/Azure.ResourceManager.NeonPostgres.Tests.csproj new file mode 100644 index 000000000000..5888dbdd68fd --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/tests/Azure.ResourceManager.NeonPostgres.Tests.csproj @@ -0,0 +1,5 @@ + + + + + diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/tests/NeonPostgresManagementTestBase.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/tests/NeonPostgresManagementTestBase.cs new file mode 100644 index 000000000000..52b576d4135a --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/tests/NeonPostgresManagementTestBase.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core; +using Azure.Core.TestFramework; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.TestFramework; +using NUnit.Framework; +using System.Threading.Tasks; + +namespace Azure.ResourceManager.NeonPostgres.Tests +{ + public class NeonPostgresManagementTestBase : ManagementRecordedTestBase + { + protected ArmClient Client { get; private set; } + protected SubscriptionResource DefaultSubscription { get; private set; } + + protected NeonPostgresManagementTestBase(bool isAsync, RecordedTestMode mode) + : base(isAsync, mode) + { + } + + protected NeonPostgresManagementTestBase(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/neonpostgres/Azure.ResourceManager.NeonPostgres/tests/NeonPostgresManagementTestEnvironment.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/tests/NeonPostgresManagementTestEnvironment.cs new file mode 100644 index 000000000000..0a2adc0ab2a5 --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/tests/NeonPostgresManagementTestEnvironment.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core.TestFramework; + +namespace Azure.ResourceManager.NeonPostgres.Tests +{ + public class NeonPostgresManagementTestEnvironment : TestEnvironment + { + } +} \ No newline at end of file diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/tsp-location.yaml b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/tsp-location.yaml new file mode 100644 index 000000000000..c99fb2413cc5 --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/tsp-location.yaml @@ -0,0 +1,3 @@ +directory: specification/liftrneon/Neon.Postgres.Management +commit: f41341571ce7d957de8ad80928807cd518ed1014 +repo: Azure/azure-rest-api-specs diff --git a/sdk/neonpostgres/ci.mgmt.yml b/sdk/neonpostgres/ci.mgmt.yml new file mode 100644 index 000000000000..ca6a37a915ef --- /dev/null +++ b/sdk/neonpostgres/ci.mgmt.yml @@ -0,0 +1,24 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: none + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/neonpostgres/ci.mgmt.yml + - sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/ + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: neonpostgres + LimitForPullRequest: true + Artifacts: + - name: Azure.ResourceManager.NeonPostgres + safeName: AzureResourceManagerNeonPostgres From b4e726e280dcd80d8747fd38aab9f9d145d950af Mon Sep 17 00:00:00 2001 From: almasak <162407742+almasak@users.noreply.github.com> Date: Thu, 14 Nov 2024 09:28:41 +0530 Subject: [PATCH 2/5] Replace codeowner with valid user --- .github/CODEOWNERS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index c512fc42e011..aac99f91a518 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1004,10 +1004,10 @@ # ServiceOwners: @8Gitbrix # PRLabel: %Neon Postgres -/sdk/neonpostgres/Azure.ResourceManager.*/ @almasak +/sdk/neonpostgres/Azure.ResourceManager.*/ @ArthurMa1978 # ServiceLabel: %Neon Postgres %Mgmt -# ServiceOwners: @almasak +# ServiceOwners: @ArthurMa1978 # PRLabel: %Network - CDN /sdk/cdn/Azure.ResourceManager.*/ @ptnan7 From 3a9bc37cf6b10768a6cd5bcdd7b59ecf2cc7dfe0 Mon Sep 17 00:00:00 2001 From: almasak <162407742+almasak@users.noreply.github.com> Date: Thu, 14 Nov 2024 09:39:40 +0530 Subject: [PATCH 3/5] Run Update-Mgmt.ps1 script --- sdk/neonpostgres/ci.mgmt.yml | 1 - sdk/resourcemanager/ci.mgmt.yml | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/sdk/neonpostgres/ci.mgmt.yml b/sdk/neonpostgres/ci.mgmt.yml index ca6a37a915ef..72d449fc7a16 100644 --- a/sdk/neonpostgres/ci.mgmt.yml +++ b/sdk/neonpostgres/ci.mgmt.yml @@ -1,7 +1,6 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. trigger: none - pr: branches: include: diff --git a/sdk/resourcemanager/ci.mgmt.yml b/sdk/resourcemanager/ci.mgmt.yml index e844fdb04cde..960151044171 100644 --- a/sdk/resourcemanager/ci.mgmt.yml +++ b/sdk/resourcemanager/ci.mgmt.yml @@ -131,6 +131,7 @@ trigger: - sdk/mongocluster/Azure.ResourceManager.MongoCluster - sdk/monitor/Azure.ResourceManager.Monitor - sdk/mysql/Azure.ResourceManager.MySql + - sdk/neonpostgres/Azure.ResourceManager.NeonPostgres - sdk/netapp/Azure.ResourceManager.NetApp - sdk/network/Azure.ResourceManager.Network - sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics @@ -335,6 +336,7 @@ pr: - sdk/mongocluster/Azure.ResourceManager.MongoCluster - sdk/monitor/Azure.ResourceManager.Monitor - sdk/mysql/Azure.ResourceManager.MySql + - sdk/neonpostgres/Azure.ResourceManager.NeonPostgres - sdk/netapp/Azure.ResourceManager.NetApp - sdk/network/Azure.ResourceManager.Network - sdk/networkanalytics/Azure.ResourceManager.NetworkAnalytics From 49c5fb06a85dea70f4ea4b967b39770fd34a763c Mon Sep 17 00:00:00 2001 From: almasak <162407742+almasak@users.noreply.github.com> Date: Thu, 14 Nov 2024 12:55:27 +0530 Subject: [PATCH 4/5] [Fix] Typo --- .../Generated/ArmNeonPostgresModelFactory.cs | 10 ++--- ...onOrganizationProperties.Serialization.cs} | 38 +++++++++---------- ...ertes.cs => NeonOrganizationProperties.cs} | 14 +++---- .../NeonOrganizationData.Serialization.cs | 4 +- .../src/Generated/NeonOrganizationData.cs | 4 +- .../tsp-location.yaml | 2 +- 6 files changed, 36 insertions(+), 36 deletions(-) rename sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/{NeonOrganizationPropertes.Serialization.cs => NeonOrganizationProperties.Serialization.cs} (77%) rename sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/{NeonOrganizationPropertes.cs => NeonOrganizationProperties.cs} (85%) diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/ArmNeonPostgresModelFactory.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/ArmNeonPostgresModelFactory.cs index 2f104ec08d05..3c3215cb7d69 100644 --- a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/ArmNeonPostgresModelFactory.cs +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/ArmNeonPostgresModelFactory.cs @@ -25,7 +25,7 @@ public static partial class ArmNeonPostgresModelFactory /// The location. /// The resource-specific properties for this resource. /// A new instance for mocking. - public static NeonOrganizationData NeonOrganizationData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, NeonOrganizationPropertes properties = null) + public static NeonOrganizationData NeonOrganizationData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, NeonOrganizationProperties properties = null) { tags ??= new Dictionary(); @@ -40,16 +40,16 @@ public static NeonOrganizationData NeonOrganizationData(ResourceIdentifier id = serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Marketplace details of the resource. /// Details of the user. /// Details of the company. /// Provisioning state of the resource. /// Organization properties. - /// A new instance for mocking. - public static NeonOrganizationPropertes NeonOrganizationPropertes(NeonMarketplaceDetails marketplaceDetails = null, NeonUserDetails userDetails = null, NeonCompanyDetails companyDetails = null, NeonResourceProvisioningState? provisioningState = null, PartnerOrganizationProperties partnerOrganizationProperties = null) + /// A new instance for mocking. + public static NeonOrganizationProperties NeonOrganizationProperties(NeonMarketplaceDetails marketplaceDetails = null, NeonUserDetails userDetails = null, NeonCompanyDetails companyDetails = null, NeonResourceProvisioningState? provisioningState = null, PartnerOrganizationProperties partnerOrganizationProperties = null) { - return new NeonOrganizationPropertes( + return new NeonOrganizationProperties( marketplaceDetails, userDetails, companyDetails, diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonOrganizationPropertes.Serialization.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonOrganizationProperties.Serialization.cs similarity index 77% rename from sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonOrganizationPropertes.Serialization.cs rename to sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonOrganizationProperties.Serialization.cs index 0d5b3d333645..01e723a7d347 100644 --- a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonOrganizationPropertes.Serialization.cs +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonOrganizationProperties.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.NeonPostgres.Models { - public partial class NeonOrganizationPropertes : IUtf8JsonSerializable, IJsonModel + public partial class NeonOrganizationProperties : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(NeonOrganizationPropertes)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(NeonOrganizationProperties)} does not support writing '{format}' format."); } writer.WritePropertyName("marketplaceDetails"u8); @@ -67,19 +67,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - NeonOrganizationPropertes IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + NeonOrganizationProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(NeonOrganizationPropertes)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(NeonOrganizationProperties)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNeonOrganizationPropertes(document.RootElement, options); + return DeserializeNeonOrganizationProperties(document.RootElement, options); } - internal static NeonOrganizationPropertes DeserializeNeonOrganizationPropertes(JsonElement element, ModelReaderWriterOptions options = null) + internal static NeonOrganizationProperties DeserializeNeonOrganizationProperties(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -135,7 +135,7 @@ internal static NeonOrganizationPropertes DeserializeNeonOrganizationPropertes(J } } serializedAdditionalRawData = rawDataDictionary; - return new NeonOrganizationPropertes( + return new NeonOrganizationProperties( marketplaceDetails, userDetails, companyDetails, @@ -144,35 +144,35 @@ internal static NeonOrganizationPropertes DeserializeNeonOrganizationPropertes(J serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(NeonOrganizationPropertes)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(NeonOrganizationProperties)} does not support writing '{options.Format}' format."); } } - NeonOrganizationPropertes IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + NeonOrganizationProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data); - return DeserializeNeonOrganizationPropertes(document.RootElement, options); + return DeserializeNeonOrganizationProperties(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(NeonOrganizationPropertes)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(NeonOrganizationProperties)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonOrganizationPropertes.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonOrganizationProperties.cs similarity index 85% rename from sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonOrganizationPropertes.cs rename to sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonOrganizationProperties.cs index 723eab333f1f..90a25e7a9c58 100644 --- a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonOrganizationPropertes.cs +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/Models/NeonOrganizationProperties.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.NeonPostgres.Models { /// Properties specific to Data Organization resource. - public partial class NeonOrganizationPropertes + public partial class NeonOrganizationProperties { /// /// Keeps track of any properties unknown to the library. @@ -45,12 +45,12 @@ public partial class NeonOrganizationPropertes /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . + /// Initializes a new instance of . /// Marketplace details of the resource. /// Details of the user. /// Details of the company. /// , or is null. - public NeonOrganizationPropertes(NeonMarketplaceDetails marketplaceDetails, NeonUserDetails userDetails, NeonCompanyDetails companyDetails) + public NeonOrganizationProperties(NeonMarketplaceDetails marketplaceDetails, NeonUserDetails userDetails, NeonCompanyDetails companyDetails) { Argument.AssertNotNull(marketplaceDetails, nameof(marketplaceDetails)); Argument.AssertNotNull(userDetails, nameof(userDetails)); @@ -61,14 +61,14 @@ public NeonOrganizationPropertes(NeonMarketplaceDetails marketplaceDetails, Neon CompanyDetails = companyDetails; } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Marketplace details of the resource. /// Details of the user. /// Details of the company. /// Provisioning state of the resource. /// Organization properties. /// Keeps track of any properties unknown to the library. - internal NeonOrganizationPropertes(NeonMarketplaceDetails marketplaceDetails, NeonUserDetails userDetails, NeonCompanyDetails companyDetails, NeonResourceProvisioningState? provisioningState, PartnerOrganizationProperties partnerOrganizationProperties, IDictionary serializedAdditionalRawData) + internal NeonOrganizationProperties(NeonMarketplaceDetails marketplaceDetails, NeonUserDetails userDetails, NeonCompanyDetails companyDetails, NeonResourceProvisioningState? provisioningState, PartnerOrganizationProperties partnerOrganizationProperties, IDictionary serializedAdditionalRawData) { MarketplaceDetails = marketplaceDetails; UserDetails = userDetails; @@ -78,8 +78,8 @@ internal NeonOrganizationPropertes(NeonMarketplaceDetails marketplaceDetails, Ne _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal NeonOrganizationPropertes() + /// Initializes a new instance of for deserialization. + internal NeonOrganizationProperties() { } diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/NeonOrganizationData.Serialization.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/NeonOrganizationData.Serialization.cs index daeb5054bbab..d34c64ae651a 100644 --- a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/NeonOrganizationData.Serialization.cs +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/NeonOrganizationData.Serialization.cs @@ -64,7 +64,7 @@ internal static NeonOrganizationData DeserializeNeonOrganizationData(JsonElement { return null; } - NeonOrganizationPropertes properties = default; + NeonOrganizationProperties properties = default; IDictionary tags = default; AzureLocation location = default; ResourceIdentifier id = default; @@ -81,7 +81,7 @@ internal static NeonOrganizationData DeserializeNeonOrganizationData(JsonElement { continue; } - properties = NeonOrganizationPropertes.DeserializeNeonOrganizationPropertes(property.Value, options); + properties = NeonOrganizationProperties.DeserializeNeonOrganizationProperties(property.Value, options); continue; } if (property.NameEquals("tags"u8)) diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/NeonOrganizationData.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/NeonOrganizationData.cs index 5940b592ab19..3b1e0c48ce08 100644 --- a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/NeonOrganizationData.cs +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/src/Generated/NeonOrganizationData.cs @@ -66,7 +66,7 @@ public NeonOrganizationData(AzureLocation location) : base(location) /// The location. /// The resource-specific properties for this resource. /// Keeps track of any properties unknown to the library. - internal NeonOrganizationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, NeonOrganizationPropertes properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + internal NeonOrganizationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, NeonOrganizationProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; @@ -78,6 +78,6 @@ internal NeonOrganizationData() } /// The resource-specific properties for this resource. - public NeonOrganizationPropertes Properties { get; set; } + public NeonOrganizationProperties Properties { get; set; } } } diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/tsp-location.yaml b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/tsp-location.yaml index c99fb2413cc5..8cb8b06cac6c 100644 --- a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/tsp-location.yaml +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/tsp-location.yaml @@ -1,3 +1,3 @@ directory: specification/liftrneon/Neon.Postgres.Management -commit: f41341571ce7d957de8ad80928807cd518ed1014 +commit: 8e02612fe780d63dee33707f5ea189fec32ee36f repo: Azure/azure-rest-api-specs From ebfa1fa9cd5fa837d874bfe310a8639126824567 Mon Sep 17 00:00:00 2001 From: Arthur Ma Date: Mon, 18 Nov 2024 16:36:56 +0800 Subject: [PATCH 5/5] Update --- .../CHANGELOG.md | 2 - ...urceManager.NeonPostgres.netstandard2.0.cs | 254 ++++++++++++++++++ .../tsp-location.yaml | 2 +- 3 files changed, 255 insertions(+), 3 deletions(-) create mode 100644 sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/api/Azure.ResourceManager.NeonPostgres.netstandard2.0.cs diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/CHANGELOG.md b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/CHANGELOG.md index 9fb488d738c8..42f0da025e27 100644 --- a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/CHANGELOG.md +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/CHANGELOG.md @@ -2,8 +2,6 @@ ## 1.0.0-beta.1 (2024-11-22) - - ### Features Added This package follows the [new Azure SDK guidelines](https://azure.github.io/azure-sdk/general_introduction.html), and provides many core capabilities: diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/api/Azure.ResourceManager.NeonPostgres.netstandard2.0.cs b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/api/Azure.ResourceManager.NeonPostgres.netstandard2.0.cs new file mode 100644 index 000000000000..f6e35086e51c --- /dev/null +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/api/Azure.ResourceManager.NeonPostgres.netstandard2.0.cs @@ -0,0 +1,254 @@ +namespace Azure.ResourceManager.NeonPostgres +{ + public partial class NeonOrganizationCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected NeonOrganizationCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string organizationName, Azure.ResourceManager.NeonPostgres.NeonOrganizationData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string organizationName, Azure.ResourceManager.NeonPostgres.NeonOrganizationData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string organizationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string organizationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string organizationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string organizationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string organizationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string organizationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class NeonOrganizationData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public NeonOrganizationData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.NeonPostgres.Models.NeonOrganizationProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.NeonPostgres.NeonOrganizationData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.NeonPostgres.NeonOrganizationData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class NeonOrganizationResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected NeonOrganizationResource() { } + public virtual Azure.ResourceManager.NeonPostgres.NeonOrganizationData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public virtual Azure.Response AddTag(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> AddTagAsync(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string organizationName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.NeonPostgres.NeonOrganizationData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.NeonPostgres.NeonOrganizationData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.NeonPostgres.NeonOrganizationData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.NeonPostgres.NeonOrganizationData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public static partial class NeonPostgresExtensions + { + public static Azure.Response GetNeonOrganization(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string organizationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetNeonOrganizationAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string organizationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.NeonPostgres.NeonOrganizationResource GetNeonOrganizationResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.NeonPostgres.NeonOrganizationCollection GetNeonOrganizations(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetNeonOrganizations(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetNeonOrganizationsAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.NeonPostgres.Mocking +{ + public partial class MockableNeonPostgresArmClient : Azure.ResourceManager.ArmResource + { + protected MockableNeonPostgresArmClient() { } + public virtual Azure.ResourceManager.NeonPostgres.NeonOrganizationResource GetNeonOrganizationResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableNeonPostgresResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableNeonPostgresResourceGroupResource() { } + public virtual Azure.Response GetNeonOrganization(string organizationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetNeonOrganizationAsync(string organizationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.NeonPostgres.NeonOrganizationCollection GetNeonOrganizations() { throw null; } + } + public partial class MockableNeonPostgresSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableNeonPostgresSubscriptionResource() { } + public virtual Azure.Pageable GetNeonOrganizations(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetNeonOrganizationsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.NeonPostgres.Models +{ + public static partial class ArmNeonPostgresModelFactory + { + public static Azure.ResourceManager.NeonPostgres.NeonOrganizationData NeonOrganizationData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.NeonPostgres.Models.NeonOrganizationProperties properties = null) { throw null; } + public static Azure.ResourceManager.NeonPostgres.Models.NeonOrganizationProperties NeonOrganizationProperties(Azure.ResourceManager.NeonPostgres.Models.NeonMarketplaceDetails marketplaceDetails = null, Azure.ResourceManager.NeonPostgres.Models.NeonUserDetails userDetails = null, Azure.ResourceManager.NeonPostgres.Models.NeonCompanyDetails companyDetails = null, Azure.ResourceManager.NeonPostgres.Models.NeonResourceProvisioningState? provisioningState = default(Azure.ResourceManager.NeonPostgres.Models.NeonResourceProvisioningState?), Azure.ResourceManager.NeonPostgres.Models.PartnerOrganizationProperties partnerOrganizationProperties = null) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct MarketplaceSubscriptionStatus : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public MarketplaceSubscriptionStatus(string value) { throw null; } + public static Azure.ResourceManager.NeonPostgres.Models.MarketplaceSubscriptionStatus PendingFulfillmentStart { get { throw null; } } + public static Azure.ResourceManager.NeonPostgres.Models.MarketplaceSubscriptionStatus Subscribed { get { throw null; } } + public static Azure.ResourceManager.NeonPostgres.Models.MarketplaceSubscriptionStatus Suspended { get { throw null; } } + public static Azure.ResourceManager.NeonPostgres.Models.MarketplaceSubscriptionStatus Unsubscribed { get { throw null; } } + public bool Equals(Azure.ResourceManager.NeonPostgres.Models.MarketplaceSubscriptionStatus other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.NeonPostgres.Models.MarketplaceSubscriptionStatus left, Azure.ResourceManager.NeonPostgres.Models.MarketplaceSubscriptionStatus right) { throw null; } + public static implicit operator Azure.ResourceManager.NeonPostgres.Models.MarketplaceSubscriptionStatus (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.NeonPostgres.Models.MarketplaceSubscriptionStatus left, Azure.ResourceManager.NeonPostgres.Models.MarketplaceSubscriptionStatus right) { throw null; } + public override string ToString() { throw null; } + } + public partial class NeonCompanyDetails : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public NeonCompanyDetails() { } + public string BusinessPhone { get { throw null; } set { } } + public string CompanyName { get { throw null; } set { } } + public string Country { get { throw null; } set { } } + public string Domain { get { throw null; } set { } } + public long? NumberOfEmployees { get { throw null; } set { } } + public string OfficeAddress { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.NeonPostgres.Models.NeonCompanyDetails System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.NeonPostgres.Models.NeonCompanyDetails System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class NeonMarketplaceDetails : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public NeonMarketplaceDetails(Azure.ResourceManager.NeonPostgres.Models.NeonOfferDetails offerDetails) { } + public Azure.ResourceManager.NeonPostgres.Models.NeonOfferDetails OfferDetails { get { throw null; } set { } } + public string SubscriptionId { get { throw null; } set { } } + public Azure.ResourceManager.NeonPostgres.Models.MarketplaceSubscriptionStatus? SubscriptionStatus { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.NeonPostgres.Models.NeonMarketplaceDetails System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.NeonPostgres.Models.NeonMarketplaceDetails System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class NeonOfferDetails : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public NeonOfferDetails(string publisherId, string offerId, string planId) { } + public string OfferId { get { throw null; } set { } } + public string PlanId { get { throw null; } set { } } + public string PlanName { get { throw null; } set { } } + public string PublisherId { get { throw null; } set { } } + public string TermId { get { throw null; } set { } } + public string TermUnit { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.NeonPostgres.Models.NeonOfferDetails System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.NeonPostgres.Models.NeonOfferDetails System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class NeonOrganizationProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public NeonOrganizationProperties(Azure.ResourceManager.NeonPostgres.Models.NeonMarketplaceDetails marketplaceDetails, Azure.ResourceManager.NeonPostgres.Models.NeonUserDetails userDetails, Azure.ResourceManager.NeonPostgres.Models.NeonCompanyDetails companyDetails) { } + public Azure.ResourceManager.NeonPostgres.Models.NeonCompanyDetails CompanyDetails { get { throw null; } set { } } + public Azure.ResourceManager.NeonPostgres.Models.NeonMarketplaceDetails MarketplaceDetails { get { throw null; } set { } } + public Azure.ResourceManager.NeonPostgres.Models.PartnerOrganizationProperties PartnerOrganizationProperties { get { throw null; } set { } } + public Azure.ResourceManager.NeonPostgres.Models.NeonResourceProvisioningState? ProvisioningState { get { throw null; } } + public Azure.ResourceManager.NeonPostgres.Models.NeonUserDetails UserDetails { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.NeonPostgres.Models.NeonOrganizationProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.NeonPostgres.Models.NeonOrganizationProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct NeonResourceProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public NeonResourceProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.NeonPostgres.Models.NeonResourceProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.NeonPostgres.Models.NeonResourceProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.NeonPostgres.Models.NeonResourceProvisioningState Succeeded { get { throw null; } } + public bool Equals(Azure.ResourceManager.NeonPostgres.Models.NeonResourceProvisioningState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.NeonPostgres.Models.NeonResourceProvisioningState left, Azure.ResourceManager.NeonPostgres.Models.NeonResourceProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.NeonPostgres.Models.NeonResourceProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.NeonPostgres.Models.NeonResourceProvisioningState left, Azure.ResourceManager.NeonPostgres.Models.NeonResourceProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class NeonSingleSignOnProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public NeonSingleSignOnProperties() { } + public System.Collections.Generic.IList AadDomains { get { throw null; } } + public string EnterpriseAppId { get { throw null; } set { } } + public Azure.ResourceManager.NeonPostgres.Models.NeonSingleSignOnState? SingleSignOnState { get { throw null; } set { } } + public string SingleSignOnUri { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.NeonPostgres.Models.NeonSingleSignOnProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.NeonPostgres.Models.NeonSingleSignOnProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct NeonSingleSignOnState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public NeonSingleSignOnState(string value) { throw null; } + public static Azure.ResourceManager.NeonPostgres.Models.NeonSingleSignOnState Disable { get { throw null; } } + public static Azure.ResourceManager.NeonPostgres.Models.NeonSingleSignOnState Enable { get { throw null; } } + public static Azure.ResourceManager.NeonPostgres.Models.NeonSingleSignOnState Initial { get { throw null; } } + public bool Equals(Azure.ResourceManager.NeonPostgres.Models.NeonSingleSignOnState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.NeonPostgres.Models.NeonSingleSignOnState left, Azure.ResourceManager.NeonPostgres.Models.NeonSingleSignOnState right) { throw null; } + public static implicit operator Azure.ResourceManager.NeonPostgres.Models.NeonSingleSignOnState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.NeonPostgres.Models.NeonSingleSignOnState left, Azure.ResourceManager.NeonPostgres.Models.NeonSingleSignOnState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class NeonUserDetails : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public NeonUserDetails() { } + public string EmailAddress { get { throw null; } set { } } + public string FirstName { get { throw null; } set { } } + public string LastName { get { throw null; } set { } } + public string PhoneNumber { get { throw null; } set { } } + public string Upn { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.NeonPostgres.Models.NeonUserDetails System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.NeonPostgres.Models.NeonUserDetails System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class PartnerOrganizationProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public PartnerOrganizationProperties(string organizationName) { } + public string OrganizationId { get { throw null; } set { } } + public string OrganizationName { get { throw null; } set { } } + public Azure.ResourceManager.NeonPostgres.Models.NeonSingleSignOnProperties SingleSignOnProperties { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.NeonPostgres.Models.PartnerOrganizationProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.NeonPostgres.Models.PartnerOrganizationProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } +} diff --git a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/tsp-location.yaml b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/tsp-location.yaml index 8cb8b06cac6c..112c72e1daaf 100644 --- a/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/tsp-location.yaml +++ b/sdk/neonpostgres/Azure.ResourceManager.NeonPostgres/tsp-location.yaml @@ -1,3 +1,3 @@ directory: specification/liftrneon/Neon.Postgres.Management -commit: 8e02612fe780d63dee33707f5ea189fec32ee36f +commit: 297c3a012316e290e6a6ab737ec8944611554542 repo: Azure/azure-rest-api-specs