diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/Azure.ResourceManager.DatabaseFleetManager.sln b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/Azure.ResourceManager.DatabaseFleetManager.sln new file mode 100644 index 000000000000..fecd2294f9aa --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/Azure.ResourceManager.DatabaseFleetManager.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("{1AD596F6-F64F-497A-A3D6-A6B8AB08A680}") = "Azure.ResourceManager.DatabaseFleetManager", "src\Azure.ResourceManager.DatabaseFleetManager.csproj", "{848F28F3-DA60-4234-A348-872B4D46BDF2}" +EndProject +Project("{1AD596F6-F64F-497A-A3D6-A6B8AB08A680}") = "Azure.ResourceManager.DatabaseFleetManager.Tests", "tests\Azure.ResourceManager.DatabaseFleetManager.Tests.csproj", "{BAFD4CFA-48E6-4408-8054-0C62C3B2196D}" +EndProject +Project("{1AD596F6-F64F-497A-A3D6-A6B8AB08A680}") = "Azure.ResourceManager.DatabaseFleetManager.Samples", "samples\Azure.ResourceManager.DatabaseFleetManager.Samples.csproj", "{AB50CDAA-32F7-484A-A1B8-CAB0E95B8E33}" +EndProject +Global + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A6FFC348-C044-4BD3-BAA3-D3DFA56A5D85} + 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 + {848F28F3-DA60-4234-A348-872B4D46BDF2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {848F28F3-DA60-4234-A348-872B4D46BDF2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {848F28F3-DA60-4234-A348-872B4D46BDF2}.Debug|x64.ActiveCfg = Debug|Any CPU + {848F28F3-DA60-4234-A348-872B4D46BDF2}.Debug|x64.Build.0 = Debug|Any CPU + {848F28F3-DA60-4234-A348-872B4D46BDF2}.Debug|x86.ActiveCfg = Debug|Any CPU + {848F28F3-DA60-4234-A348-872B4D46BDF2}.Debug|x86.Build.0 = Debug|Any CPU + {848F28F3-DA60-4234-A348-872B4D46BDF2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {848F28F3-DA60-4234-A348-872B4D46BDF2}.Release|Any CPU.Build.0 = Release|Any CPU + {848F28F3-DA60-4234-A348-872B4D46BDF2}.Release|x64.ActiveCfg = Release|Any CPU + {848F28F3-DA60-4234-A348-872B4D46BDF2}.Release|x64.Build.0 = Release|Any CPU + {848F28F3-DA60-4234-A348-872B4D46BDF2}.Release|x86.ActiveCfg = Release|Any CPU + {848F28F3-DA60-4234-A348-872B4D46BDF2}.Release|x86.Build.0 = Release|Any CPU + {BAFD4CFA-48E6-4408-8054-0C62C3B2196D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BAFD4CFA-48E6-4408-8054-0C62C3B2196D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BAFD4CFA-48E6-4408-8054-0C62C3B2196D}.Debug|x64.ActiveCfg = Debug|Any CPU + {BAFD4CFA-48E6-4408-8054-0C62C3B2196D}.Debug|x64.Build.0 = Debug|Any CPU + {BAFD4CFA-48E6-4408-8054-0C62C3B2196D}.Debug|x86.ActiveCfg = Debug|Any CPU + {BAFD4CFA-48E6-4408-8054-0C62C3B2196D}.Debug|x86.Build.0 = Debug|Any CPU + {BAFD4CFA-48E6-4408-8054-0C62C3B2196D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BAFD4CFA-48E6-4408-8054-0C62C3B2196D}.Release|Any CPU.Build.0 = Release|Any CPU + {BAFD4CFA-48E6-4408-8054-0C62C3B2196D}.Release|x64.ActiveCfg = Release|Any CPU + {BAFD4CFA-48E6-4408-8054-0C62C3B2196D}.Release|x64.Build.0 = Release|Any CPU + {BAFD4CFA-48E6-4408-8054-0C62C3B2196D}.Release|x86.ActiveCfg = Release|Any CPU + {BAFD4CFA-48E6-4408-8054-0C62C3B2196D}.Release|x86.Build.0 = Release|Any CPU + {AB50CDAA-32F7-484A-A1B8-CAB0E95B8E33}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AB50CDAA-32F7-484A-A1B8-CAB0E95B8E33}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AB50CDAA-32F7-484A-A1B8-CAB0E95B8E33}.Debug|x64.ActiveCfg = Debug|Any CPU + {AB50CDAA-32F7-484A-A1B8-CAB0E95B8E33}.Debug|x64.Build.0 = Debug|Any CPU + {AB50CDAA-32F7-484A-A1B8-CAB0E95B8E33}.Debug|x86.ActiveCfg = Debug|Any CPU + {AB50CDAA-32F7-484A-A1B8-CAB0E95B8E33}.Debug|x86.Build.0 = Debug|Any CPU + {AB50CDAA-32F7-484A-A1B8-CAB0E95B8E33}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AB50CDAA-32F7-484A-A1B8-CAB0E95B8E33}.Release|Any CPU.Build.0 = Release|Any CPU + {AB50CDAA-32F7-484A-A1B8-CAB0E95B8E33}.Release|x64.ActiveCfg = Release|Any CPU + {AB50CDAA-32F7-484A-A1B8-CAB0E95B8E33}.Release|x64.Build.0 = Release|Any CPU + {AB50CDAA-32F7-484A-A1B8-CAB0E95B8E33}.Release|x86.ActiveCfg = Release|Any CPU + {AB50CDAA-32F7-484A-A1B8-CAB0E95B8E33}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/CHANGELOG.md b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/CHANGELOG.md new file mode 100644 index 000000000000..d96467959e81 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/CHANGELOG.md @@ -0,0 +1,17 @@ +# Release History + +## 1.0.0-beta.1 (2023-09-26) + +### General New Features + +This package follows the [new Azure SDK guidelines](https://azure.github.io/azure-sdk/general_introduction.html), and provides many core capabilities: + + - Support MSAL.NET, Azure.Identity is out of box for supporting MSAL.NET. + - Support [OpenTelemetry](https://opentelemetry.io/) for distributed tracing. + - HTTP pipeline with custom policies. + - Better error-handling. + - Support uniform telemetry across all languages. + +This package is a Public Preview version, so expect incompatible changes in subsequent releases as we improve the product. To provide feedback, submit an issue in our [Azure SDK for .NET GitHub repo](https://github.com/Azure/azure-sdk-for-net/issues). + +> NOTE: For more information about unified authentication, please refer to [Microsoft Azure Identity documentation for .NET](https://docs.microsoft.com//dotnet/api/overview/azure/identity-readme?view=azure-dotnet). \ No newline at end of file diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/Directory.Build.props b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/Directory.Build.props new file mode 100644 index 000000000000..1a9611bd4924 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/Directory.Build.props @@ -0,0 +1,6 @@ + + + + diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/README.md b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/README.md new file mode 100644 index 000000000000..36589e5302a9 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/README.md @@ -0,0 +1,80 @@ +# Microsoft Azure Database Fleet Manager management client library for .NET + +Azure Database Fleet Manager empowers Azure SQL customers who have adopted database scale-out to achieve more by simplifying implementation and operation. + +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 Fleet management library for .NET with [NuGet](https://www.nuget.org/): + +```dotnetcli +dotnet add package Azure.ResourceManager.DatabaseFleetManager --prerelease +``` + +### Prerequisites + +* You must have an [Microsoft Azure subscription](https://azure.microsoft.com/free/dotnet/). + +### Authenticate the Client + +To create an authenticated client and start interacting with Microsoft Azure resources, see the [quickstart guide here](https://github.com/Azure/azure-sdk-for-net/blob/main/doc/dev/mgmt_quickstart.md). + +## Key concepts + +Key concepts of the Microsoft Azure SDK for .NET can be found [here](https://azure.github.io/azure-sdk/dotnet_introduction.html) + +## Documentation + +Documentation is available to help you learn how to use this package: + +- [Quickstart](https://github.com/Azure/azure-sdk-for-net/blob/main/doc/dev/mgmt_quickstart.md). +- [API References](https://docs.microsoft.com/dotnet/api/?view=azure-dotnet). +- [Authentication](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/identity/Azure.Identity/README.md). + +## Examples + +Code samples for using the management library for .NET can be found in the following locations +- [.NET Management Library Code Samples](https://aka.ms/azuresdk-net-mgmt-samples) + +## Troubleshooting + +- File an issue via [GitHub Issues](https://github.com/Azure/azure-sdk-for-net/issues). +- Check [previous questions](https://stackoverflow.com/questions/tagged/azure+.net) or ask new ones on Stack Overflow using Azure and .NET tags. + +## Next steps + +For more information about Microsoft Azure SDK, see [this website](https://azure.github.io/azure-sdk/). + +## Contributing + +For details on contributing to this repository, see the [contributing +guide][cg]. + +This project welcomes contributions and suggestions. Most contributions +require you to agree to a Contributor License Agreement (CLA) declaring +that you have the right to, and actually do, grant us the rights to use +your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine +whether you need to provide a CLA and decorate the PR appropriately +(for example, label, comment). Follow the instructions provided by the +bot. You'll only need to do this action once across all repositories +using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For +more information, see the [Code of Conduct FAQ][coc_faq] or contact + with any other questions or comments. + + +[cg]: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/resourcemanager/Azure.ResourceManager/docs/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ \ No newline at end of file diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/api/Azure.ResourceManager.DatabaseFleetManager.netstandard2.0.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/api/Azure.ResourceManager.DatabaseFleetManager.netstandard2.0.cs new file mode 100644 index 000000000000..a31cbdfb9281 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/api/Azure.ResourceManager.DatabaseFleetManager.netstandard2.0.cs @@ -0,0 +1,403 @@ +namespace Azure.ResourceManager.DatabaseFleetManager +{ + public partial class DatabaseFleetCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DatabaseFleetCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string fleetName, Azure.ResourceManager.DatabaseFleetManager.DatabaseFleetData data, string ifMatch = null, string ifNoneMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string fleetName, Azure.ResourceManager.DatabaseFleetManager.DatabaseFleetData data, string ifMatch = null, string ifNoneMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string fleetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string fleetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string fleetName, 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 fleetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string fleetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string fleetName, 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 DatabaseFleetData : Azure.ResourceManager.Models.TrackedResourceData + { + public DatabaseFleetData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public Azure.ETag? ETag { get { throw null; } } + public Azure.ResourceManager.DatabaseFleetManager.Models.FleetHubProfile HubProfile { get { throw null; } set { } } + public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } + public Azure.ResourceManager.DatabaseFleetManager.Models.FleetProvisioningState? ProvisioningState { get { throw null; } } + } + public static partial class DatabaseFleetManagerExtensions + { + public static Azure.Response GetDatabaseFleet(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string fleetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetDatabaseFleetAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string fleetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.DatabaseFleetManager.DatabaseFleetMemberResource GetDatabaseFleetMemberResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.DatabaseFleetManager.DatabaseFleetResource GetDatabaseFleetResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.DatabaseFleetManager.DatabaseFleetCollection GetDatabaseFleets(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetDatabaseFleets(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetDatabaseFleetsAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.DatabaseFleetManager.DatabaseFleetUpdateRunResource GetDatabaseFleetUpdateRunResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class DatabaseFleetMemberCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DatabaseFleetMemberCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string fleetMemberName, Azure.ResourceManager.DatabaseFleetManager.DatabaseFleetMemberData data, string ifMatch = null, string ifNoneMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string fleetMemberName, Azure.ResourceManager.DatabaseFleetManager.DatabaseFleetMemberData data, string ifMatch = null, string ifNoneMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string fleetMemberName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string fleetMemberName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string fleetMemberName, 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 fleetMemberName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string fleetMemberName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string fleetMemberName, 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 DatabaseFleetMemberData : Azure.ResourceManager.Models.ResourceData + { + public DatabaseFleetMemberData() { } + public Azure.Core.ResourceIdentifier ClusterResourceId { get { throw null; } set { } } + public Azure.ETag? ETag { get { throw null; } } + public string Group { get { throw null; } set { } } + public Azure.ResourceManager.DatabaseFleetManager.Models.FleetMemberProvisioningState? ProvisioningState { get { throw null; } } + } + public partial class DatabaseFleetMemberResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DatabaseFleetMemberResource() { } + public virtual Azure.ResourceManager.DatabaseFleetManager.DatabaseFleetMemberData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string fleetName, string fleetMemberName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, string ifMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, string ifMatch = null, 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.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.DatabaseFleetManager.Models.DatabaseFleetMemberPatch patch, string ifMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DatabaseFleetManager.Models.DatabaseFleetMemberPatch patch, string ifMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DatabaseFleetResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DatabaseFleetResource() { } + public virtual Azure.ResourceManager.DatabaseFleetManager.DatabaseFleetData 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 fleetName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, string ifMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, string ifMatch = null, 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 GetCredentials(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetCredentialsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetDatabaseFleetMember(string fleetMemberName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDatabaseFleetMemberAsync(string fleetMemberName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DatabaseFleetManager.DatabaseFleetMemberCollection GetDatabaseFleetMembers() { throw null; } + public virtual Azure.Response GetDatabaseFleetUpdateRun(string updateRunName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDatabaseFleetUpdateRunAsync(string updateRunName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DatabaseFleetManager.DatabaseFleetUpdateRunCollection GetDatabaseFleetUpdateRuns() { throw null; } + public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.DatabaseFleetManager.Models.DatabaseFleetPatch patch, string ifMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DatabaseFleetManager.Models.DatabaseFleetPatch patch, string ifMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DatabaseFleetUpdateRunCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DatabaseFleetUpdateRunCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string updateRunName, Azure.ResourceManager.DatabaseFleetManager.DatabaseFleetUpdateRunData data, string ifMatch = null, string ifNoneMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string updateRunName, Azure.ResourceManager.DatabaseFleetManager.DatabaseFleetUpdateRunData data, string ifMatch = null, string ifNoneMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string updateRunName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string updateRunName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string updateRunName, 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 updateRunName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string updateRunName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string updateRunName, 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 DatabaseFleetUpdateRunData : Azure.ResourceManager.Models.ResourceData + { + public DatabaseFleetUpdateRunData() { } + public Azure.ETag? ETag { get { throw null; } } + public Azure.ResourceManager.DatabaseFleetManager.Models.FleetManagedClusterUpdate ManagedClusterUpdate { get { throw null; } set { } } + public Azure.ResourceManager.DatabaseFleetManager.Models.FleetUpdateRunProvisioningState? ProvisioningState { get { throw null; } } + public Azure.ResourceManager.DatabaseFleetManager.Models.FleetUpdateRunStatus Status { get { throw null; } } + public System.Collections.Generic.IList StrategyStages { get { throw null; } set { } } + } + public partial class DatabaseFleetUpdateRunResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DatabaseFleetUpdateRunResource() { } + public virtual Azure.ResourceManager.DatabaseFleetManager.DatabaseFleetUpdateRunData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string fleetName, string updateRunName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, string ifMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, string ifMatch = null, 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.ResourceManager.ArmOperation Start(Azure.WaitUntil waitUntil, string ifMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> StartAsync(Azure.WaitUntil waitUntil, string ifMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Stop(Azure.WaitUntil waitUntil, string ifMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> StopAsync(Azure.WaitUntil waitUntil, string ifMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.DatabaseFleetManager.DatabaseFleetUpdateRunData data, string ifMatch = null, string ifNoneMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DatabaseFleetManager.DatabaseFleetUpdateRunData data, string ifMatch = null, string ifNoneMatch = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + public static partial class ArmDatabaseFleetManagerModelFactory + { + public static Azure.ResourceManager.DatabaseFleetManager.DatabaseFleetData DatabaseFleetData(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.ETag? eTag = default(Azure.ETag?), Azure.ResourceManager.Models.ManagedServiceIdentity identity = null, Azure.ResourceManager.DatabaseFleetManager.Models.FleetProvisioningState? provisioningState = default(Azure.ResourceManager.DatabaseFleetManager.Models.FleetProvisioningState?), Azure.ResourceManager.DatabaseFleetManager.Models.FleetHubProfile hubProfile = null) { throw null; } + public static Azure.ResourceManager.DatabaseFleetManager.DatabaseFleetMemberData DatabaseFleetMemberData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ETag? eTag = default(Azure.ETag?), Azure.Core.ResourceIdentifier clusterResourceId = null, string group = null, Azure.ResourceManager.DatabaseFleetManager.Models.FleetMemberProvisioningState? provisioningState = default(Azure.ResourceManager.DatabaseFleetManager.Models.FleetMemberProvisioningState?)) { throw null; } + public static Azure.ResourceManager.DatabaseFleetManager.DatabaseFleetUpdateRunData DatabaseFleetUpdateRunData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ETag? eTag = default(Azure.ETag?), Azure.ResourceManager.DatabaseFleetManager.Models.FleetUpdateRunProvisioningState? provisioningState = default(Azure.ResourceManager.DatabaseFleetManager.Models.FleetUpdateRunProvisioningState?), System.Collections.Generic.IEnumerable strategyStages = null, Azure.ResourceManager.DatabaseFleetManager.Models.FleetManagedClusterUpdate managedClusterUpdate = null, Azure.ResourceManager.DatabaseFleetManager.Models.FleetUpdateRunStatus status = null) { throw null; } + public static Azure.ResourceManager.DatabaseFleetManager.Models.FleetCredentialResult FleetCredentialResult(string name = null, byte[] value = null) { throw null; } + public static Azure.ResourceManager.DatabaseFleetManager.Models.FleetCredentialResults FleetCredentialResults(System.Collections.Generic.IEnumerable kubeconfigs = null) { throw null; } + public static Azure.ResourceManager.DatabaseFleetManager.Models.FleetHubProfile FleetHubProfile(string dnsPrefix = null, Azure.ResourceManager.DatabaseFleetManager.Models.FleetApiServerAccessProfile apiServerAccessProfile = null, Azure.Core.ResourceIdentifier agentSubnetId = null, string fqdn = null, string kubernetesVersion = null) { throw null; } + public static Azure.ResourceManager.DatabaseFleetManager.Models.FleetUpdateGroupStatus FleetUpdateGroupStatus(Azure.ResourceManager.DatabaseFleetManager.Models.FleetUpdateOperationStatus status = null, string name = null, System.Collections.Generic.IEnumerable members = null) { throw null; } + public static Azure.ResourceManager.DatabaseFleetManager.Models.FleetUpdateOperationStatus FleetUpdateOperationStatus(System.DateTimeOffset? startOn = default(System.DateTimeOffset?), System.DateTimeOffset? completedOn = default(System.DateTimeOffset?), Azure.ResourceManager.DatabaseFleetManager.Models.FleetUpdateState? state = default(Azure.ResourceManager.DatabaseFleetManager.Models.FleetUpdateState?), Azure.ResponseError error = null) { throw null; } + public static Azure.ResourceManager.DatabaseFleetManager.Models.FleetUpdateRunStatus FleetUpdateRunStatus(Azure.ResourceManager.DatabaseFleetManager.Models.FleetUpdateOperationStatus status = null, System.Collections.Generic.IEnumerable stages = null, System.Collections.Generic.IEnumerable selectedNodeImageVersions = null) { throw null; } + public static Azure.ResourceManager.DatabaseFleetManager.Models.FleetUpdateStageStatus FleetUpdateStageStatus(Azure.ResourceManager.DatabaseFleetManager.Models.FleetUpdateOperationStatus status = null, string name = null, System.Collections.Generic.IEnumerable groups = null, Azure.ResourceManager.DatabaseFleetManager.Models.FleetWaitStatus afterStageWaitStatus = null) { throw null; } + public static Azure.ResourceManager.DatabaseFleetManager.Models.FleetWaitStatus FleetWaitStatus(Azure.ResourceManager.DatabaseFleetManager.Models.FleetUpdateOperationStatus status = null, int? waitDurationInSeconds = default(int?)) { throw null; } + public static Azure.ResourceManager.DatabaseFleetManager.Models.MemberUpdateStatus MemberUpdateStatus(Azure.ResourceManager.DatabaseFleetManager.Models.FleetUpdateOperationStatus status = null, string name = null, Azure.Core.ResourceIdentifier clusterResourceId = null, string operationId = null, string message = null) { throw null; } + public static Azure.ResourceManager.DatabaseFleetManager.Models.NodeImageVersion NodeImageVersion(string version = null) { throw null; } + } + public partial class DatabaseFleetMemberPatch + { + public DatabaseFleetMemberPatch() { } + public string Group { get { throw null; } set { } } + } + public partial class DatabaseFleetPatch + { + public DatabaseFleetPatch() { } + public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + } + public partial class FleetApiServerAccessProfile + { + public FleetApiServerAccessProfile() { } + public bool? EnablePrivateCluster { get { throw null; } set { } } + public bool? EnableVnetIntegration { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier SubnetId { get { throw null; } set { } } + } + public partial class FleetCredentialResult + { + internal FleetCredentialResult() { } + public string Name { get { throw null; } } + public byte[] Value { get { throw null; } } + } + public partial class FleetCredentialResults + { + internal FleetCredentialResults() { } + public System.Collections.Generic.IReadOnlyList Kubeconfigs { get { throw null; } } + } + public partial class FleetHubProfile + { + public FleetHubProfile() { } + public Azure.Core.ResourceIdentifier AgentSubnetId { get { throw null; } set { } } + public Azure.ResourceManager.DatabaseFleetManager.Models.FleetApiServerAccessProfile ApiServerAccessProfile { get { throw null; } set { } } + public string DnsPrefix { get { throw null; } set { } } + public string Fqdn { get { throw null; } } + public string KubernetesVersion { get { throw null; } } + } + public partial class FleetManagedClusterUpdate + { + public FleetManagedClusterUpdate(Azure.ResourceManager.DatabaseFleetManager.Models.FleetManagedClusterUpgradeSpec upgrade) { } + public Azure.ResourceManager.DatabaseFleetManager.Models.NodeImageSelectionType? SelectionType { get { throw null; } set { } } + public Azure.ResourceManager.DatabaseFleetManager.Models.FleetManagedClusterUpgradeSpec Upgrade { get { throw null; } set { } } + } + public partial class FleetManagedClusterUpgradeSpec + { + public FleetManagedClusterUpgradeSpec(Azure.ResourceManager.DatabaseFleetManager.Models.FleetManagedClusterUpgradeType upgradeType) { } + public string KubernetesVersion { get { throw null; } set { } } + public Azure.ResourceManager.DatabaseFleetManager.Models.FleetManagedClusterUpgradeType UpgradeType { get { throw null; } set { } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct FleetManagedClusterUpgradeType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public FleetManagedClusterUpgradeType(string value) { throw null; } + public static Azure.ResourceManager.DatabaseFleetManager.Models.FleetManagedClusterUpgradeType Full { get { throw null; } } + public static Azure.ResourceManager.DatabaseFleetManager.Models.FleetManagedClusterUpgradeType NodeImageOnly { get { throw null; } } + public bool Equals(Azure.ResourceManager.DatabaseFleetManager.Models.FleetManagedClusterUpgradeType 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.DatabaseFleetManager.Models.FleetManagedClusterUpgradeType left, Azure.ResourceManager.DatabaseFleetManager.Models.FleetManagedClusterUpgradeType right) { throw null; } + public static implicit operator Azure.ResourceManager.DatabaseFleetManager.Models.FleetManagedClusterUpgradeType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DatabaseFleetManager.Models.FleetManagedClusterUpgradeType left, Azure.ResourceManager.DatabaseFleetManager.Models.FleetManagedClusterUpgradeType right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct FleetMemberProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public FleetMemberProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.DatabaseFleetManager.Models.FleetMemberProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.DatabaseFleetManager.Models.FleetMemberProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.DatabaseFleetManager.Models.FleetMemberProvisioningState Joining { get { throw null; } } + public static Azure.ResourceManager.DatabaseFleetManager.Models.FleetMemberProvisioningState Leaving { get { throw null; } } + public static Azure.ResourceManager.DatabaseFleetManager.Models.FleetMemberProvisioningState Succeeded { get { throw null; } } + public static Azure.ResourceManager.DatabaseFleetManager.Models.FleetMemberProvisioningState Updating { get { throw null; } } + public bool Equals(Azure.ResourceManager.DatabaseFleetManager.Models.FleetMemberProvisioningState 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.DatabaseFleetManager.Models.FleetMemberProvisioningState left, Azure.ResourceManager.DatabaseFleetManager.Models.FleetMemberProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.DatabaseFleetManager.Models.FleetMemberProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DatabaseFleetManager.Models.FleetMemberProvisioningState left, Azure.ResourceManager.DatabaseFleetManager.Models.FleetMemberProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct FleetProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public FleetProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.DatabaseFleetManager.Models.FleetProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.DatabaseFleetManager.Models.FleetProvisioningState Creating { get { throw null; } } + public static Azure.ResourceManager.DatabaseFleetManager.Models.FleetProvisioningState Deleting { get { throw null; } } + public static Azure.ResourceManager.DatabaseFleetManager.Models.FleetProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.DatabaseFleetManager.Models.FleetProvisioningState Succeeded { get { throw null; } } + public static Azure.ResourceManager.DatabaseFleetManager.Models.FleetProvisioningState Updating { get { throw null; } } + public bool Equals(Azure.ResourceManager.DatabaseFleetManager.Models.FleetProvisioningState 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.DatabaseFleetManager.Models.FleetProvisioningState left, Azure.ResourceManager.DatabaseFleetManager.Models.FleetProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.DatabaseFleetManager.Models.FleetProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DatabaseFleetManager.Models.FleetProvisioningState left, Azure.ResourceManager.DatabaseFleetManager.Models.FleetProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class FleetUpdateGroup + { + public FleetUpdateGroup(string name) { } + public string Name { get { throw null; } set { } } + } + public partial class FleetUpdateGroupStatus + { + internal FleetUpdateGroupStatus() { } + public System.Collections.Generic.IReadOnlyList Members { get { throw null; } } + public string Name { get { throw null; } } + public Azure.ResourceManager.DatabaseFleetManager.Models.FleetUpdateOperationStatus Status { get { throw null; } } + } + public partial class FleetUpdateOperationStatus + { + internal FleetUpdateOperationStatus() { } + public System.DateTimeOffset? CompletedOn { get { throw null; } } + public Azure.ResponseError Error { get { throw null; } } + public System.DateTimeOffset? StartOn { get { throw null; } } + public Azure.ResourceManager.DatabaseFleetManager.Models.FleetUpdateState? State { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct FleetUpdateRunProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public FleetUpdateRunProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.DatabaseFleetManager.Models.FleetUpdateRunProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.DatabaseFleetManager.Models.FleetUpdateRunProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.DatabaseFleetManager.Models.FleetUpdateRunProvisioningState Succeeded { get { throw null; } } + public bool Equals(Azure.ResourceManager.DatabaseFleetManager.Models.FleetUpdateRunProvisioningState 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.DatabaseFleetManager.Models.FleetUpdateRunProvisioningState left, Azure.ResourceManager.DatabaseFleetManager.Models.FleetUpdateRunProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.DatabaseFleetManager.Models.FleetUpdateRunProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DatabaseFleetManager.Models.FleetUpdateRunProvisioningState left, Azure.ResourceManager.DatabaseFleetManager.Models.FleetUpdateRunProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class FleetUpdateRunStatus + { + internal FleetUpdateRunStatus() { } + public System.Collections.Generic.IReadOnlyList SelectedNodeImageVersions { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Stages { get { throw null; } } + public Azure.ResourceManager.DatabaseFleetManager.Models.FleetUpdateOperationStatus Status { get { throw null; } } + } + public partial class FleetUpdateStage + { + public FleetUpdateStage(string name) { } + public int? AfterStageWaitInSeconds { get { throw null; } set { } } + public System.Collections.Generic.IList Groups { get { throw null; } } + public string Name { get { throw null; } set { } } + } + public partial class FleetUpdateStageStatus + { + internal FleetUpdateStageStatus() { } + public Azure.ResourceManager.DatabaseFleetManager.Models.FleetWaitStatus AfterStageWaitStatus { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Groups { get { throw null; } } + public string Name { get { throw null; } } + public Azure.ResourceManager.DatabaseFleetManager.Models.FleetUpdateOperationStatus Status { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct FleetUpdateState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public FleetUpdateState(string value) { throw null; } + public static Azure.ResourceManager.DatabaseFleetManager.Models.FleetUpdateState Completed { get { throw null; } } + public static Azure.ResourceManager.DatabaseFleetManager.Models.FleetUpdateState Failed { get { throw null; } } + public static Azure.ResourceManager.DatabaseFleetManager.Models.FleetUpdateState NotStarted { get { throw null; } } + public static Azure.ResourceManager.DatabaseFleetManager.Models.FleetUpdateState Running { get { throw null; } } + public static Azure.ResourceManager.DatabaseFleetManager.Models.FleetUpdateState Skipped { get { throw null; } } + public static Azure.ResourceManager.DatabaseFleetManager.Models.FleetUpdateState Stopped { get { throw null; } } + public static Azure.ResourceManager.DatabaseFleetManager.Models.FleetUpdateState Stopping { get { throw null; } } + public bool Equals(Azure.ResourceManager.DatabaseFleetManager.Models.FleetUpdateState 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.DatabaseFleetManager.Models.FleetUpdateState left, Azure.ResourceManager.DatabaseFleetManager.Models.FleetUpdateState right) { throw null; } + public static implicit operator Azure.ResourceManager.DatabaseFleetManager.Models.FleetUpdateState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DatabaseFleetManager.Models.FleetUpdateState left, Azure.ResourceManager.DatabaseFleetManager.Models.FleetUpdateState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class FleetWaitStatus + { + internal FleetWaitStatus() { } + public Azure.ResourceManager.DatabaseFleetManager.Models.FleetUpdateOperationStatus Status { get { throw null; } } + public int? WaitDurationInSeconds { get { throw null; } } + } + public partial class MemberUpdateStatus + { + internal MemberUpdateStatus() { } + public Azure.Core.ResourceIdentifier ClusterResourceId { get { throw null; } } + public string Message { get { throw null; } } + public string Name { get { throw null; } } + public string OperationId { get { throw null; } } + public Azure.ResourceManager.DatabaseFleetManager.Models.FleetUpdateOperationStatus Status { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct NodeImageSelectionType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public NodeImageSelectionType(string value) { throw null; } + public static Azure.ResourceManager.DatabaseFleetManager.Models.NodeImageSelectionType Consistent { get { throw null; } } + public static Azure.ResourceManager.DatabaseFleetManager.Models.NodeImageSelectionType Latest { get { throw null; } } + public bool Equals(Azure.ResourceManager.DatabaseFleetManager.Models.NodeImageSelectionType 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.DatabaseFleetManager.Models.NodeImageSelectionType left, Azure.ResourceManager.DatabaseFleetManager.Models.NodeImageSelectionType right) { throw null; } + public static implicit operator Azure.ResourceManager.DatabaseFleetManager.Models.NodeImageSelectionType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DatabaseFleetManager.Models.NodeImageSelectionType left, Azure.ResourceManager.DatabaseFleetManager.Models.NodeImageSelectionType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class NodeImageVersion + { + internal NodeImageVersion() { } + public string Version { get { throw null; } } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/assets.json b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/assets.json new file mode 100644 index 000000000000..bdd6dca027d4 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/assets.json @@ -0,0 +1,6 @@ +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "net", + "TagPrefix": "net//Azure.ResourceManager.DatabaseFleetManager", + "Tag": "" +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/samples/Azure.ResourceManager.DatabaseFleetManager.Samples.csproj b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/samples/Azure.ResourceManager.DatabaseFleetManager.Samples.csproj new file mode 100644 index 000000000000..fcd626b89d42 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/samples/Azure.ResourceManager.DatabaseFleetManager.Samples.csproj @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/samples/Generated/Samples/Sample_DatabaseFleetCollection.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/samples/Generated/Samples/Sample_DatabaseFleetCollection.cs new file mode 100644 index 000000000000..a8b25c48a370 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/samples/Generated/Samples/Sample_DatabaseFleetCollection.cs @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.DatabaseFleetManager; +using Azure.ResourceManager.DatabaseFleetManager.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.DatabaseFleetManager.Samples +{ + public partial class Sample_DatabaseFleetCollection + { + // Lists the Fleet resources in a resource group. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListsTheFleetResourcesInAResourceGroup() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/Fleets_ListByResourceGroup.json + // this example is just showing the usage of "Fleets_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid1"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DatabaseFleetResource + DatabaseFleetCollection collection = resourceGroupResource.GetDatabaseFleets(); + + // invoke the operation and iterate over the result + await foreach (DatabaseFleetResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DatabaseFleetData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Gets a Fleet resource. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetsAFleetResource() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/Fleets_Get.json + // this example is just showing the usage of "Fleets_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid1"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DatabaseFleetResource + DatabaseFleetCollection collection = resourceGroupResource.GetDatabaseFleets(); + + // invoke the operation + string fleetName = "fleet1"; + DatabaseFleetResource result = await collection.GetAsync(fleetName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DatabaseFleetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Gets a Fleet resource. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetsAFleetResource() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/Fleets_Get.json + // this example is just showing the usage of "Fleets_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid1"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DatabaseFleetResource + DatabaseFleetCollection collection = resourceGroupResource.GetDatabaseFleets(); + + // invoke the operation + string fleetName = "fleet1"; + bool result = await collection.ExistsAsync(fleetName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Gets a Fleet resource. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsAFleetResource() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/Fleets_Get.json + // this example is just showing the usage of "Fleets_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid1"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DatabaseFleetResource + DatabaseFleetCollection collection = resourceGroupResource.GetDatabaseFleets(); + + // invoke the operation + string fleetName = "fleet1"; + NullableResponse response = await collection.GetIfExistsAsync(fleetName); + DatabaseFleetResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DatabaseFleetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // Creates a Fleet resource with a long running operation. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreatesAFleetResourceWithALongRunningOperation() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/Fleets_CreateOrUpdate.json + // this example is just showing the usage of "Fleets_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "subid1"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DatabaseFleetResource + DatabaseFleetCollection collection = resourceGroupResource.GetDatabaseFleets(); + + // invoke the operation + string fleetName = "fleet1"; + DatabaseFleetData data = new DatabaseFleetData(new AzureLocation("East US")) + { + HubProfile = new FleetHubProfile() + { + DnsPrefix = "dnsprefix1", + }, + Tags = +{ +["archv2"] = "", +["tier"] = "production", +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, fleetName, data); + DatabaseFleetResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DatabaseFleetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/samples/Generated/Samples/Sample_DatabaseFleetMemberCollection.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/samples/Generated/Samples/Sample_DatabaseFleetMemberCollection.cs new file mode 100644 index 000000000000..969d9d7ac673 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/samples/Generated/Samples/Sample_DatabaseFleetMemberCollection.cs @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.DatabaseFleetManager; + +namespace Azure.ResourceManager.DatabaseFleetManager.Samples +{ + public partial class Sample_DatabaseFleetMemberCollection + { + // Lists the members of a Fleet. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListsTheMembersOfAFleet() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/FleetMembers_ListByFleet.json + // this example is just showing the usage of "FleetMembers_ListByFleet" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DatabaseFleetResource created on azure + // for more information of creating DatabaseFleetResource, please refer to the document of DatabaseFleetResource + string subscriptionId = "subid1"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + ResourceIdentifier databaseFleetResourceId = DatabaseFleetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName); + DatabaseFleetResource databaseFleet = client.GetDatabaseFleetResource(databaseFleetResourceId); + + // get the collection of this DatabaseFleetMemberResource + DatabaseFleetMemberCollection collection = databaseFleet.GetDatabaseFleetMembers(); + + // invoke the operation and iterate over the result + await foreach (DatabaseFleetMemberResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DatabaseFleetMemberData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Gets a FleetMember resource. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetsAFleetMemberResource() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/FleetMembers_Get.json + // this example is just showing the usage of "FleetMembers_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DatabaseFleetResource created on azure + // for more information of creating DatabaseFleetResource, please refer to the document of DatabaseFleetResource + string subscriptionId = "subid1"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + ResourceIdentifier databaseFleetResourceId = DatabaseFleetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName); + DatabaseFleetResource databaseFleet = client.GetDatabaseFleetResource(databaseFleetResourceId); + + // get the collection of this DatabaseFleetMemberResource + DatabaseFleetMemberCollection collection = databaseFleet.GetDatabaseFleetMembers(); + + // invoke the operation + string fleetMemberName = "member-1"; + DatabaseFleetMemberResource result = await collection.GetAsync(fleetMemberName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DatabaseFleetMemberData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Gets a FleetMember resource. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetsAFleetMemberResource() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/FleetMembers_Get.json + // this example is just showing the usage of "FleetMembers_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DatabaseFleetResource created on azure + // for more information of creating DatabaseFleetResource, please refer to the document of DatabaseFleetResource + string subscriptionId = "subid1"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + ResourceIdentifier databaseFleetResourceId = DatabaseFleetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName); + DatabaseFleetResource databaseFleet = client.GetDatabaseFleetResource(databaseFleetResourceId); + + // get the collection of this DatabaseFleetMemberResource + DatabaseFleetMemberCollection collection = databaseFleet.GetDatabaseFleetMembers(); + + // invoke the operation + string fleetMemberName = "member-1"; + bool result = await collection.ExistsAsync(fleetMemberName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Gets a FleetMember resource. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsAFleetMemberResource() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/FleetMembers_Get.json + // this example is just showing the usage of "FleetMembers_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DatabaseFleetResource created on azure + // for more information of creating DatabaseFleetResource, please refer to the document of DatabaseFleetResource + string subscriptionId = "subid1"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + ResourceIdentifier databaseFleetResourceId = DatabaseFleetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName); + DatabaseFleetResource databaseFleet = client.GetDatabaseFleetResource(databaseFleetResourceId); + + // get the collection of this DatabaseFleetMemberResource + DatabaseFleetMemberCollection collection = databaseFleet.GetDatabaseFleetMembers(); + + // invoke the operation + string fleetMemberName = "member-1"; + NullableResponse response = await collection.GetIfExistsAsync(fleetMemberName); + DatabaseFleetMemberResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DatabaseFleetMemberData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // Creates a FleetMember resource with a long running operation. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreatesAFleetMemberResourceWithALongRunningOperation() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/FleetMembers_Create.json + // this example is just showing the usage of "FleetMembers_Create" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DatabaseFleetResource created on azure + // for more information of creating DatabaseFleetResource, please refer to the document of DatabaseFleetResource + string subscriptionId = "subid1"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + ResourceIdentifier databaseFleetResourceId = DatabaseFleetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName); + DatabaseFleetResource databaseFleet = client.GetDatabaseFleetResource(databaseFleetResourceId); + + // get the collection of this DatabaseFleetMemberResource + DatabaseFleetMemberCollection collection = databaseFleet.GetDatabaseFleetMembers(); + + // invoke the operation + string fleetMemberName = "member-1"; + DatabaseFleetMemberData data = new DatabaseFleetMemberData() + { + ClusterResourceId = new ResourceIdentifier("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/cluster-1"), + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, fleetMemberName, data); + DatabaseFleetMemberResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DatabaseFleetMemberData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/samples/Generated/Samples/Sample_DatabaseFleetMemberResource.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/samples/Generated/Samples/Sample_DatabaseFleetMemberResource.cs new file mode 100644 index 000000000000..ba2d23068ac1 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/samples/Generated/Samples/Sample_DatabaseFleetMemberResource.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.DatabaseFleetManager; +using Azure.ResourceManager.DatabaseFleetManager.Models; + +namespace Azure.ResourceManager.DatabaseFleetManager.Samples +{ + public partial class Sample_DatabaseFleetMemberResource + { + // Gets a FleetMember resource. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetsAFleetMemberResource() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/FleetMembers_Get.json + // this example is just showing the usage of "FleetMembers_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DatabaseFleetMemberResource created on azure + // for more information of creating DatabaseFleetMemberResource, please refer to the document of DatabaseFleetMemberResource + string subscriptionId = "subid1"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + string fleetMemberName = "member-1"; + ResourceIdentifier databaseFleetMemberResourceId = DatabaseFleetMemberResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName, fleetMemberName); + DatabaseFleetMemberResource databaseFleetMember = client.GetDatabaseFleetMemberResource(databaseFleetMemberResourceId); + + // invoke the operation + DatabaseFleetMemberResource result = await databaseFleetMember.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DatabaseFleetMemberData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Updates a FleetMember resource synchronously. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_UpdatesAFleetMemberResourceSynchronously() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/FleetMembers_Update.json + // this example is just showing the usage of "FleetMembers_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DatabaseFleetMemberResource created on azure + // for more information of creating DatabaseFleetMemberResource, please refer to the document of DatabaseFleetMemberResource + string subscriptionId = "subid1"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + string fleetMemberName = "member-1"; + ResourceIdentifier databaseFleetMemberResourceId = DatabaseFleetMemberResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName, fleetMemberName); + DatabaseFleetMemberResource databaseFleetMember = client.GetDatabaseFleetMemberResource(databaseFleetMemberResourceId); + + // invoke the operation + DatabaseFleetMemberPatch patch = new DatabaseFleetMemberPatch() + { + Group = "staging", + }; + ArmOperation lro = await databaseFleetMember.UpdateAsync(WaitUntil.Completed, patch); + DatabaseFleetMemberResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DatabaseFleetMemberData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Deletes a FleetMember resource asynchronously with a long running operation. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeletesAFleetMemberResourceAsynchronouslyWithALongRunningOperation() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/FleetMembers_Delete.json + // this example is just showing the usage of "FleetMembers_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DatabaseFleetMemberResource created on azure + // for more information of creating DatabaseFleetMemberResource, please refer to the document of DatabaseFleetMemberResource + string subscriptionId = "subid1"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + string fleetMemberName = "member-1"; + ResourceIdentifier databaseFleetMemberResourceId = DatabaseFleetMemberResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName, fleetMemberName); + DatabaseFleetMemberResource databaseFleetMember = client.GetDatabaseFleetMemberResource(databaseFleetMemberResourceId); + + // invoke the operation + await databaseFleetMember.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/samples/Generated/Samples/Sample_DatabaseFleetResource.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/samples/Generated/Samples/Sample_DatabaseFleetResource.cs new file mode 100644 index 000000000000..e1fb1cf53f64 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/samples/Generated/Samples/Sample_DatabaseFleetResource.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.DatabaseFleetManager; +using Azure.ResourceManager.DatabaseFleetManager.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.DatabaseFleetManager.Samples +{ + public partial class Sample_DatabaseFleetResource + { + // Lists the Fleet resources in a subscription. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetDatabaseFleets_ListsTheFleetResourcesInASubscription() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/Fleets_ListBySub.json + // this example is just showing the usage of "Fleets_ListBySubscription" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "subid1"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (DatabaseFleetResource item in subscriptionResource.GetDatabaseFleetsAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DatabaseFleetData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Gets a Fleet resource. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetsAFleetResource() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/Fleets_Get.json + // this example is just showing the usage of "Fleets_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DatabaseFleetResource created on azure + // for more information of creating DatabaseFleetResource, please refer to the document of DatabaseFleetResource + string subscriptionId = "subid1"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + ResourceIdentifier databaseFleetResourceId = DatabaseFleetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName); + DatabaseFleetResource databaseFleet = client.GetDatabaseFleetResource(databaseFleetResourceId); + + // invoke the operation + DatabaseFleetResource result = await databaseFleet.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DatabaseFleetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Update a Fleet. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_UpdateAFleet() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/Fleets_PatchTags.json + // this example is just showing the usage of "Fleets_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DatabaseFleetResource created on azure + // for more information of creating DatabaseFleetResource, please refer to the document of DatabaseFleetResource + string subscriptionId = "subid1"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + ResourceIdentifier databaseFleetResourceId = DatabaseFleetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName); + DatabaseFleetResource databaseFleet = client.GetDatabaseFleetResource(databaseFleetResourceId); + + // invoke the operation + DatabaseFleetPatch patch = new DatabaseFleetPatch() + { + Tags = +{ +["env"] = "prod", +["tier"] = "secure", +}, + }; + string ifMatch = "dfjkwelr7384"; + ArmOperation lro = await databaseFleet.UpdateAsync(WaitUntil.Completed, patch, ifMatch: ifMatch); + DatabaseFleetResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DatabaseFleetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Deletes a Fleet resource asynchronously with a long running operation. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeletesAFleetResourceAsynchronouslyWithALongRunningOperation() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/Fleets_Delete.json + // this example is just showing the usage of "Fleets_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DatabaseFleetResource created on azure + // for more information of creating DatabaseFleetResource, please refer to the document of DatabaseFleetResource + string subscriptionId = "subid1"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + ResourceIdentifier databaseFleetResourceId = DatabaseFleetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName); + DatabaseFleetResource databaseFleet = client.GetDatabaseFleetResource(databaseFleetResourceId); + + // invoke the operation + await databaseFleet.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Lists the user credentials of a Fleet. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetCredentials_ListsTheUserCredentialsOfAFleet() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/Fleets_ListCredentialsResult.json + // this example is just showing the usage of "Fleets_ListCredentials" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DatabaseFleetResource created on azure + // for more information of creating DatabaseFleetResource, please refer to the document of DatabaseFleetResource + string subscriptionId = "subid1"; + string resourceGroupName = "rg1"; + string fleetName = "fleet"; + ResourceIdentifier databaseFleetResourceId = DatabaseFleetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName); + DatabaseFleetResource databaseFleet = client.GetDatabaseFleetResource(databaseFleetResourceId); + + // invoke the operation + FleetCredentialResults result = await databaseFleet.GetCredentialsAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/samples/Generated/Samples/Sample_DatabaseFleetUpdateRunCollection.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/samples/Generated/Samples/Sample_DatabaseFleetUpdateRunCollection.cs new file mode 100644 index 000000000000..ccd8df59dd7b --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/samples/Generated/Samples/Sample_DatabaseFleetUpdateRunCollection.cs @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.DatabaseFleetManager; +using Azure.ResourceManager.DatabaseFleetManager.Models; + +namespace Azure.ResourceManager.DatabaseFleetManager.Samples +{ + public partial class Sample_DatabaseFleetUpdateRunCollection + { + // Lists the UpdateRun resources by fleet. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListsTheUpdateRunResourcesByFleet() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/UpdateRuns_ListByFleet.json + // this example is just showing the usage of "UpdateRuns_ListByFleet" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DatabaseFleetResource created on azure + // for more information of creating DatabaseFleetResource, please refer to the document of DatabaseFleetResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + ResourceIdentifier databaseFleetResourceId = DatabaseFleetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName); + DatabaseFleetResource databaseFleet = client.GetDatabaseFleetResource(databaseFleetResourceId); + + // get the collection of this DatabaseFleetUpdateRunResource + DatabaseFleetUpdateRunCollection collection = databaseFleet.GetDatabaseFleetUpdateRuns(); + + // invoke the operation and iterate over the result + await foreach (DatabaseFleetUpdateRunResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DatabaseFleetUpdateRunData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Gets an UpdateRun resource. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetsAnUpdateRunResource() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/UpdateRuns_Get.json + // this example is just showing the usage of "UpdateRuns_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DatabaseFleetResource created on azure + // for more information of creating DatabaseFleetResource, please refer to the document of DatabaseFleetResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + ResourceIdentifier databaseFleetResourceId = DatabaseFleetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName); + DatabaseFleetResource databaseFleet = client.GetDatabaseFleetResource(databaseFleetResourceId); + + // get the collection of this DatabaseFleetUpdateRunResource + DatabaseFleetUpdateRunCollection collection = databaseFleet.GetDatabaseFleetUpdateRuns(); + + // invoke the operation + string updateRunName = "run1"; + DatabaseFleetUpdateRunResource result = await collection.GetAsync(updateRunName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DatabaseFleetUpdateRunData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Gets an UpdateRun resource. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetsAnUpdateRunResource() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/UpdateRuns_Get.json + // this example is just showing the usage of "UpdateRuns_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DatabaseFleetResource created on azure + // for more information of creating DatabaseFleetResource, please refer to the document of DatabaseFleetResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + ResourceIdentifier databaseFleetResourceId = DatabaseFleetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName); + DatabaseFleetResource databaseFleet = client.GetDatabaseFleetResource(databaseFleetResourceId); + + // get the collection of this DatabaseFleetUpdateRunResource + DatabaseFleetUpdateRunCollection collection = databaseFleet.GetDatabaseFleetUpdateRuns(); + + // invoke the operation + string updateRunName = "run1"; + bool result = await collection.ExistsAsync(updateRunName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Gets an UpdateRun resource. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsAnUpdateRunResource() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/UpdateRuns_Get.json + // this example is just showing the usage of "UpdateRuns_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DatabaseFleetResource created on azure + // for more information of creating DatabaseFleetResource, please refer to the document of DatabaseFleetResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + ResourceIdentifier databaseFleetResourceId = DatabaseFleetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName); + DatabaseFleetResource databaseFleet = client.GetDatabaseFleetResource(databaseFleetResourceId); + + // get the collection of this DatabaseFleetUpdateRunResource + DatabaseFleetUpdateRunCollection collection = databaseFleet.GetDatabaseFleetUpdateRuns(); + + // invoke the operation + string updateRunName = "run1"; + NullableResponse response = await collection.GetIfExistsAsync(updateRunName); + DatabaseFleetUpdateRunResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DatabaseFleetUpdateRunData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // Create an UpdateRun. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateAnUpdateRun() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/UpdateRuns_CreateOrUpdate.json + // this example is just showing the usage of "UpdateRuns_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DatabaseFleetResource created on azure + // for more information of creating DatabaseFleetResource, please refer to the document of DatabaseFleetResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + ResourceIdentifier databaseFleetResourceId = DatabaseFleetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName); + DatabaseFleetResource databaseFleet = client.GetDatabaseFleetResource(databaseFleetResourceId); + + // get the collection of this DatabaseFleetUpdateRunResource + DatabaseFleetUpdateRunCollection collection = databaseFleet.GetDatabaseFleetUpdateRuns(); + + // invoke the operation + string updateRunName = "run1"; + DatabaseFleetUpdateRunData data = new DatabaseFleetUpdateRunData() + { + StrategyStages = +{ +new FleetUpdateStage("stage1") +{ +Groups = +{ +new FleetUpdateGroup("group-a") +}, +AfterStageWaitInSeconds = 3600, +} +}, + ManagedClusterUpdate = new FleetManagedClusterUpdate(new FleetManagedClusterUpgradeSpec(FleetManagedClusterUpgradeType.Full) + { + KubernetesVersion = "1.26.1", + }) + { + SelectionType = NodeImageSelectionType.Latest, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, updateRunName, data); + DatabaseFleetUpdateRunResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DatabaseFleetUpdateRunData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/samples/Generated/Samples/Sample_DatabaseFleetUpdateRunResource.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/samples/Generated/Samples/Sample_DatabaseFleetUpdateRunResource.cs new file mode 100644 index 000000000000..bbbad88a501a --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/samples/Generated/Samples/Sample_DatabaseFleetUpdateRunResource.cs @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.DatabaseFleetManager; +using Azure.ResourceManager.DatabaseFleetManager.Models; + +namespace Azure.ResourceManager.DatabaseFleetManager.Samples +{ + public partial class Sample_DatabaseFleetUpdateRunResource + { + // Gets an UpdateRun resource. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetsAnUpdateRunResource() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/UpdateRuns_Get.json + // this example is just showing the usage of "UpdateRuns_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DatabaseFleetUpdateRunResource created on azure + // for more information of creating DatabaseFleetUpdateRunResource, please refer to the document of DatabaseFleetUpdateRunResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + string updateRunName = "run1"; + ResourceIdentifier databaseFleetUpdateRunResourceId = DatabaseFleetUpdateRunResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName, updateRunName); + DatabaseFleetUpdateRunResource databaseFleetUpdateRun = client.GetDatabaseFleetUpdateRunResource(databaseFleetUpdateRunResourceId); + + // invoke the operation + DatabaseFleetUpdateRunResource result = await databaseFleetUpdateRun.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DatabaseFleetUpdateRunData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Create an UpdateRun. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CreateAnUpdateRun() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/UpdateRuns_CreateOrUpdate.json + // this example is just showing the usage of "UpdateRuns_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DatabaseFleetUpdateRunResource created on azure + // for more information of creating DatabaseFleetUpdateRunResource, please refer to the document of DatabaseFleetUpdateRunResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + string updateRunName = "run1"; + ResourceIdentifier databaseFleetUpdateRunResourceId = DatabaseFleetUpdateRunResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName, updateRunName); + DatabaseFleetUpdateRunResource databaseFleetUpdateRun = client.GetDatabaseFleetUpdateRunResource(databaseFleetUpdateRunResourceId); + + // invoke the operation + DatabaseFleetUpdateRunData data = new DatabaseFleetUpdateRunData() + { + StrategyStages = +{ +new FleetUpdateStage("stage1") +{ +Groups = +{ +new FleetUpdateGroup("group-a") +}, +AfterStageWaitInSeconds = 3600, +} +}, + ManagedClusterUpdate = new FleetManagedClusterUpdate(new FleetManagedClusterUpgradeSpec(FleetManagedClusterUpgradeType.Full) + { + KubernetesVersion = "1.26.1", + }) + { + SelectionType = NodeImageSelectionType.Latest, + }, + }; + ArmOperation lro = await databaseFleetUpdateRun.UpdateAsync(WaitUntil.Completed, data); + DatabaseFleetUpdateRunResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DatabaseFleetUpdateRunData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Delete an updateRun resource. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteAnUpdateRunResource() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/UpdateRuns_Delete.json + // this example is just showing the usage of "UpdateRuns_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DatabaseFleetUpdateRunResource created on azure + // for more information of creating DatabaseFleetUpdateRunResource, please refer to the document of DatabaseFleetUpdateRunResource + string subscriptionId = "subid1"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + string updateRunName = "run1"; + ResourceIdentifier databaseFleetUpdateRunResourceId = DatabaseFleetUpdateRunResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName, updateRunName); + DatabaseFleetUpdateRunResource databaseFleetUpdateRun = client.GetDatabaseFleetUpdateRunResource(databaseFleetUpdateRunResourceId); + + // invoke the operation + await databaseFleetUpdateRun.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Starts an UpdateRun. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Start_StartsAnUpdateRun() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/UpdateRuns_Start.json + // this example is just showing the usage of "UpdateRuns_Start" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DatabaseFleetUpdateRunResource created on azure + // for more information of creating DatabaseFleetUpdateRunResource, please refer to the document of DatabaseFleetUpdateRunResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + string updateRunName = "run1"; + ResourceIdentifier databaseFleetUpdateRunResourceId = DatabaseFleetUpdateRunResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName, updateRunName); + DatabaseFleetUpdateRunResource databaseFleetUpdateRun = client.GetDatabaseFleetUpdateRunResource(databaseFleetUpdateRunResourceId); + + // invoke the operation + ArmOperation lro = await databaseFleetUpdateRun.StartAsync(WaitUntil.Completed); + DatabaseFleetUpdateRunResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DatabaseFleetUpdateRunData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Stops an UpdateRun. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Stop_StopsAnUpdateRun() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-06-15-preview/examples/UpdateRuns_Stop.json + // this example is just showing the usage of "UpdateRuns_Stop" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DatabaseFleetUpdateRunResource created on azure + // for more information of creating DatabaseFleetUpdateRunResource, please refer to the document of DatabaseFleetUpdateRunResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + string updateRunName = "run1"; + ResourceIdentifier databaseFleetUpdateRunResourceId = DatabaseFleetUpdateRunResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName, updateRunName); + DatabaseFleetUpdateRunResource databaseFleetUpdateRun = client.GetDatabaseFleetUpdateRunResource(databaseFleetUpdateRunResourceId); + + // invoke the operation + ArmOperation lro = await databaseFleetUpdateRun.StopAsync(WaitUntil.Completed); + DatabaseFleetUpdateRunResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DatabaseFleetUpdateRunData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Azure.ResourceManager.DatabaseFleetManager.csproj b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Azure.ResourceManager.DatabaseFleetManager.csproj new file mode 100644 index 000000000000..cb4d0508a88e --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Azure.ResourceManager.DatabaseFleetManager.csproj @@ -0,0 +1,8 @@ + + + 1.0.0-beta.1 + Azure.ResourceManager.DatabaseFleetManager + Azure Resource Manager client SDK for Azure resource provider Database Fleet Manager. + azure;management;arm;resource manager;fleet + + diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/ArmDatabaseFleetManagerModelFactory.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/ArmDatabaseFleetManagerModelFactory.cs new file mode 100644 index 000000000000..ddff9724c1a7 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/ArmDatabaseFleetManagerModelFactory.cs @@ -0,0 +1,186 @@ +// 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; +using Azure.Core; +using Azure.ResourceManager.DatabaseFleetManager; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + /// Model factory for models. + public static partial class ArmDatabaseFleetManagerModelFactory + { + /// Initializes a new instance of DatabaseFleetData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + /// Managed identity. + /// The status of the last operation. + /// The FleetHubProfile configures the Fleet's hub. + /// A new instance for mocking. + public static DatabaseFleetData DatabaseFleetData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ETag? eTag = null, ManagedServiceIdentity identity = null, FleetProvisioningState? provisioningState = null, FleetHubProfile hubProfile = null) + { + tags ??= new Dictionary(); + + return new DatabaseFleetData(id, name, resourceType, systemData, tags, location, eTag, identity, provisioningState, hubProfile); + } + + /// Initializes a new instance of FleetHubProfile. + /// DNS prefix used to create the FQDN for the Fleet hub. + /// The access profile for the Fleet hub API server. + /// The agent profile for the Fleet hub. + /// The FQDN of the Fleet hub. + /// The Kubernetes version of the Fleet hub. + /// A new instance for mocking. + public static FleetHubProfile FleetHubProfile(string dnsPrefix = null, FleetApiServerAccessProfile apiServerAccessProfile = null, ResourceIdentifier agentSubnetId = null, string fqdn = null, string kubernetesVersion = null) + { + return new FleetHubProfile(dnsPrefix, apiServerAccessProfile, agentSubnetId != null ? new FleetAgentProfile(agentSubnetId) : null, fqdn, kubernetesVersion); + } + + /// Initializes a new instance of FleetCredentialResults. + /// Array of base64-encoded Kubernetes configuration files. + /// A new instance for mocking. + public static FleetCredentialResults FleetCredentialResults(IEnumerable kubeconfigs = null) + { + kubeconfigs ??= new List(); + + return new FleetCredentialResults(kubeconfigs?.ToList()); + } + + /// Initializes a new instance of FleetCredentialResult. + /// The name of the credential. + /// Base64-encoded Kubernetes configuration file. + /// A new instance for mocking. + public static FleetCredentialResult FleetCredentialResult(string name = null, byte[] value = null) + { + return new FleetCredentialResult(name, value); + } + + /// Initializes a new instance of DatabaseFleetMemberData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + /// The ARM resource id of the cluster that joins the Fleet. Must be a valid Azure resource id. e.g.: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. + /// The group this member belongs to for multi-cluster update management. + /// The status of the last operation. + /// A new instance for mocking. + public static DatabaseFleetMemberData DatabaseFleetMemberData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ETag? eTag = null, ResourceIdentifier clusterResourceId = null, string group = null, FleetMemberProvisioningState? provisioningState = null) + { + return new DatabaseFleetMemberData(id, name, resourceType, systemData, eTag, clusterResourceId, group, provisioningState); + } + + /// Initializes a new instance of DatabaseFleetUpdateRunData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + /// The provisioning state of the UpdateRun resource. + /// + /// The strategy defines the order in which the clusters will be updated. + /// If not set, all members will be updated sequentially. The UpdateRun status will show a single UpdateStage and a single UpdateGroup targeting all members. + /// The strategy of the UpdateRun can be modified until the run is started. + /// + /// The update to be applied to all clusters in the UpdateRun. The managedClusterUpdate can be modified until the run is started. + /// The status of the UpdateRun. + /// A new instance for mocking. + public static DatabaseFleetUpdateRunData DatabaseFleetUpdateRunData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ETag? eTag = null, FleetUpdateRunProvisioningState? provisioningState = null, IEnumerable strategyStages = null, FleetManagedClusterUpdate managedClusterUpdate = null, FleetUpdateRunStatus status = null) + { + strategyStages ??= new List(); + + return new DatabaseFleetUpdateRunData(id, name, resourceType, systemData, eTag, provisioningState, strategyStages != null ? new FleetUpdateRunStrategy(strategyStages?.ToList()) : null, managedClusterUpdate, status); + } + + /// Initializes a new instance of FleetUpdateRunStatus. + /// The status of the UpdateRun. + /// The stages composing an update run. Stages are run sequentially withing an UpdateRun. + /// The node image upgrade specs for the update run. It is only set in update run when `NodeImageSelection.type` is `Consistent`. + /// A new instance for mocking. + public static FleetUpdateRunStatus FleetUpdateRunStatus(FleetUpdateOperationStatus status = null, IEnumerable stages = null, IEnumerable selectedNodeImageVersions = null) + { + stages ??= new List(); + selectedNodeImageVersions ??= new List(); + + return new FleetUpdateRunStatus(status, stages?.ToList(), selectedNodeImageVersions != null ? new NodeImageSelectionStatus(selectedNodeImageVersions?.ToList()) : null); + } + + /// Initializes a new instance of FleetUpdateOperationStatus. + /// The time the operation or group was started. + /// The time the operation or group was completed. + /// The State of the operation or group. + /// The error details when a failure is encountered. + /// A new instance for mocking. + public static FleetUpdateOperationStatus FleetUpdateOperationStatus(DateTimeOffset? startOn = null, DateTimeOffset? completedOn = null, FleetUpdateState? state = null, ResponseError error = null) + { + return new FleetUpdateOperationStatus(startOn, completedOn, state, error); + } + + /// Initializes a new instance of FleetUpdateStageStatus. + /// The status of the UpdateStage. + /// The name of the UpdateStage. + /// The list of groups to be updated as part of this UpdateStage. + /// The status of the wait period configured on the UpdateStage. + /// A new instance for mocking. + public static FleetUpdateStageStatus FleetUpdateStageStatus(FleetUpdateOperationStatus status = null, string name = null, IEnumerable groups = null, FleetWaitStatus afterStageWaitStatus = null) + { + groups ??= new List(); + + return new FleetUpdateStageStatus(status, name, groups?.ToList(), afterStageWaitStatus); + } + + /// Initializes a new instance of FleetUpdateGroupStatus. + /// The status of the UpdateGroup. + /// The name of the UpdateGroup. + /// The list of member this UpdateGroup updates. + /// A new instance for mocking. + public static FleetUpdateGroupStatus FleetUpdateGroupStatus(FleetUpdateOperationStatus status = null, string name = null, IEnumerable members = null) + { + members ??= new List(); + + return new FleetUpdateGroupStatus(status, name, members?.ToList()); + } + + /// Initializes a new instance of MemberUpdateStatus. + /// The status of the MemberUpdate operation. + /// The name of the FleetMember. + /// The Azure resource id of the target Kubernetes cluster. + /// The operation resource id of the latest attempt to perform the operation. + /// The status message after processing the member update operation. + /// A new instance for mocking. + public static MemberUpdateStatus MemberUpdateStatus(FleetUpdateOperationStatus status = null, string name = null, ResourceIdentifier clusterResourceId = null, string operationId = null, string message = null) + { + return new MemberUpdateStatus(status, name, clusterResourceId, operationId, message); + } + + /// Initializes a new instance of FleetWaitStatus. + /// The status of the wait duration. + /// The wait duration configured in seconds. + /// A new instance for mocking. + public static FleetWaitStatus FleetWaitStatus(FleetUpdateOperationStatus status = null, int? waitDurationInSeconds = null) + { + return new FleetWaitStatus(status, waitDurationInSeconds); + } + + /// Initializes a new instance of NodeImageVersion. + /// The image version to upgrade the nodes to (e.g., 'AKSUbuntu-1804gen2containerd-2022.12.13'). + /// A new instance for mocking. + public static NodeImageVersion NodeImageVersion(string version = null) + { + return new NodeImageVersion(version); + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/DatabaseFleetCollection.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/DatabaseFleetCollection.cs new file mode 100644 index 000000000000..c768823488c5 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/DatabaseFleetCollection.cs @@ -0,0 +1,420 @@ +// 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; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.DatabaseFleetManager +{ + /// + /// 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 GetDatabaseFleets method from an instance of . + /// + public partial class DatabaseFleetCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _databaseFleetFleetsClientDiagnostics; + private readonly FleetsRestOperations _databaseFleetFleetsRestClient; + + /// Initializes a new instance of the class for mocking. + protected DatabaseFleetCollection() + { + } + + /// 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 DatabaseFleetCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _databaseFleetFleetsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DatabaseFleetManager", DatabaseFleetResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DatabaseFleetResource.ResourceType, out string databaseFleetFleetsApiVersion); + _databaseFleetFleetsRestClient = new FleetsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, databaseFleetFleetsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceGroupResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), nameof(id)); + } + + /// + /// Creates or updates a Fleet. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the Fleet resource. + /// Resource create parameters. + /// The request should only proceed if an entity matches this string. + /// The request should only proceed if no entity matches this string. + /// 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 fleetName, DatabaseFleetData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _databaseFleetFleetsClientDiagnostics.CreateScope("DatabaseFleetCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _databaseFleetFleetsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, fleetName, data, ifMatch, ifNoneMatch, cancellationToken).ConfigureAwait(false); + var operation = new DatabaseFleetManagerArmOperation(new DatabaseFleetOperationSource(Client), _databaseFleetFleetsClientDiagnostics, Pipeline, _databaseFleetFleetsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, fleetName, data, ifMatch, ifNoneMatch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a Fleet. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the Fleet resource. + /// Resource create parameters. + /// The request should only proceed if an entity matches this string. + /// The request should only proceed if no entity matches this string. + /// 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 fleetName, DatabaseFleetData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _databaseFleetFleetsClientDiagnostics.CreateScope("DatabaseFleetCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _databaseFleetFleetsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, fleetName, data, ifMatch, ifNoneMatch, cancellationToken); + var operation = new DatabaseFleetManagerArmOperation(new DatabaseFleetOperationSource(Client), _databaseFleetFleetsClientDiagnostics, Pipeline, _databaseFleetFleetsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, fleetName, data, ifMatch, ifNoneMatch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a Fleet. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_Get + /// + /// + /// + /// The name of the Fleet 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 fleetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + + using var scope = _databaseFleetFleetsClientDiagnostics.CreateScope("DatabaseFleetCollection.Get"); + scope.Start(); + try + { + var response = await _databaseFleetFleetsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, fleetName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DatabaseFleetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a Fleet. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_Get + /// + /// + /// + /// The name of the Fleet resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string fleetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + + using var scope = _databaseFleetFleetsClientDiagnostics.CreateScope("DatabaseFleetCollection.Get"); + scope.Start(); + try + { + var response = _databaseFleetFleetsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, fleetName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DatabaseFleetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists fleets in the specified subscription and resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets + /// + /// + /// Operation Id + /// Fleets_ListByResourceGroup + /// + /// + /// + /// 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) => _databaseFleetFleetsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _databaseFleetFleetsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DatabaseFleetResource(Client, DatabaseFleetData.DeserializeDatabaseFleetData(e)), _databaseFleetFleetsClientDiagnostics, Pipeline, "DatabaseFleetCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists fleets in the specified subscription and resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets + /// + /// + /// Operation Id + /// Fleets_ListByResourceGroup + /// + /// + /// + /// 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) => _databaseFleetFleetsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _databaseFleetFleetsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DatabaseFleetResource(Client, DatabaseFleetData.DeserializeDatabaseFleetData(e)), _databaseFleetFleetsClientDiagnostics, Pipeline, "DatabaseFleetCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_Get + /// + /// + /// + /// The name of the Fleet 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 fleetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + + using var scope = _databaseFleetFleetsClientDiagnostics.CreateScope("DatabaseFleetCollection.Exists"); + scope.Start(); + try + { + var response = await _databaseFleetFleetsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, fleetName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_Get + /// + /// + /// + /// The name of the Fleet resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string fleetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + + using var scope = _databaseFleetFleetsClientDiagnostics.CreateScope("DatabaseFleetCollection.Exists"); + scope.Start(); + try + { + var response = _databaseFleetFleetsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, fleetName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_Get + /// + /// + /// + /// The name of the Fleet 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 fleetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + + using var scope = _databaseFleetFleetsClientDiagnostics.CreateScope("DatabaseFleetCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _databaseFleetFleetsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, fleetName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DatabaseFleetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_Get + /// + /// + /// + /// The name of the Fleet resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string fleetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + + using var scope = _databaseFleetFleetsClientDiagnostics.CreateScope("DatabaseFleetCollection.GetIfExists"); + scope.Start(); + try + { + var response = _databaseFleetFleetsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, fleetName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DatabaseFleetResource(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/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/DatabaseFleetData.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/DatabaseFleetData.cs new file mode 100644 index 000000000000..cebab4756eeb --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/DatabaseFleetData.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.ResourceManager.DatabaseFleetManager.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DatabaseFleetManager +{ + /// + /// A class representing the DatabaseFleet data model. + /// The Fleet resource. + /// + public partial class DatabaseFleetData : TrackedResourceData + { + /// Initializes a new instance of DatabaseFleetData. + /// The location. + public DatabaseFleetData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of DatabaseFleetData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + /// Managed identity. + /// The status of the last operation. + /// The FleetHubProfile configures the Fleet's hub. + internal DatabaseFleetData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ETag? eTag, ManagedServiceIdentity identity, FleetProvisioningState? provisioningState, FleetHubProfile hubProfile) : base(id, name, resourceType, systemData, tags, location) + { + ETag = eTag; + Identity = identity; + ProvisioningState = provisioningState; + HubProfile = hubProfile; + } + + /// If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + public ETag? ETag { get; } + /// Managed identity. + public ManagedServiceIdentity Identity { get; set; } + /// The status of the last operation. + public FleetProvisioningState? ProvisioningState { get; } + /// The FleetHubProfile configures the Fleet's hub. + public FleetHubProfile HubProfile { get; set; } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/DatabaseFleetMemberCollection.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/DatabaseFleetMemberCollection.cs new file mode 100644 index 000000000000..d764da53c978 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/DatabaseFleetMemberCollection.cs @@ -0,0 +1,419 @@ +// 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; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.DatabaseFleetManager +{ + /// + /// 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 GetDatabaseFleetMembers method from an instance of . + /// + public partial class DatabaseFleetMemberCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _databaseFleetMemberFleetMembersClientDiagnostics; + private readonly FleetMembersRestOperations _databaseFleetMemberFleetMembersRestClient; + + /// Initializes a new instance of the class for mocking. + protected DatabaseFleetMemberCollection() + { + } + + /// 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 DatabaseFleetMemberCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _databaseFleetMemberFleetMembersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DatabaseFleetManager", DatabaseFleetMemberResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DatabaseFleetMemberResource.ResourceType, out string databaseFleetMemberFleetMembersApiVersion); + _databaseFleetMemberFleetMembersRestClient = new FleetMembersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, databaseFleetMemberFleetMembersApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != DatabaseFleetResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DatabaseFleetResource.ResourceType), nameof(id)); + } + + /// + /// Create a FleetMember + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName} + /// + /// + /// Operation Id + /// FleetMembers_Create + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the Fleet member resource. + /// Resource create parameters. + /// The request should only proceed if an entity matches this string. + /// The request should only proceed if no entity matches this string. + /// 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 fleetMemberName, DatabaseFleetMemberData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fleetMemberName, nameof(fleetMemberName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _databaseFleetMemberFleetMembersClientDiagnostics.CreateScope("DatabaseFleetMemberCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _databaseFleetMemberFleetMembersRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, fleetMemberName, data, ifMatch, ifNoneMatch, cancellationToken).ConfigureAwait(false); + var operation = new DatabaseFleetManagerArmOperation(new DatabaseFleetMemberOperationSource(Client), _databaseFleetMemberFleetMembersClientDiagnostics, Pipeline, _databaseFleetMemberFleetMembersRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, fleetMemberName, data, ifMatch, ifNoneMatch).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 FleetMember + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName} + /// + /// + /// Operation Id + /// FleetMembers_Create + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the Fleet member resource. + /// Resource create parameters. + /// The request should only proceed if an entity matches this string. + /// The request should only proceed if no entity matches this string. + /// 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 fleetMemberName, DatabaseFleetMemberData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fleetMemberName, nameof(fleetMemberName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _databaseFleetMemberFleetMembersClientDiagnostics.CreateScope("DatabaseFleetMemberCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _databaseFleetMemberFleetMembersRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, fleetMemberName, data, ifMatch, ifNoneMatch, cancellationToken); + var operation = new DatabaseFleetManagerArmOperation(new DatabaseFleetMemberOperationSource(Client), _databaseFleetMemberFleetMembersClientDiagnostics, Pipeline, _databaseFleetMemberFleetMembersRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, fleetMemberName, data, ifMatch, ifNoneMatch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a FleetMember + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName} + /// + /// + /// Operation Id + /// FleetMembers_Get + /// + /// + /// + /// The name of the Fleet member 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 fleetMemberName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fleetMemberName, nameof(fleetMemberName)); + + using var scope = _databaseFleetMemberFleetMembersClientDiagnostics.CreateScope("DatabaseFleetMemberCollection.Get"); + scope.Start(); + try + { + var response = await _databaseFleetMemberFleetMembersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, fleetMemberName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DatabaseFleetMemberResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a FleetMember + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName} + /// + /// + /// Operation Id + /// FleetMembers_Get + /// + /// + /// + /// The name of the Fleet member resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string fleetMemberName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fleetMemberName, nameof(fleetMemberName)); + + using var scope = _databaseFleetMemberFleetMembersClientDiagnostics.CreateScope("DatabaseFleetMemberCollection.Get"); + scope.Start(); + try + { + var response = _databaseFleetMemberFleetMembersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, fleetMemberName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DatabaseFleetMemberResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List FleetMember resources by Fleet + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members + /// + /// + /// Operation Id + /// FleetMembers_ListByFleet + /// + /// + /// + /// 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) => _databaseFleetMemberFleetMembersRestClient.CreateListByFleetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _databaseFleetMemberFleetMembersRestClient.CreateListByFleetNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DatabaseFleetMemberResource(Client, DatabaseFleetMemberData.DeserializeDatabaseFleetMemberData(e)), _databaseFleetMemberFleetMembersClientDiagnostics, Pipeline, "DatabaseFleetMemberCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List FleetMember resources by Fleet + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members + /// + /// + /// Operation Id + /// FleetMembers_ListByFleet + /// + /// + /// + /// 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) => _databaseFleetMemberFleetMembersRestClient.CreateListByFleetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _databaseFleetMemberFleetMembersRestClient.CreateListByFleetNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DatabaseFleetMemberResource(Client, DatabaseFleetMemberData.DeserializeDatabaseFleetMemberData(e)), _databaseFleetMemberFleetMembersClientDiagnostics, Pipeline, "DatabaseFleetMemberCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName} + /// + /// + /// Operation Id + /// FleetMembers_Get + /// + /// + /// + /// The name of the Fleet member 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 fleetMemberName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fleetMemberName, nameof(fleetMemberName)); + + using var scope = _databaseFleetMemberFleetMembersClientDiagnostics.CreateScope("DatabaseFleetMemberCollection.Exists"); + scope.Start(); + try + { + var response = await _databaseFleetMemberFleetMembersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, fleetMemberName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName} + /// + /// + /// Operation Id + /// FleetMembers_Get + /// + /// + /// + /// The name of the Fleet member resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string fleetMemberName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fleetMemberName, nameof(fleetMemberName)); + + using var scope = _databaseFleetMemberFleetMembersClientDiagnostics.CreateScope("DatabaseFleetMemberCollection.Exists"); + scope.Start(); + try + { + var response = _databaseFleetMemberFleetMembersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, fleetMemberName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName} + /// + /// + /// Operation Id + /// FleetMembers_Get + /// + /// + /// + /// The name of the Fleet member 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 fleetMemberName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fleetMemberName, nameof(fleetMemberName)); + + using var scope = _databaseFleetMemberFleetMembersClientDiagnostics.CreateScope("DatabaseFleetMemberCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _databaseFleetMemberFleetMembersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, fleetMemberName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DatabaseFleetMemberResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName} + /// + /// + /// Operation Id + /// FleetMembers_Get + /// + /// + /// + /// The name of the Fleet member resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string fleetMemberName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fleetMemberName, nameof(fleetMemberName)); + + using var scope = _databaseFleetMemberFleetMembersClientDiagnostics.CreateScope("DatabaseFleetMemberCollection.GetIfExists"); + scope.Start(); + try + { + var response = _databaseFleetMemberFleetMembersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, fleetMemberName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DatabaseFleetMemberResource(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/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/DatabaseFleetMemberData.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/DatabaseFleetMemberData.cs new file mode 100644 index 000000000000..61ac559f56c5 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/DatabaseFleetMemberData.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure; +using Azure.Core; +using Azure.ResourceManager.DatabaseFleetManager.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DatabaseFleetManager +{ + /// + /// A class representing the DatabaseFleetMember data model. + /// A member of the Fleet. It contains a reference to an existing Kubernetes cluster on Azure. + /// + public partial class DatabaseFleetMemberData : ResourceData + { + /// Initializes a new instance of DatabaseFleetMemberData. + public DatabaseFleetMemberData() + { + } + + /// Initializes a new instance of DatabaseFleetMemberData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + /// The ARM resource id of the cluster that joins the Fleet. Must be a valid Azure resource id. e.g.: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. + /// The group this member belongs to for multi-cluster update management. + /// The status of the last operation. + internal DatabaseFleetMemberData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ETag? eTag, ResourceIdentifier clusterResourceId, string group, FleetMemberProvisioningState? provisioningState) : base(id, name, resourceType, systemData) + { + ETag = eTag; + ClusterResourceId = clusterResourceId; + Group = group; + ProvisioningState = provisioningState; + } + + /// If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + public ETag? ETag { get; } + /// The ARM resource id of the cluster that joins the Fleet. Must be a valid Azure resource id. e.g.: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. + public ResourceIdentifier ClusterResourceId { get; set; } + /// The group this member belongs to for multi-cluster update management. + public string Group { get; set; } + /// The status of the last operation. + public FleetMemberProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/DatabaseFleetMemberResource.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/DatabaseFleetMemberResource.cs new file mode 100644 index 000000000000..219d517b229e --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/DatabaseFleetMemberResource.cs @@ -0,0 +1,302 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.DatabaseFleetManager.Models; + +namespace Azure.ResourceManager.DatabaseFleetManager +{ + /// + /// A Class representing a DatabaseFleetMember 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 GetDatabaseFleetMemberResource method. + /// Otherwise you can get one from its parent resource using the GetDatabaseFleetMember method. + /// + public partial class DatabaseFleetMemberResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string fleetName, string fleetMemberName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _databaseFleetMemberFleetMembersClientDiagnostics; + private readonly FleetMembersRestOperations _databaseFleetMemberFleetMembersRestClient; + private readonly DatabaseFleetMemberData _data; + + /// Initializes a new instance of the class for mocking. + protected DatabaseFleetMemberResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DatabaseFleetMemberResource(ArmClient client, DatabaseFleetMemberData 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 DatabaseFleetMemberResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _databaseFleetMemberFleetMembersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DatabaseFleetManager", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string databaseFleetMemberFleetMembersApiVersion); + _databaseFleetMemberFleetMembersRestClient = new FleetMembersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, databaseFleetMemberFleetMembersApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ContainerService/fleets/members"; + + /// 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 DatabaseFleetMemberData 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 FleetMember + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName} + /// + /// + /// Operation Id + /// FleetMembers_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _databaseFleetMemberFleetMembersClientDiagnostics.CreateScope("DatabaseFleetMemberResource.Get"); + scope.Start(); + try + { + var response = await _databaseFleetMemberFleetMembersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DatabaseFleetMemberResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a FleetMember + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName} + /// + /// + /// Operation Id + /// FleetMembers_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _databaseFleetMemberFleetMembersClientDiagnostics.CreateScope("DatabaseFleetMemberResource.Get"); + scope.Start(); + try + { + var response = _databaseFleetMemberFleetMembersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DatabaseFleetMemberResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a FleetMember + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName} + /// + /// + /// Operation Id + /// FleetMembers_Delete + /// + /// + /// + /// 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 request should only proceed if an entity matches this string. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, string ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _databaseFleetMemberFleetMembersClientDiagnostics.CreateScope("DatabaseFleetMemberResource.Delete"); + scope.Start(); + try + { + var response = await _databaseFleetMemberFleetMembersRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new DatabaseFleetManagerArmOperation(_databaseFleetMemberFleetMembersClientDiagnostics, Pipeline, _databaseFleetMemberFleetMembersRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch).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 FleetMember + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName} + /// + /// + /// Operation Id + /// FleetMembers_Delete + /// + /// + /// + /// 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 request should only proceed if an entity matches this string. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, string ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _databaseFleetMemberFleetMembersClientDiagnostics.CreateScope("DatabaseFleetMemberResource.Delete"); + scope.Start(); + try + { + var response = _databaseFleetMemberFleetMembersRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new DatabaseFleetManagerArmOperation(_databaseFleetMemberFleetMembersClientDiagnostics, Pipeline, _databaseFleetMemberFleetMembersRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a FleetMember + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName} + /// + /// + /// Operation Id + /// FleetMembers_Update + /// + /// + /// + /// 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 request should only proceed if an entity matches this string. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, DatabaseFleetMemberPatch patch, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _databaseFleetMemberFleetMembersClientDiagnostics.CreateScope("DatabaseFleetMemberResource.Update"); + scope.Start(); + try + { + var response = await _databaseFleetMemberFleetMembersRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new DatabaseFleetManagerArmOperation(new DatabaseFleetMemberOperationSource(Client), _databaseFleetMemberFleetMembersClientDiagnostics, Pipeline, _databaseFleetMemberFleetMembersRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, ifMatch).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 FleetMember + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName} + /// + /// + /// Operation Id + /// FleetMembers_Update + /// + /// + /// + /// 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 request should only proceed if an entity matches this string. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, DatabaseFleetMemberPatch patch, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _databaseFleetMemberFleetMembersClientDiagnostics.CreateScope("DatabaseFleetMemberResource.Update"); + scope.Start(); + try + { + var response = _databaseFleetMemberFleetMembersRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, ifMatch, cancellationToken); + var operation = new DatabaseFleetManagerArmOperation(new DatabaseFleetMemberOperationSource(Client), _databaseFleetMemberFleetMembersClientDiagnostics, Pipeline, _databaseFleetMemberFleetMembersRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/DatabaseFleetResource.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/DatabaseFleetResource.cs new file mode 100644 index 000000000000..fdd9eccaed67 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/DatabaseFleetResource.cs @@ -0,0 +1,780 @@ +// 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; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.DatabaseFleetManager.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.DatabaseFleetManager +{ + /// + /// A Class representing a DatabaseFleet 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 GetDatabaseFleetResource method. + /// Otherwise you can get one from its parent resource using the GetDatabaseFleet method. + /// + public partial class DatabaseFleetResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string fleetName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _databaseFleetFleetsClientDiagnostics; + private readonly FleetsRestOperations _databaseFleetFleetsRestClient; + private readonly DatabaseFleetData _data; + + /// Initializes a new instance of the class for mocking. + protected DatabaseFleetResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DatabaseFleetResource(ArmClient client, DatabaseFleetData 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 DatabaseFleetResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _databaseFleetFleetsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DatabaseFleetManager", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string databaseFleetFleetsApiVersion); + _databaseFleetFleetsRestClient = new FleetsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, databaseFleetFleetsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ContainerService/fleets"; + + /// 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 DatabaseFleetData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Gets a collection of DatabaseFleetMemberResources in the DatabaseFleet. + /// An object representing collection of DatabaseFleetMemberResources and their operations over a DatabaseFleetMemberResource. + public virtual DatabaseFleetMemberCollection GetDatabaseFleetMembers() + { + return GetCachedClient(Client => new DatabaseFleetMemberCollection(Client, Id)); + } + + /// + /// Get a FleetMember + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName} + /// + /// + /// Operation Id + /// FleetMembers_Get + /// + /// + /// + /// The name of the Fleet member resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetDatabaseFleetMemberAsync(string fleetMemberName, CancellationToken cancellationToken = default) + { + return await GetDatabaseFleetMembers().GetAsync(fleetMemberName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a FleetMember + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName} + /// + /// + /// Operation Id + /// FleetMembers_Get + /// + /// + /// + /// The name of the Fleet member resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetDatabaseFleetMember(string fleetMemberName, CancellationToken cancellationToken = default) + { + return GetDatabaseFleetMembers().Get(fleetMemberName, cancellationToken); + } + + /// Gets a collection of DatabaseFleetUpdateRunResources in the DatabaseFleet. + /// An object representing collection of DatabaseFleetUpdateRunResources and their operations over a DatabaseFleetUpdateRunResource. + public virtual DatabaseFleetUpdateRunCollection GetDatabaseFleetUpdateRuns() + { + return GetCachedClient(Client => new DatabaseFleetUpdateRunCollection(Client, Id)); + } + + /// + /// Get a UpdateRun + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName} + /// + /// + /// Operation Id + /// UpdateRuns_Get + /// + /// + /// + /// The name of the UpdateRun resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetDatabaseFleetUpdateRunAsync(string updateRunName, CancellationToken cancellationToken = default) + { + return await GetDatabaseFleetUpdateRuns().GetAsync(updateRunName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a UpdateRun + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName} + /// + /// + /// Operation Id + /// UpdateRuns_Get + /// + /// + /// + /// The name of the UpdateRun resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetDatabaseFleetUpdateRun(string updateRunName, CancellationToken cancellationToken = default) + { + return GetDatabaseFleetUpdateRuns().Get(updateRunName, cancellationToken); + } + + /// + /// Gets a Fleet. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _databaseFleetFleetsClientDiagnostics.CreateScope("DatabaseFleetResource.Get"); + scope.Start(); + try + { + var response = await _databaseFleetFleetsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DatabaseFleetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a Fleet. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _databaseFleetFleetsClientDiagnostics.CreateScope("DatabaseFleetResource.Get"); + scope.Start(); + try + { + var response = _databaseFleetFleetsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DatabaseFleetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a Fleet + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_Delete + /// + /// + /// + /// 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 request should only proceed if an entity matches this string. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, string ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _databaseFleetFleetsClientDiagnostics.CreateScope("DatabaseFleetResource.Delete"); + scope.Start(); + try + { + var response = await _databaseFleetFleetsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new DatabaseFleetManagerArmOperation(_databaseFleetFleetsClientDiagnostics, Pipeline, _databaseFleetFleetsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ifMatch).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 Fleet + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_Delete + /// + /// + /// + /// 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 request should only proceed if an entity matches this string. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, string ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _databaseFleetFleetsClientDiagnostics.CreateScope("DatabaseFleetResource.Delete"); + scope.Start(); + try + { + var response = _databaseFleetFleetsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ifMatch, cancellationToken); + var operation = new DatabaseFleetManagerArmOperation(_databaseFleetFleetsClientDiagnostics, Pipeline, _databaseFleetFleetsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a Fleet + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_Update + /// + /// + /// + /// 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 request should only proceed if an entity matches this string. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, DatabaseFleetPatch patch, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _databaseFleetFleetsClientDiagnostics.CreateScope("DatabaseFleetResource.Update"); + scope.Start(); + try + { + var response = await _databaseFleetFleetsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new DatabaseFleetManagerArmOperation(new DatabaseFleetOperationSource(Client), _databaseFleetFleetsClientDiagnostics, Pipeline, _databaseFleetFleetsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, ifMatch).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 Fleet + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_Update + /// + /// + /// + /// 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 request should only proceed if an entity matches this string. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, DatabaseFleetPatch patch, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _databaseFleetFleetsClientDiagnostics.CreateScope("DatabaseFleetResource.Update"); + scope.Start(); + try + { + var response = _databaseFleetFleetsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, ifMatch, cancellationToken); + var operation = new DatabaseFleetManagerArmOperation(new DatabaseFleetOperationSource(Client), _databaseFleetFleetsClientDiagnostics, Pipeline, _databaseFleetFleetsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists the user credentials of a Fleet. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/listCredentials + /// + /// + /// Operation Id + /// Fleets_ListCredentials + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetCredentialsAsync(CancellationToken cancellationToken = default) + { + using var scope = _databaseFleetFleetsClientDiagnostics.CreateScope("DatabaseFleetResource.GetCredentials"); + scope.Start(); + try + { + var response = await _databaseFleetFleetsRestClient.ListCredentialsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists the user credentials of a Fleet. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/listCredentials + /// + /// + /// Operation Id + /// Fleets_ListCredentials + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetCredentials(CancellationToken cancellationToken = default) + { + using var scope = _databaseFleetFleetsClientDiagnostics.CreateScope("DatabaseFleetResource.GetCredentials"); + scope.Start(); + try + { + var response = _databaseFleetFleetsRestClient.ListCredentials(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_Get + /// + /// + /// + /// 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 = _databaseFleetFleetsClientDiagnostics.CreateScope("DatabaseFleetResource.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 _databaseFleetFleetsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DatabaseFleetResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DatabaseFleetPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_Get + /// + /// + /// + /// 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 = _databaseFleetFleetsClientDiagnostics.CreateScope("DatabaseFleetResource.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 = _databaseFleetFleetsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new DatabaseFleetResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DatabaseFleetPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_Get + /// + /// + /// + /// 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 = _databaseFleetFleetsClientDiagnostics.CreateScope("DatabaseFleetResource.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 _databaseFleetFleetsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DatabaseFleetResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DatabaseFleetPatch(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_Get + /// + /// + /// + /// 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 = _databaseFleetFleetsClientDiagnostics.CreateScope("DatabaseFleetResource.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 = _databaseFleetFleetsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new DatabaseFleetResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DatabaseFleetPatch(); + patch.Tags.ReplaceWith(tags); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_Get + /// + /// + /// + /// 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 = _databaseFleetFleetsClientDiagnostics.CreateScope("DatabaseFleetResource.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 _databaseFleetFleetsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DatabaseFleetResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DatabaseFleetPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_Get + /// + /// + /// + /// 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 = _databaseFleetFleetsClientDiagnostics.CreateScope("DatabaseFleetResource.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 = _databaseFleetFleetsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new DatabaseFleetResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DatabaseFleetPatch(); + 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/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/DatabaseFleetUpdateRunCollection.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/DatabaseFleetUpdateRunCollection.cs new file mode 100644 index 000000000000..7ab5e958d599 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/DatabaseFleetUpdateRunCollection.cs @@ -0,0 +1,419 @@ +// 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; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.DatabaseFleetManager +{ + /// + /// 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 GetDatabaseFleetUpdateRuns method from an instance of . + /// + public partial class DatabaseFleetUpdateRunCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _databaseFleetUpdateRunUpdateRunsClientDiagnostics; + private readonly UpdateRunsRestOperations _databaseFleetUpdateRunUpdateRunsRestClient; + + /// Initializes a new instance of the class for mocking. + protected DatabaseFleetUpdateRunCollection() + { + } + + /// 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 DatabaseFleetUpdateRunCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _databaseFleetUpdateRunUpdateRunsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DatabaseFleetManager", DatabaseFleetUpdateRunResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DatabaseFleetUpdateRunResource.ResourceType, out string databaseFleetUpdateRunUpdateRunsApiVersion); + _databaseFleetUpdateRunUpdateRunsRestClient = new UpdateRunsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, databaseFleetUpdateRunUpdateRunsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != DatabaseFleetResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DatabaseFleetResource.ResourceType), nameof(id)); + } + + /// + /// Create a UpdateRun + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName} + /// + /// + /// Operation Id + /// UpdateRuns_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the UpdateRun resource. + /// Resource create parameters. + /// The request should only proceed if an entity matches this string. + /// The request should only proceed if no entity matches this string. + /// 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 updateRunName, DatabaseFleetUpdateRunData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(updateRunName, nameof(updateRunName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _databaseFleetUpdateRunUpdateRunsClientDiagnostics.CreateScope("DatabaseFleetUpdateRunCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _databaseFleetUpdateRunUpdateRunsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, updateRunName, data, ifMatch, ifNoneMatch, cancellationToken).ConfigureAwait(false); + var operation = new DatabaseFleetManagerArmOperation(new DatabaseFleetUpdateRunOperationSource(Client), _databaseFleetUpdateRunUpdateRunsClientDiagnostics, Pipeline, _databaseFleetUpdateRunUpdateRunsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, updateRunName, data, ifMatch, ifNoneMatch).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 UpdateRun + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName} + /// + /// + /// Operation Id + /// UpdateRuns_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the UpdateRun resource. + /// Resource create parameters. + /// The request should only proceed if an entity matches this string. + /// The request should only proceed if no entity matches this string. + /// 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 updateRunName, DatabaseFleetUpdateRunData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(updateRunName, nameof(updateRunName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _databaseFleetUpdateRunUpdateRunsClientDiagnostics.CreateScope("DatabaseFleetUpdateRunCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _databaseFleetUpdateRunUpdateRunsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, updateRunName, data, ifMatch, ifNoneMatch, cancellationToken); + var operation = new DatabaseFleetManagerArmOperation(new DatabaseFleetUpdateRunOperationSource(Client), _databaseFleetUpdateRunUpdateRunsClientDiagnostics, Pipeline, _databaseFleetUpdateRunUpdateRunsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, updateRunName, data, ifMatch, ifNoneMatch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a UpdateRun + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName} + /// + /// + /// Operation Id + /// UpdateRuns_Get + /// + /// + /// + /// The name of the UpdateRun 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 updateRunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(updateRunName, nameof(updateRunName)); + + using var scope = _databaseFleetUpdateRunUpdateRunsClientDiagnostics.CreateScope("DatabaseFleetUpdateRunCollection.Get"); + scope.Start(); + try + { + var response = await _databaseFleetUpdateRunUpdateRunsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, updateRunName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DatabaseFleetUpdateRunResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a UpdateRun + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName} + /// + /// + /// Operation Id + /// UpdateRuns_Get + /// + /// + /// + /// The name of the UpdateRun resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string updateRunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(updateRunName, nameof(updateRunName)); + + using var scope = _databaseFleetUpdateRunUpdateRunsClientDiagnostics.CreateScope("DatabaseFleetUpdateRunCollection.Get"); + scope.Start(); + try + { + var response = _databaseFleetUpdateRunUpdateRunsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, updateRunName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DatabaseFleetUpdateRunResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List UpdateRun resources by Fleet + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns + /// + /// + /// Operation Id + /// UpdateRuns_ListByFleet + /// + /// + /// + /// 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) => _databaseFleetUpdateRunUpdateRunsRestClient.CreateListByFleetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _databaseFleetUpdateRunUpdateRunsRestClient.CreateListByFleetNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DatabaseFleetUpdateRunResource(Client, DatabaseFleetUpdateRunData.DeserializeDatabaseFleetUpdateRunData(e)), _databaseFleetUpdateRunUpdateRunsClientDiagnostics, Pipeline, "DatabaseFleetUpdateRunCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List UpdateRun resources by Fleet + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns + /// + /// + /// Operation Id + /// UpdateRuns_ListByFleet + /// + /// + /// + /// 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) => _databaseFleetUpdateRunUpdateRunsRestClient.CreateListByFleetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _databaseFleetUpdateRunUpdateRunsRestClient.CreateListByFleetNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DatabaseFleetUpdateRunResource(Client, DatabaseFleetUpdateRunData.DeserializeDatabaseFleetUpdateRunData(e)), _databaseFleetUpdateRunUpdateRunsClientDiagnostics, Pipeline, "DatabaseFleetUpdateRunCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName} + /// + /// + /// Operation Id + /// UpdateRuns_Get + /// + /// + /// + /// The name of the UpdateRun 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 updateRunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(updateRunName, nameof(updateRunName)); + + using var scope = _databaseFleetUpdateRunUpdateRunsClientDiagnostics.CreateScope("DatabaseFleetUpdateRunCollection.Exists"); + scope.Start(); + try + { + var response = await _databaseFleetUpdateRunUpdateRunsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, updateRunName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName} + /// + /// + /// Operation Id + /// UpdateRuns_Get + /// + /// + /// + /// The name of the UpdateRun resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string updateRunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(updateRunName, nameof(updateRunName)); + + using var scope = _databaseFleetUpdateRunUpdateRunsClientDiagnostics.CreateScope("DatabaseFleetUpdateRunCollection.Exists"); + scope.Start(); + try + { + var response = _databaseFleetUpdateRunUpdateRunsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, updateRunName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName} + /// + /// + /// Operation Id + /// UpdateRuns_Get + /// + /// + /// + /// The name of the UpdateRun 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 updateRunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(updateRunName, nameof(updateRunName)); + + using var scope = _databaseFleetUpdateRunUpdateRunsClientDiagnostics.CreateScope("DatabaseFleetUpdateRunCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _databaseFleetUpdateRunUpdateRunsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, updateRunName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DatabaseFleetUpdateRunResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName} + /// + /// + /// Operation Id + /// UpdateRuns_Get + /// + /// + /// + /// The name of the UpdateRun resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string updateRunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(updateRunName, nameof(updateRunName)); + + using var scope = _databaseFleetUpdateRunUpdateRunsClientDiagnostics.CreateScope("DatabaseFleetUpdateRunCollection.GetIfExists"); + scope.Start(); + try + { + var response = _databaseFleetUpdateRunUpdateRunsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, updateRunName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DatabaseFleetUpdateRunResource(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/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/DatabaseFleetUpdateRunData.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/DatabaseFleetUpdateRunData.cs new file mode 100644 index 000000000000..772fc6730a74 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/DatabaseFleetUpdateRunData.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.ResourceManager.DatabaseFleetManager.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DatabaseFleetManager +{ + /// + /// A class representing the DatabaseFleetUpdateRun data model. + /// An UpdateRun is a multi-stage process to perform update operations across members of a Fleet. + /// + public partial class DatabaseFleetUpdateRunData : ResourceData + { + /// Initializes a new instance of DatabaseFleetUpdateRunData. + public DatabaseFleetUpdateRunData() + { + } + + /// Initializes a new instance of DatabaseFleetUpdateRunData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + /// The provisioning state of the UpdateRun resource. + /// + /// The strategy defines the order in which the clusters will be updated. + /// If not set, all members will be updated sequentially. The UpdateRun status will show a single UpdateStage and a single UpdateGroup targeting all members. + /// The strategy of the UpdateRun can be modified until the run is started. + /// + /// The update to be applied to all clusters in the UpdateRun. The managedClusterUpdate can be modified until the run is started. + /// The status of the UpdateRun. + internal DatabaseFleetUpdateRunData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ETag? eTag, FleetUpdateRunProvisioningState? provisioningState, FleetUpdateRunStrategy strategy, FleetManagedClusterUpdate managedClusterUpdate, FleetUpdateRunStatus status) : base(id, name, resourceType, systemData) + { + ETag = eTag; + ProvisioningState = provisioningState; + Strategy = strategy; + ManagedClusterUpdate = managedClusterUpdate; + Status = status; + } + + /// If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + public ETag? ETag { get; } + /// The provisioning state of the UpdateRun resource. + public FleetUpdateRunProvisioningState? ProvisioningState { get; } + /// + /// The strategy defines the order in which the clusters will be updated. + /// If not set, all members will be updated sequentially. The UpdateRun status will show a single UpdateStage and a single UpdateGroup targeting all members. + /// The strategy of the UpdateRun can be modified until the run is started. + /// + internal FleetUpdateRunStrategy Strategy { get; set; } + /// The list of stages that compose this update run. + public IList StrategyStages + { + get => Strategy is null ? default : Strategy.Stages; + set => Strategy = new FleetUpdateRunStrategy(value); + } + + /// The update to be applied to all clusters in the UpdateRun. The managedClusterUpdate can be modified until the run is started. + public FleetManagedClusterUpdate ManagedClusterUpdate { get; set; } + /// The status of the UpdateRun. + public FleetUpdateRunStatus Status { get; } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/DatabaseFleetUpdateRunResource.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/DatabaseFleetUpdateRunResource.cs new file mode 100644 index 000000000000..43a937381106 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/DatabaseFleetUpdateRunResource.cs @@ -0,0 +1,443 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.DatabaseFleetManager +{ + /// + /// A Class representing a DatabaseFleetUpdateRun 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 GetDatabaseFleetUpdateRunResource method. + /// Otherwise you can get one from its parent resource using the GetDatabaseFleetUpdateRun method. + /// + public partial class DatabaseFleetUpdateRunResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string fleetName, string updateRunName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _databaseFleetUpdateRunUpdateRunsClientDiagnostics; + private readonly UpdateRunsRestOperations _databaseFleetUpdateRunUpdateRunsRestClient; + private readonly DatabaseFleetUpdateRunData _data; + + /// Initializes a new instance of the class for mocking. + protected DatabaseFleetUpdateRunResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DatabaseFleetUpdateRunResource(ArmClient client, DatabaseFleetUpdateRunData 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 DatabaseFleetUpdateRunResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _databaseFleetUpdateRunUpdateRunsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DatabaseFleetManager", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string databaseFleetUpdateRunUpdateRunsApiVersion); + _databaseFleetUpdateRunUpdateRunsRestClient = new UpdateRunsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, databaseFleetUpdateRunUpdateRunsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ContainerService/fleets/updateRuns"; + + /// 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 DatabaseFleetUpdateRunData 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 UpdateRun + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName} + /// + /// + /// Operation Id + /// UpdateRuns_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _databaseFleetUpdateRunUpdateRunsClientDiagnostics.CreateScope("DatabaseFleetUpdateRunResource.Get"); + scope.Start(); + try + { + var response = await _databaseFleetUpdateRunUpdateRunsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DatabaseFleetUpdateRunResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a UpdateRun + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName} + /// + /// + /// Operation Id + /// UpdateRuns_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _databaseFleetUpdateRunUpdateRunsClientDiagnostics.CreateScope("DatabaseFleetUpdateRunResource.Get"); + scope.Start(); + try + { + var response = _databaseFleetUpdateRunUpdateRunsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DatabaseFleetUpdateRunResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a UpdateRun + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName} + /// + /// + /// Operation Id + /// UpdateRuns_Delete + /// + /// + /// + /// 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 request should only proceed if an entity matches this string. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, string ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _databaseFleetUpdateRunUpdateRunsClientDiagnostics.CreateScope("DatabaseFleetUpdateRunResource.Delete"); + scope.Start(); + try + { + var response = await _databaseFleetUpdateRunUpdateRunsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new DatabaseFleetManagerArmOperation(_databaseFleetUpdateRunUpdateRunsClientDiagnostics, Pipeline, _databaseFleetUpdateRunUpdateRunsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch).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 UpdateRun + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName} + /// + /// + /// Operation Id + /// UpdateRuns_Delete + /// + /// + /// + /// 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 request should only proceed if an entity matches this string. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, string ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _databaseFleetUpdateRunUpdateRunsClientDiagnostics.CreateScope("DatabaseFleetUpdateRunResource.Delete"); + scope.Start(); + try + { + var response = _databaseFleetUpdateRunUpdateRunsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new DatabaseFleetManagerArmOperation(_databaseFleetUpdateRunUpdateRunsClientDiagnostics, Pipeline, _databaseFleetUpdateRunUpdateRunsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a UpdateRun + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName} + /// + /// + /// Operation Id + /// UpdateRuns_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Resource create parameters. + /// The request should only proceed if an entity matches this string. + /// The request should only proceed if no entity matches this string. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, DatabaseFleetUpdateRunData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _databaseFleetUpdateRunUpdateRunsClientDiagnostics.CreateScope("DatabaseFleetUpdateRunResource.Update"); + scope.Start(); + try + { + var response = await _databaseFleetUpdateRunUpdateRunsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch, ifNoneMatch, cancellationToken).ConfigureAwait(false); + var operation = new DatabaseFleetManagerArmOperation(new DatabaseFleetUpdateRunOperationSource(Client), _databaseFleetUpdateRunUpdateRunsClientDiagnostics, Pipeline, _databaseFleetUpdateRunUpdateRunsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch, ifNoneMatch).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 UpdateRun + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName} + /// + /// + /// Operation Id + /// UpdateRuns_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Resource create parameters. + /// The request should only proceed if an entity matches this string. + /// The request should only proceed if no entity matches this string. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, DatabaseFleetUpdateRunData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _databaseFleetUpdateRunUpdateRunsClientDiagnostics.CreateScope("DatabaseFleetUpdateRunResource.Update"); + scope.Start(); + try + { + var response = _databaseFleetUpdateRunUpdateRunsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch, ifNoneMatch, cancellationToken); + var operation = new DatabaseFleetManagerArmOperation(new DatabaseFleetUpdateRunOperationSource(Client), _databaseFleetUpdateRunUpdateRunsClientDiagnostics, Pipeline, _databaseFleetUpdateRunUpdateRunsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch, ifNoneMatch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Starts an UpdateRun. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/start + /// + /// + /// Operation Id + /// UpdateRuns_Start + /// + /// + /// + /// 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 request should only proceed if an entity matches this string. + /// The cancellation token to use. + public virtual async Task> StartAsync(WaitUntil waitUntil, string ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _databaseFleetUpdateRunUpdateRunsClientDiagnostics.CreateScope("DatabaseFleetUpdateRunResource.Start"); + scope.Start(); + try + { + var response = await _databaseFleetUpdateRunUpdateRunsRestClient.StartAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new DatabaseFleetManagerArmOperation(new DatabaseFleetUpdateRunOperationSource(Client), _databaseFleetUpdateRunUpdateRunsClientDiagnostics, Pipeline, _databaseFleetUpdateRunUpdateRunsRestClient.CreateStartRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Starts an UpdateRun. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/start + /// + /// + /// Operation Id + /// UpdateRuns_Start + /// + /// + /// + /// 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 request should only proceed if an entity matches this string. + /// The cancellation token to use. + public virtual ArmOperation Start(WaitUntil waitUntil, string ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _databaseFleetUpdateRunUpdateRunsClientDiagnostics.CreateScope("DatabaseFleetUpdateRunResource.Start"); + scope.Start(); + try + { + var response = _databaseFleetUpdateRunUpdateRunsRestClient.Start(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new DatabaseFleetManagerArmOperation(new DatabaseFleetUpdateRunOperationSource(Client), _databaseFleetUpdateRunUpdateRunsClientDiagnostics, Pipeline, _databaseFleetUpdateRunUpdateRunsRestClient.CreateStartRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Stops an UpdateRun. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/stop + /// + /// + /// Operation Id + /// UpdateRuns_Stop + /// + /// + /// + /// 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 request should only proceed if an entity matches this string. + /// The cancellation token to use. + public virtual async Task> StopAsync(WaitUntil waitUntil, string ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _databaseFleetUpdateRunUpdateRunsClientDiagnostics.CreateScope("DatabaseFleetUpdateRunResource.Stop"); + scope.Start(); + try + { + var response = await _databaseFleetUpdateRunUpdateRunsRestClient.StopAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new DatabaseFleetManagerArmOperation(new DatabaseFleetUpdateRunOperationSource(Client), _databaseFleetUpdateRunUpdateRunsClientDiagnostics, Pipeline, _databaseFleetUpdateRunUpdateRunsRestClient.CreateStopRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Stops an UpdateRun. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/stop + /// + /// + /// Operation Id + /// UpdateRuns_Stop + /// + /// + /// + /// 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 request should only proceed if an entity matches this string. + /// The cancellation token to use. + public virtual ArmOperation Stop(WaitUntil waitUntil, string ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _databaseFleetUpdateRunUpdateRunsClientDiagnostics.CreateScope("DatabaseFleetUpdateRunResource.Stop"); + scope.Start(); + try + { + var response = _databaseFleetUpdateRunUpdateRunsRestClient.Stop(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new DatabaseFleetManagerArmOperation(new DatabaseFleetUpdateRunOperationSource(Client), _databaseFleetUpdateRunUpdateRunsClientDiagnostics, Pipeline, _databaseFleetUpdateRunUpdateRunsRestClient.CreateStopRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Extensions/DatabaseFleetManagerExtensions.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Extensions/DatabaseFleetManagerExtensions.cs new file mode 100644 index 000000000000..0ed163b3dbe3 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Extensions/DatabaseFleetManagerExtensions.cs @@ -0,0 +1,207 @@ +// 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; +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.DatabaseFleetManager +{ + /// A class to add extension methods to Azure.ResourceManager.DatabaseFleetManager. + public static partial class DatabaseFleetManagerExtensions + { + private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + { + return resource.GetCachedClient(client => + { + return new ResourceGroupResourceExtensionClient(client, resource.Id); + }); + } + + private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + { + return client.GetResourceClient(() => + { + return new ResourceGroupResourceExtensionClient(client, scope); + }); + } + + private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + { + return resource.GetCachedClient(client => + { + return new SubscriptionResourceExtensionClient(client, resource.Id); + }); + } + + private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + { + return client.GetResourceClient(() => + { + return new SubscriptionResourceExtensionClient(client, scope); + }); + } + #region DatabaseFleetResource + /// + /// 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 instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static DatabaseFleetResource GetDatabaseFleetResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + DatabaseFleetResource.ValidateResourceId(id); + return new DatabaseFleetResource(client, id); + } + ); + } + #endregion + + #region DatabaseFleetMemberResource + /// + /// 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 instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static DatabaseFleetMemberResource GetDatabaseFleetMemberResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + DatabaseFleetMemberResource.ValidateResourceId(id); + return new DatabaseFleetMemberResource(client, id); + } + ); + } + #endregion + + #region DatabaseFleetUpdateRunResource + /// + /// 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 instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static DatabaseFleetUpdateRunResource GetDatabaseFleetUpdateRunResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + DatabaseFleetUpdateRunResource.ValidateResourceId(id); + return new DatabaseFleetUpdateRunResource(client, id); + } + ); + } + #endregion + + /// Gets a collection of DatabaseFleetResources in the ResourceGroupResource. + /// The instance the method will execute against. + /// An object representing collection of DatabaseFleetResources and their operations over a DatabaseFleetResource. + public static DatabaseFleetCollection GetDatabaseFleets(this ResourceGroupResource resourceGroupResource) + { + return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDatabaseFleets(); + } + + /// + /// Gets a Fleet. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_Get + /// + /// + /// + /// The instance the method will execute against. + /// The name of the Fleet resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public static async Task> GetDatabaseFleetAsync(this ResourceGroupResource resourceGroupResource, string fleetName, CancellationToken cancellationToken = default) + { + return await resourceGroupResource.GetDatabaseFleets().GetAsync(fleetName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a Fleet. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_Get + /// + /// + /// + /// The instance the method will execute against. + /// The name of the Fleet resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public static Response GetDatabaseFleet(this ResourceGroupResource resourceGroupResource, string fleetName, CancellationToken cancellationToken = default) + { + return resourceGroupResource.GetDatabaseFleets().Get(fleetName, cancellationToken); + } + + /// + /// Lists fleets in the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/fleets + /// + /// + /// Operation Id + /// Fleets_ListBySubscription + /// + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetDatabaseFleetsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDatabaseFleetsAsync(cancellationToken); + } + + /// + /// Lists fleets in the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/fleets + /// + /// + /// Operation Id + /// Fleets_ListBySubscription + /// + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetDatabaseFleets(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDatabaseFleets(cancellationToken); + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs new file mode 100644 index 000000000000..0e28b7080602 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.DatabaseFleetManager +{ + /// A class to add extension methods to ResourceGroupResource. + internal partial class ResourceGroupResourceExtensionClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected ResourceGroupResourceExtensionClient() + { + } + + /// 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 ResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of DatabaseFleetResources in the ResourceGroupResource. + /// An object representing collection of DatabaseFleetResources and their operations over a DatabaseFleetResource. + public virtual DatabaseFleetCollection GetDatabaseFleets() + { + return GetCachedClient(Client => new DatabaseFleetCollection(Client, Id)); + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs new file mode 100644 index 000000000000..e19ae88235b0 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.DatabaseFleetManager +{ + /// A class to add extension methods to SubscriptionResource. + internal partial class SubscriptionResourceExtensionClient : ArmResource + { + private ClientDiagnostics _databaseFleetFleetsClientDiagnostics; + private FleetsRestOperations _databaseFleetFleetsRestClient; + + /// Initializes a new instance of the class for mocking. + protected SubscriptionResourceExtensionClient() + { + } + + /// 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 SubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics DatabaseFleetFleetsClientDiagnostics => _databaseFleetFleetsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DatabaseFleetManager", DatabaseFleetResource.ResourceType.Namespace, Diagnostics); + private FleetsRestOperations DatabaseFleetFleetsRestClient => _databaseFleetFleetsRestClient ??= new FleetsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DatabaseFleetResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Lists fleets in the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/fleets + /// + /// + /// Operation Id + /// Fleets_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDatabaseFleetsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DatabaseFleetFleetsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DatabaseFleetFleetsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DatabaseFleetResource(Client, DatabaseFleetData.DeserializeDatabaseFleetData(e)), DatabaseFleetFleetsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDatabaseFleets", "value", "nextLink", cancellationToken); + } + + /// + /// Lists fleets in the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/fleets + /// + /// + /// Operation Id + /// Fleets_ListBySubscription + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDatabaseFleets(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DatabaseFleetFleetsRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DatabaseFleetFleetsRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DatabaseFleetResource(Client, DatabaseFleetData.DeserializeDatabaseFleetData(e)), DatabaseFleetFleetsClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDatabaseFleets", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/LongRunningOperation/DatabaseFleetManagerArmOperation.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/LongRunningOperation/DatabaseFleetManagerArmOperation.cs new file mode 100644 index 000000000000..919c363d8a1c --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/LongRunningOperation/DatabaseFleetManagerArmOperation.cs @@ -0,0 +1,70 @@ +// 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; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.DatabaseFleetManager +{ +#pragma warning disable SA1649 // File name should match first type name + internal class DatabaseFleetManagerArmOperation : ArmOperation +#pragma warning restore SA1649 // File name should match first type name + { + private readonly OperationInternal _operation; + + /// Initializes a new instance of DatabaseFleetManagerArmOperation for mocking. + protected DatabaseFleetManagerArmOperation() + { + } + + internal DatabaseFleetManagerArmOperation(Response response) + { + _operation = OperationInternal.Succeeded(response); + } + + internal DatabaseFleetManagerArmOperation(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); + _operation = new OperationInternal(nextLinkOperation, clientDiagnostics, response, "DatabaseFleetManagerArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + } + + /// +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 + + /// + 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/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/LongRunningOperation/DatabaseFleetManagerArmOperationOfT.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/LongRunningOperation/DatabaseFleetManagerArmOperationOfT.cs new file mode 100644 index 000000000000..ce6524018cef --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/LongRunningOperation/DatabaseFleetManagerArmOperationOfT.cs @@ -0,0 +1,76 @@ +// 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; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.DatabaseFleetManager +{ +#pragma warning disable SA1649 // File name should match first type name + internal class DatabaseFleetManagerArmOperation : ArmOperation +#pragma warning restore SA1649 // File name should match first type name + { + private readonly OperationInternal _operation; + + /// Initializes a new instance of DatabaseFleetManagerArmOperation for mocking. + protected DatabaseFleetManagerArmOperation() + { + } + + internal DatabaseFleetManagerArmOperation(Response response) + { + _operation = OperationInternal.Succeeded(response.GetRawResponse(), response.Value); + } + + internal DatabaseFleetManagerArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response, OperationFinalStateVia finalStateVia, bool skipApiVersionOverride = false, string apiVersionOverrideValue = null) + { + var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, skipApiVersionOverride, apiVersionOverrideValue); + _operation = new OperationInternal(nextLinkOperation, clientDiagnostics, response, "DatabaseFleetManagerArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + } + + /// +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 + + /// + 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/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/LongRunningOperation/DatabaseFleetMemberOperationSource.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/LongRunningOperation/DatabaseFleetMemberOperationSource.cs new file mode 100644 index 000000000000..f5cd6ee59d42 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/LongRunningOperation/DatabaseFleetMemberOperationSource.cs @@ -0,0 +1,40 @@ +// 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; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.DatabaseFleetManager +{ + internal class DatabaseFleetMemberOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal DatabaseFleetMemberOperationSource(ArmClient client) + { + _client = client; + } + + DatabaseFleetMemberResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = DatabaseFleetMemberData.DeserializeDatabaseFleetMemberData(document.RootElement); + return new DatabaseFleetMemberResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = DatabaseFleetMemberData.DeserializeDatabaseFleetMemberData(document.RootElement); + return new DatabaseFleetMemberResource(_client, data); + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/LongRunningOperation/DatabaseFleetOperationSource.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/LongRunningOperation/DatabaseFleetOperationSource.cs new file mode 100644 index 000000000000..642cbbd2af37 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/LongRunningOperation/DatabaseFleetOperationSource.cs @@ -0,0 +1,40 @@ +// 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; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.DatabaseFleetManager +{ + internal class DatabaseFleetOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal DatabaseFleetOperationSource(ArmClient client) + { + _client = client; + } + + DatabaseFleetResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = DatabaseFleetData.DeserializeDatabaseFleetData(document.RootElement); + return new DatabaseFleetResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = DatabaseFleetData.DeserializeDatabaseFleetData(document.RootElement); + return new DatabaseFleetResource(_client, data); + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/LongRunningOperation/DatabaseFleetUpdateRunOperationSource.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/LongRunningOperation/DatabaseFleetUpdateRunOperationSource.cs new file mode 100644 index 000000000000..a827cb262a6e --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/LongRunningOperation/DatabaseFleetUpdateRunOperationSource.cs @@ -0,0 +1,40 @@ +// 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; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.DatabaseFleetManager +{ + internal class DatabaseFleetUpdateRunOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal DatabaseFleetUpdateRunOperationSource(ArmClient client) + { + _client = client; + } + + DatabaseFleetUpdateRunResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = DatabaseFleetUpdateRunData.DeserializeDatabaseFleetUpdateRunData(document.RootElement); + return new DatabaseFleetUpdateRunResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = DatabaseFleetUpdateRunData.DeserializeDatabaseFleetUpdateRunData(document.RootElement); + return new DatabaseFleetUpdateRunResource(_client, data); + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/DatabaseFleetData.Serialization.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/DatabaseFleetData.Serialization.cs new file mode 100644 index 000000000000..0e112257e018 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/DatabaseFleetData.Serialization.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; +using Azure.ResourceManager.DatabaseFleetManager.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DatabaseFleetManager +{ + public partial class DatabaseFleetData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + JsonSerializer.Serialize(writer, Identity); + } + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(HubProfile)) + { + writer.WritePropertyName("hubProfile"u8); + writer.WriteObjectValue(HubProfile); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static DatabaseFleetData DeserializeDatabaseFleetData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional eTag = default; + Optional identity = default; + Optional> tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional provisioningState = default; + Optional hubProfile = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("eTag"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + eTag = new ETag(property.Value.GetString()); + continue; + } + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("location"u8)) + { + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("provisioningState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new FleetProvisioningState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("hubProfile"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + hubProfile = FleetHubProfile.DeserializeFleetHubProfile(property0.Value); + continue; + } + } + continue; + } + } + return new DatabaseFleetData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(eTag), identity, Optional.ToNullable(provisioningState), hubProfile.Value); + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/DatabaseFleetListResult.Serialization.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/DatabaseFleetListResult.Serialization.cs new file mode 100644 index 000000000000..fb5b785d54bc --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/DatabaseFleetListResult.Serialization.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.DatabaseFleetManager; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + internal partial class DatabaseFleetListResult + { + internal static DatabaseFleetListResult DeserializeDatabaseFleetListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DatabaseFleetData.DeserializeDatabaseFleetData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + } + return new DatabaseFleetListResult(value, nextLink.Value); + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/DatabaseFleetListResult.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/DatabaseFleetListResult.cs new file mode 100644 index 000000000000..f87c68cbc503 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/DatabaseFleetListResult.cs @@ -0,0 +1,43 @@ +// 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.DatabaseFleetManager; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + /// The response of a Fleet list operation. + internal partial class DatabaseFleetListResult + { + /// Initializes a new instance of DatabaseFleetListResult. + /// The Fleet items on this page. + /// is null. + internal DatabaseFleetListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of DatabaseFleetListResult. + /// The Fleet items on this page. + /// The link to the next page of items. + internal DatabaseFleetListResult(IReadOnlyList value, Uri nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// The Fleet items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/DatabaseFleetMemberData.Serialization.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/DatabaseFleetMemberData.Serialization.cs new file mode 100644 index 000000000000..3b4a63c01087 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/DatabaseFleetMemberData.Serialization.cs @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure; +using Azure.Core; +using Azure.ResourceManager.DatabaseFleetManager.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DatabaseFleetManager +{ + public partial class DatabaseFleetMemberData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(ClusterResourceId)) + { + writer.WritePropertyName("clusterResourceId"u8); + writer.WriteStringValue(ClusterResourceId); + } + if (Optional.IsDefined(Group)) + { + writer.WritePropertyName("group"u8); + writer.WriteStringValue(Group); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static DatabaseFleetMemberData DeserializeDatabaseFleetMemberData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional eTag = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional clusterResourceId = default; + Optional group = default; + Optional provisioningState = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("eTag"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + eTag = new ETag(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 (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("clusterResourceId"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + clusterResourceId = new ResourceIdentifier(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("group"u8)) + { + group = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("provisioningState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new FleetMemberProvisioningState(property0.Value.GetString()); + continue; + } + } + continue; + } + } + return new DatabaseFleetMemberData(id, name, type, systemData.Value, Optional.ToNullable(eTag), clusterResourceId.Value, group.Value, Optional.ToNullable(provisioningState)); + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/DatabaseFleetMemberListResult.Serialization.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/DatabaseFleetMemberListResult.Serialization.cs new file mode 100644 index 000000000000..cac46b02ec61 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/DatabaseFleetMemberListResult.Serialization.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.DatabaseFleetManager; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + internal partial class DatabaseFleetMemberListResult + { + internal static DatabaseFleetMemberListResult DeserializeDatabaseFleetMemberListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DatabaseFleetMemberData.DeserializeDatabaseFleetMemberData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + } + return new DatabaseFleetMemberListResult(value, nextLink.Value); + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/DatabaseFleetMemberListResult.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/DatabaseFleetMemberListResult.cs new file mode 100644 index 000000000000..5f72f3dee3f8 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/DatabaseFleetMemberListResult.cs @@ -0,0 +1,43 @@ +// 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.DatabaseFleetManager; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + /// The response of a FleetMember list operation. + internal partial class DatabaseFleetMemberListResult + { + /// Initializes a new instance of DatabaseFleetMemberListResult. + /// The FleetMember items on this page. + /// is null. + internal DatabaseFleetMemberListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of DatabaseFleetMemberListResult. + /// The FleetMember items on this page. + /// The link to the next page of items. + internal DatabaseFleetMemberListResult(IReadOnlyList value, Uri nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// The FleetMember items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/DatabaseFleetMemberPatch.Serialization.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/DatabaseFleetMemberPatch.Serialization.cs new file mode 100644 index 000000000000..2643648a6172 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/DatabaseFleetMemberPatch.Serialization.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + public partial class DatabaseFleetMemberPatch : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Group)) + { + writer.WritePropertyName("group"u8); + writer.WriteStringValue(Group); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/DatabaseFleetMemberPatch.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/DatabaseFleetMemberPatch.cs new file mode 100644 index 000000000000..050e7800e9f5 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/DatabaseFleetMemberPatch.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + /// The type used for update operations of the FleetMember. + public partial class DatabaseFleetMemberPatch + { + /// Initializes a new instance of DatabaseFleetMemberPatch. + public DatabaseFleetMemberPatch() + { + } + + /// The group this member belongs to for multi-cluster update management. + public string Group { get; set; } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/DatabaseFleetPatch.Serialization.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/DatabaseFleetPatch.Serialization.cs new file mode 100644 index 000000000000..19ce4caa75c6 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/DatabaseFleetPatch.Serialization.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + public partial class DatabaseFleetPatch : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + JsonSerializer.Serialize(writer, Identity); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/DatabaseFleetPatch.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/DatabaseFleetPatch.cs new file mode 100644 index 000000000000..f71f160cd99d --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/DatabaseFleetPatch.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + /// Properties of a Fleet that can be patched. + public partial class DatabaseFleetPatch + { + /// Initializes a new instance of DatabaseFleetPatch. + public DatabaseFleetPatch() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Resource tags. + public IDictionary Tags { get; } + /// Managed identity. + public ManagedServiceIdentity Identity { get; set; } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/DatabaseFleetUpdateRunData.Serialization.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/DatabaseFleetUpdateRunData.Serialization.cs new file mode 100644 index 000000000000..ac086cb4daf2 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/DatabaseFleetUpdateRunData.Serialization.cs @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure; +using Azure.Core; +using Azure.ResourceManager.DatabaseFleetManager.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DatabaseFleetManager +{ + public partial class DatabaseFleetUpdateRunData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Strategy)) + { + writer.WritePropertyName("strategy"u8); + writer.WriteObjectValue(Strategy); + } + if (Optional.IsDefined(ManagedClusterUpdate)) + { + writer.WritePropertyName("managedClusterUpdate"u8); + writer.WriteObjectValue(ManagedClusterUpdate); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static DatabaseFleetUpdateRunData DeserializeDatabaseFleetUpdateRunData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional eTag = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional provisioningState = default; + Optional strategy = default; + Optional managedClusterUpdate = default; + Optional status = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("eTag"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + eTag = new ETag(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 (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("provisioningState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new FleetUpdateRunProvisioningState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("strategy"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + strategy = FleetUpdateRunStrategy.DeserializeFleetUpdateRunStrategy(property0.Value); + continue; + } + if (property0.NameEquals("managedClusterUpdate"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + managedClusterUpdate = FleetManagedClusterUpdate.DeserializeFleetManagedClusterUpdate(property0.Value); + continue; + } + if (property0.NameEquals("status"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = FleetUpdateRunStatus.DeserializeFleetUpdateRunStatus(property0.Value); + continue; + } + } + continue; + } + } + return new DatabaseFleetUpdateRunData(id, name, type, systemData.Value, Optional.ToNullable(eTag), Optional.ToNullable(provisioningState), strategy.Value, managedClusterUpdate.Value, status.Value); + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/DatabaseFleetUpdateRunListResult.Serialization.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/DatabaseFleetUpdateRunListResult.Serialization.cs new file mode 100644 index 000000000000..8159698fd7e9 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/DatabaseFleetUpdateRunListResult.Serialization.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.DatabaseFleetManager; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + internal partial class DatabaseFleetUpdateRunListResult + { + internal static DatabaseFleetUpdateRunListResult DeserializeDatabaseFleetUpdateRunListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DatabaseFleetUpdateRunData.DeserializeDatabaseFleetUpdateRunData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + } + return new DatabaseFleetUpdateRunListResult(value, nextLink.Value); + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/DatabaseFleetUpdateRunListResult.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/DatabaseFleetUpdateRunListResult.cs new file mode 100644 index 000000000000..7020492252ce --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/DatabaseFleetUpdateRunListResult.cs @@ -0,0 +1,43 @@ +// 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.DatabaseFleetManager; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + /// The response of a UpdateRun list operation. + internal partial class DatabaseFleetUpdateRunListResult + { + /// Initializes a new instance of DatabaseFleetUpdateRunListResult. + /// The UpdateRun items on this page. + /// is null. + internal DatabaseFleetUpdateRunListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of DatabaseFleetUpdateRunListResult. + /// The UpdateRun items on this page. + /// The link to the next page of items. + internal DatabaseFleetUpdateRunListResult(IReadOnlyList value, Uri nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// The UpdateRun items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetAgentProfile.Serialization.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetAgentProfile.Serialization.cs new file mode 100644 index 000000000000..47979ab8ba4f --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetAgentProfile.Serialization.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + internal partial class FleetAgentProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(SubnetId)) + { + writer.WritePropertyName("subnetId"u8); + writer.WriteStringValue(SubnetId); + } + writer.WriteEndObject(); + } + + internal static FleetAgentProfile DeserializeFleetAgentProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional subnetId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("subnetId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + subnetId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + } + return new FleetAgentProfile(subnetId.Value); + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetAgentProfile.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetAgentProfile.cs new file mode 100644 index 000000000000..a7561af97109 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetAgentProfile.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + /// Agent profile for the Fleet hub. + internal partial class FleetAgentProfile + { + /// Initializes a new instance of FleetAgentProfile. + public FleetAgentProfile() + { + } + + /// Initializes a new instance of FleetAgentProfile. + /// The ID of the subnet which the Fleet hub node will join on startup. If this is not specified, a vnet and subnet will be generated and used. + internal FleetAgentProfile(ResourceIdentifier subnetId) + { + SubnetId = subnetId; + } + + /// The ID of the subnet which the Fleet hub node will join on startup. If this is not specified, a vnet and subnet will be generated and used. + public ResourceIdentifier SubnetId { get; set; } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetApiServerAccessProfile.Serialization.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetApiServerAccessProfile.Serialization.cs new file mode 100644 index 000000000000..66d71c70d689 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetApiServerAccessProfile.Serialization.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + public partial class FleetApiServerAccessProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(EnablePrivateCluster)) + { + writer.WritePropertyName("enablePrivateCluster"u8); + writer.WriteBooleanValue(EnablePrivateCluster.Value); + } + if (Optional.IsDefined(EnableVnetIntegration)) + { + writer.WritePropertyName("enableVnetIntegration"u8); + writer.WriteBooleanValue(EnableVnetIntegration.Value); + } + if (Optional.IsDefined(SubnetId)) + { + writer.WritePropertyName("subnetId"u8); + writer.WriteStringValue(SubnetId); + } + writer.WriteEndObject(); + } + + internal static FleetApiServerAccessProfile DeserializeFleetApiServerAccessProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional enablePrivateCluster = default; + Optional enableVnetIntegration = default; + Optional subnetId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("enablePrivateCluster"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enablePrivateCluster = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("enableVnetIntegration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enableVnetIntegration = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("subnetId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + subnetId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + } + return new FleetApiServerAccessProfile(Optional.ToNullable(enablePrivateCluster), Optional.ToNullable(enableVnetIntegration), subnetId.Value); + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetApiServerAccessProfile.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetApiServerAccessProfile.cs new file mode 100644 index 000000000000..c6a49dcdc710 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetApiServerAccessProfile.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + /// Access profile for the Fleet hub API server. + public partial class FleetApiServerAccessProfile + { + /// Initializes a new instance of FleetApiServerAccessProfile. + public FleetApiServerAccessProfile() + { + } + + /// Initializes a new instance of FleetApiServerAccessProfile. + /// Whether to create the Fleet hub as a private cluster or not. + /// Whether to enable apiserver vnet integration for the Fleet hub or not. + /// The subnet to be used when apiserver vnet integration is enabled. It is required when creating a new Fleet with BYO vnet. + internal FleetApiServerAccessProfile(bool? enablePrivateCluster, bool? enableVnetIntegration, ResourceIdentifier subnetId) + { + EnablePrivateCluster = enablePrivateCluster; + EnableVnetIntegration = enableVnetIntegration; + SubnetId = subnetId; + } + + /// Whether to create the Fleet hub as a private cluster or not. + public bool? EnablePrivateCluster { get; set; } + /// Whether to enable apiserver vnet integration for the Fleet hub or not. + public bool? EnableVnetIntegration { get; set; } + /// The subnet to be used when apiserver vnet integration is enabled. It is required when creating a new Fleet with BYO vnet. + public ResourceIdentifier SubnetId { get; set; } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetCredentialResult.Serialization.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetCredentialResult.Serialization.cs new file mode 100644 index 000000000000..533e6ffc92f5 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetCredentialResult.Serialization.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + public partial class FleetCredentialResult + { + internal static FleetCredentialResult DeserializeFleetCredentialResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + value = property.Value.GetBytesFromBase64("D"); + continue; + } + } + return new FleetCredentialResult(name.Value, value.Value); + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetCredentialResult.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetCredentialResult.cs new file mode 100644 index 000000000000..20263d16cbd1 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetCredentialResult.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + /// One credential result item. + public partial class FleetCredentialResult + { + /// Initializes a new instance of FleetCredentialResult. + internal FleetCredentialResult() + { + } + + /// Initializes a new instance of FleetCredentialResult. + /// The name of the credential. + /// Base64-encoded Kubernetes configuration file. + internal FleetCredentialResult(string name, byte[] value) + { + Name = name; + Value = value; + } + + /// The name of the credential. + public string Name { get; } + /// Base64-encoded Kubernetes configuration file. + public byte[] Value { get; } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetCredentialResults.Serialization.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetCredentialResults.Serialization.cs new file mode 100644 index 000000000000..b825a4e1836b --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetCredentialResults.Serialization.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + public partial class FleetCredentialResults + { + internal static FleetCredentialResults DeserializeFleetCredentialResults(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> kubeconfigs = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kubeconfigs"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(FleetCredentialResult.DeserializeFleetCredentialResult(item)); + } + kubeconfigs = array; + continue; + } + } + return new FleetCredentialResults(Optional.ToList(kubeconfigs)); + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetCredentialResults.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetCredentialResults.cs new file mode 100644 index 000000000000..442739512d50 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetCredentialResults.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + /// The Credential results response. + public partial class FleetCredentialResults + { + /// Initializes a new instance of FleetCredentialResults. + internal FleetCredentialResults() + { + Kubeconfigs = new ChangeTrackingList(); + } + + /// Initializes a new instance of FleetCredentialResults. + /// Array of base64-encoded Kubernetes configuration files. + internal FleetCredentialResults(IReadOnlyList kubeconfigs) + { + Kubeconfigs = kubeconfigs; + } + + /// Array of base64-encoded Kubernetes configuration files. + public IReadOnlyList Kubeconfigs { get; } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetHubProfile.Serialization.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetHubProfile.Serialization.cs new file mode 100644 index 000000000000..aac61ef840c1 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetHubProfile.Serialization.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + public partial class FleetHubProfile : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(DnsPrefix)) + { + writer.WritePropertyName("dnsPrefix"u8); + writer.WriteStringValue(DnsPrefix); + } + if (Optional.IsDefined(ApiServerAccessProfile)) + { + writer.WritePropertyName("apiServerAccessProfile"u8); + writer.WriteObjectValue(ApiServerAccessProfile); + } + if (Optional.IsDefined(AgentProfile)) + { + writer.WritePropertyName("agentProfile"u8); + writer.WriteObjectValue(AgentProfile); + } + writer.WriteEndObject(); + } + + internal static FleetHubProfile DeserializeFleetHubProfile(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional dnsPrefix = default; + Optional apiServerAccessProfile = default; + Optional agentProfile = default; + Optional fqdn = default; + Optional kubernetesVersion = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("dnsPrefix"u8)) + { + dnsPrefix = property.Value.GetString(); + continue; + } + if (property.NameEquals("apiServerAccessProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + apiServerAccessProfile = FleetApiServerAccessProfile.DeserializeFleetApiServerAccessProfile(property.Value); + continue; + } + if (property.NameEquals("agentProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + agentProfile = FleetAgentProfile.DeserializeFleetAgentProfile(property.Value); + continue; + } + if (property.NameEquals("fqdn"u8)) + { + fqdn = property.Value.GetString(); + continue; + } + if (property.NameEquals("kubernetesVersion"u8)) + { + kubernetesVersion = property.Value.GetString(); + continue; + } + } + return new FleetHubProfile(dnsPrefix.Value, apiServerAccessProfile.Value, agentProfile.Value, fqdn.Value, kubernetesVersion.Value); + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetHubProfile.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetHubProfile.cs new file mode 100644 index 000000000000..c8c65dc16bdc --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetHubProfile.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + /// The FleetHubProfile configures the fleet hub. + public partial class FleetHubProfile + { + /// Initializes a new instance of FleetHubProfile. + public FleetHubProfile() + { + } + + /// Initializes a new instance of FleetHubProfile. + /// DNS prefix used to create the FQDN for the Fleet hub. + /// The access profile for the Fleet hub API server. + /// The agent profile for the Fleet hub. + /// The FQDN of the Fleet hub. + /// The Kubernetes version of the Fleet hub. + internal FleetHubProfile(string dnsPrefix, FleetApiServerAccessProfile apiServerAccessProfile, FleetAgentProfile agentProfile, string fqdn, string kubernetesVersion) + { + DnsPrefix = dnsPrefix; + ApiServerAccessProfile = apiServerAccessProfile; + AgentProfile = agentProfile; + Fqdn = fqdn; + KubernetesVersion = kubernetesVersion; + } + + /// DNS prefix used to create the FQDN for the Fleet hub. + public string DnsPrefix { get; set; } + /// The access profile for the Fleet hub API server. + public FleetApiServerAccessProfile ApiServerAccessProfile { get; set; } + /// The agent profile for the Fleet hub. + internal FleetAgentProfile AgentProfile { get; set; } + /// The ID of the subnet which the Fleet hub node will join on startup. If this is not specified, a vnet and subnet will be generated and used. + public ResourceIdentifier AgentSubnetId + { + get => AgentProfile is null ? default : AgentProfile.SubnetId; + set + { + if (AgentProfile is null) + AgentProfile = new FleetAgentProfile(); + AgentProfile.SubnetId = value; + } + } + + /// The FQDN of the Fleet hub. + public string Fqdn { get; } + /// The Kubernetes version of the Fleet hub. + public string KubernetesVersion { get; } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetManagedClusterUpdate.Serialization.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetManagedClusterUpdate.Serialization.cs new file mode 100644 index 000000000000..689684ce2a20 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetManagedClusterUpdate.Serialization.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + public partial class FleetManagedClusterUpdate : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("upgrade"u8); + writer.WriteObjectValue(Upgrade); + if (Optional.IsDefined(NodeImageSelection)) + { + writer.WritePropertyName("nodeImageSelection"u8); + writer.WriteObjectValue(NodeImageSelection); + } + writer.WriteEndObject(); + } + + internal static FleetManagedClusterUpdate DeserializeFleetManagedClusterUpdate(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + FleetManagedClusterUpgradeSpec upgrade = default; + Optional nodeImageSelection = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("upgrade"u8)) + { + upgrade = FleetManagedClusterUpgradeSpec.DeserializeFleetManagedClusterUpgradeSpec(property.Value); + continue; + } + if (property.NameEquals("nodeImageSelection"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nodeImageSelection = NodeImageSelection.DeserializeNodeImageSelection(property.Value); + continue; + } + } + return new FleetManagedClusterUpdate(upgrade, nodeImageSelection.Value); + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetManagedClusterUpdate.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetManagedClusterUpdate.cs new file mode 100644 index 000000000000..95fe1f4f1345 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetManagedClusterUpdate.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + /// The update to be applied to the ManagedClusters. + public partial class FleetManagedClusterUpdate + { + /// Initializes a new instance of FleetManagedClusterUpdate. + /// The upgrade to apply to the ManagedClusters. + /// is null. + public FleetManagedClusterUpdate(FleetManagedClusterUpgradeSpec upgrade) + { + Argument.AssertNotNull(upgrade, nameof(upgrade)); + + Upgrade = upgrade; + } + + /// Initializes a new instance of FleetManagedClusterUpdate. + /// The upgrade to apply to the ManagedClusters. + /// The node image upgrade to be applied to the target nodes in update run. + internal FleetManagedClusterUpdate(FleetManagedClusterUpgradeSpec upgrade, NodeImageSelection nodeImageSelection) + { + Upgrade = upgrade; + NodeImageSelection = nodeImageSelection; + } + + /// The upgrade to apply to the ManagedClusters. + public FleetManagedClusterUpgradeSpec Upgrade { get; set; } + /// The node image upgrade to be applied to the target nodes in update run. + internal NodeImageSelection NodeImageSelection { get; set; } + /// The node image upgrade type. + public NodeImageSelectionType? SelectionType + { + get => NodeImageSelection is null ? default(NodeImageSelectionType?) : NodeImageSelection.SelectionType; + set + { + NodeImageSelection = value.HasValue ? new NodeImageSelection(value.Value) : null; + } + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetManagedClusterUpgradeSpec.Serialization.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetManagedClusterUpgradeSpec.Serialization.cs new file mode 100644 index 000000000000..ae22f7849cf7 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetManagedClusterUpgradeSpec.Serialization.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + public partial class FleetManagedClusterUpgradeSpec : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("type"u8); + writer.WriteStringValue(UpgradeType.ToString()); + if (Optional.IsDefined(KubernetesVersion)) + { + writer.WritePropertyName("kubernetesVersion"u8); + writer.WriteStringValue(KubernetesVersion); + } + writer.WriteEndObject(); + } + + internal static FleetManagedClusterUpgradeSpec DeserializeFleetManagedClusterUpgradeSpec(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + FleetManagedClusterUpgradeType type = default; + Optional kubernetesVersion = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = new FleetManagedClusterUpgradeType(property.Value.GetString()); + continue; + } + if (property.NameEquals("kubernetesVersion"u8)) + { + kubernetesVersion = property.Value.GetString(); + continue; + } + } + return new FleetManagedClusterUpgradeSpec(type, kubernetesVersion.Value); + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetManagedClusterUpgradeSpec.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetManagedClusterUpgradeSpec.cs new file mode 100644 index 000000000000..46701a2e6307 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetManagedClusterUpgradeSpec.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + /// The upgrade to apply to a ManagedCluster. + public partial class FleetManagedClusterUpgradeSpec + { + /// Initializes a new instance of FleetManagedClusterUpgradeSpec. + /// + /// The upgrade type. + /// Full requires the KubernetesVersion property to be set. + /// NodeImageOnly requires the KubernetesVersion property not to be set. + /// + public FleetManagedClusterUpgradeSpec(FleetManagedClusterUpgradeType upgradeType) + { + UpgradeType = upgradeType; + } + + /// Initializes a new instance of FleetManagedClusterUpgradeSpec. + /// + /// The upgrade type. + /// Full requires the KubernetesVersion property to be set. + /// NodeImageOnly requires the KubernetesVersion property not to be set. + /// + /// The Kubernetes version to upgrade the member clusters to. + internal FleetManagedClusterUpgradeSpec(FleetManagedClusterUpgradeType upgradeType, string kubernetesVersion) + { + UpgradeType = upgradeType; + KubernetesVersion = kubernetesVersion; + } + + /// + /// The upgrade type. + /// Full requires the KubernetesVersion property to be set. + /// NodeImageOnly requires the KubernetesVersion property not to be set. + /// + public FleetManagedClusterUpgradeType UpgradeType { get; set; } + /// The Kubernetes version to upgrade the member clusters to. + public string KubernetesVersion { get; set; } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetManagedClusterUpgradeType.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetManagedClusterUpgradeType.cs new file mode 100644 index 000000000000..357fccf2e24e --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetManagedClusterUpgradeType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + /// The type of upgrade to perform when targeting ManagedClusters. + public readonly partial struct FleetManagedClusterUpgradeType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public FleetManagedClusterUpgradeType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string FullValue = "Full"; + private const string NodeImageOnlyValue = "NodeImageOnly"; + + /// Full upgrades the control plane and all agent pools of the target ManagedClusters. + public static FleetManagedClusterUpgradeType Full { get; } = new FleetManagedClusterUpgradeType(FullValue); + /// NodeImageOnly upgrades only the node images of the target ManagedClusters. + public static FleetManagedClusterUpgradeType NodeImageOnly { get; } = new FleetManagedClusterUpgradeType(NodeImageOnlyValue); + /// Determines if two values are the same. + public static bool operator ==(FleetManagedClusterUpgradeType left, FleetManagedClusterUpgradeType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(FleetManagedClusterUpgradeType left, FleetManagedClusterUpgradeType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator FleetManagedClusterUpgradeType(string value) => new FleetManagedClusterUpgradeType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is FleetManagedClusterUpgradeType other && Equals(other); + /// + public bool Equals(FleetManagedClusterUpgradeType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetMemberProvisioningState.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetMemberProvisioningState.cs new file mode 100644 index 000000000000..6fe877d251d4 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetMemberProvisioningState.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + /// The provisioning state of the last accepted operation. + public readonly partial struct FleetMemberProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public FleetMemberProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + private const string JoiningValue = "Joining"; + private const string LeavingValue = "Leaving"; + private const string UpdatingValue = "Updating"; + + /// Resource has been created. + public static FleetMemberProvisioningState Succeeded { get; } = new FleetMemberProvisioningState(SucceededValue); + /// Resource creation failed. + public static FleetMemberProvisioningState Failed { get; } = new FleetMemberProvisioningState(FailedValue); + /// Resource creation was canceled. + public static FleetMemberProvisioningState Canceled { get; } = new FleetMemberProvisioningState(CanceledValue); + /// The provisioning state of a member joining a fleet. + public static FleetMemberProvisioningState Joining { get; } = new FleetMemberProvisioningState(JoiningValue); + /// The provisioning state of a member leaving a fleet. + public static FleetMemberProvisioningState Leaving { get; } = new FleetMemberProvisioningState(LeavingValue); + /// The provisioning state of a member being updated. + public static FleetMemberProvisioningState Updating { get; } = new FleetMemberProvisioningState(UpdatingValue); + /// Determines if two values are the same. + public static bool operator ==(FleetMemberProvisioningState left, FleetMemberProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(FleetMemberProvisioningState left, FleetMemberProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator FleetMemberProvisioningState(string value) => new FleetMemberProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is FleetMemberProvisioningState other && Equals(other); + /// + public bool Equals(FleetMemberProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetProvisioningState.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetProvisioningState.cs new file mode 100644 index 000000000000..8f6a3a747196 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetProvisioningState.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + /// The provisioning state of the last accepted operation. + public readonly partial struct FleetProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public FleetProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + private const string CreatingValue = "Creating"; + private const string UpdatingValue = "Updating"; + private const string DeletingValue = "Deleting"; + + /// Resource has been created. + public static FleetProvisioningState Succeeded { get; } = new FleetProvisioningState(SucceededValue); + /// Resource creation failed. + public static FleetProvisioningState Failed { get; } = new FleetProvisioningState(FailedValue); + /// Resource creation was canceled. + public static FleetProvisioningState Canceled { get; } = new FleetProvisioningState(CanceledValue); + /// The provisioning state of a fleet being created. + public static FleetProvisioningState Creating { get; } = new FleetProvisioningState(CreatingValue); + /// The provisioning state of a fleet being updated. + public static FleetProvisioningState Updating { get; } = new FleetProvisioningState(UpdatingValue); + /// The provisioning state of a fleet being deleted. + public static FleetProvisioningState Deleting { get; } = new FleetProvisioningState(DeletingValue); + /// Determines if two values are the same. + public static bool operator ==(FleetProvisioningState left, FleetProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(FleetProvisioningState left, FleetProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator FleetProvisioningState(string value) => new FleetProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is FleetProvisioningState other && Equals(other); + /// + public bool Equals(FleetProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateGroup.Serialization.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateGroup.Serialization.cs new file mode 100644 index 000000000000..1a55c3ec47a0 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateGroup.Serialization.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + public partial class FleetUpdateGroup : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + writer.WriteEndObject(); + } + + internal static FleetUpdateGroup DeserializeFleetUpdateGroup(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + } + return new FleetUpdateGroup(name); + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateGroup.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateGroup.cs new file mode 100644 index 000000000000..9229b13171a3 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateGroup.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + /// A group to be updated. + public partial class FleetUpdateGroup + { + /// Initializes a new instance of FleetUpdateGroup. + /// + /// The name of the Fleet member group to update. + /// It should match the name of an existing FleetMember group. + /// A group can only appear once across all UpdateStages in the UpdateRun. + /// + /// is null. + public FleetUpdateGroup(string name) + { + Argument.AssertNotNull(name, nameof(name)); + + Name = name; + } + + /// + /// The name of the Fleet member group to update. + /// It should match the name of an existing FleetMember group. + /// A group can only appear once across all UpdateStages in the UpdateRun. + /// + public string Name { get; set; } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateGroupStatus.Serialization.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateGroupStatus.Serialization.cs new file mode 100644 index 000000000000..fa3e123a694d --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateGroupStatus.Serialization.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + public partial class FleetUpdateGroupStatus + { + internal static FleetUpdateGroupStatus DeserializeFleetUpdateGroupStatus(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional status = default; + Optional name = default; + Optional> members = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = FleetUpdateOperationStatus.DeserializeFleetUpdateOperationStatus(property.Value); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("members"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(MemberUpdateStatus.DeserializeMemberUpdateStatus(item)); + } + members = array; + continue; + } + } + return new FleetUpdateGroupStatus(status.Value, name.Value, Optional.ToList(members)); + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateGroupStatus.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateGroupStatus.cs new file mode 100644 index 000000000000..d09a755b0412 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateGroupStatus.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + /// The status of a UpdateGroup. + public partial class FleetUpdateGroupStatus + { + /// Initializes a new instance of FleetUpdateGroupStatus. + internal FleetUpdateGroupStatus() + { + Members = new ChangeTrackingList(); + } + + /// Initializes a new instance of FleetUpdateGroupStatus. + /// The status of the UpdateGroup. + /// The name of the UpdateGroup. + /// The list of member this UpdateGroup updates. + internal FleetUpdateGroupStatus(FleetUpdateOperationStatus status, string name, IReadOnlyList members) + { + Status = status; + Name = name; + Members = members; + } + + /// The status of the UpdateGroup. + public FleetUpdateOperationStatus Status { get; } + /// The name of the UpdateGroup. + public string Name { get; } + /// The list of member this UpdateGroup updates. + public IReadOnlyList Members { get; } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateOperationStatus.Serialization.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateOperationStatus.Serialization.cs new file mode 100644 index 000000000000..53a0b9332331 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateOperationStatus.Serialization.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + public partial class FleetUpdateOperationStatus + { + internal static FleetUpdateOperationStatus DeserializeFleetUpdateOperationStatus(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional startTime = default; + Optional completedTime = default; + Optional state = default; + Optional error = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("startTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + startTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("completedTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + completedTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("state"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + state = new FleetUpdateState(property.Value.GetString()); + continue; + } + if (property.NameEquals("error"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + error = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + } + return new FleetUpdateOperationStatus(Optional.ToNullable(startTime), Optional.ToNullable(completedTime), Optional.ToNullable(state), error.Value); + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateOperationStatus.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateOperationStatus.cs new file mode 100644 index 000000000000..2d5015dc934c --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateOperationStatus.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + /// The status for an operation or group of operations. + public partial class FleetUpdateOperationStatus + { + /// Initializes a new instance of FleetUpdateOperationStatus. + internal FleetUpdateOperationStatus() + { + } + + /// Initializes a new instance of FleetUpdateOperationStatus. + /// The time the operation or group was started. + /// The time the operation or group was completed. + /// The State of the operation or group. + /// The error details when a failure is encountered. + internal FleetUpdateOperationStatus(DateTimeOffset? startOn, DateTimeOffset? completedOn, FleetUpdateState? state, ResponseError error) + { + StartOn = startOn; + CompletedOn = completedOn; + State = state; + Error = error; + } + + /// The time the operation or group was started. + public DateTimeOffset? StartOn { get; } + /// The time the operation or group was completed. + public DateTimeOffset? CompletedOn { get; } + /// The State of the operation or group. + public FleetUpdateState? State { get; } + /// The error details when a failure is encountered. + public ResponseError Error { get; } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateRunProvisioningState.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateRunProvisioningState.cs new file mode 100644 index 000000000000..5c6caa6c3794 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateRunProvisioningState.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.DatabaseFleetManager.Models +{ + /// The provisioning state of the UpdateRun resource. + public readonly partial struct FleetUpdateRunProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public FleetUpdateRunProvisioningState(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 FleetUpdateRunProvisioningState Succeeded { get; } = new FleetUpdateRunProvisioningState(SucceededValue); + /// Resource creation failed. + public static FleetUpdateRunProvisioningState Failed { get; } = new FleetUpdateRunProvisioningState(FailedValue); + /// Resource creation was canceled. + public static FleetUpdateRunProvisioningState Canceled { get; } = new FleetUpdateRunProvisioningState(CanceledValue); + /// Determines if two values are the same. + public static bool operator ==(FleetUpdateRunProvisioningState left, FleetUpdateRunProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(FleetUpdateRunProvisioningState left, FleetUpdateRunProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator FleetUpdateRunProvisioningState(string value) => new FleetUpdateRunProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is FleetUpdateRunProvisioningState other && Equals(other); + /// + public bool Equals(FleetUpdateRunProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateRunStatus.Serialization.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateRunStatus.Serialization.cs new file mode 100644 index 000000000000..6425cff140ef --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateRunStatus.Serialization.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + public partial class FleetUpdateRunStatus + { + internal static FleetUpdateRunStatus DeserializeFleetUpdateRunStatus(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional status = default; + Optional> stages = default; + Optional nodeImageSelection = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = FleetUpdateOperationStatus.DeserializeFleetUpdateOperationStatus(property.Value); + continue; + } + if (property.NameEquals("stages"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(FleetUpdateStageStatus.DeserializeFleetUpdateStageStatus(item)); + } + stages = array; + continue; + } + if (property.NameEquals("nodeImageSelection"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nodeImageSelection = NodeImageSelectionStatus.DeserializeNodeImageSelectionStatus(property.Value); + continue; + } + } + return new FleetUpdateRunStatus(status.Value, Optional.ToList(stages), nodeImageSelection.Value); + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateRunStatus.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateRunStatus.cs new file mode 100644 index 000000000000..54ab14bd3cf3 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateRunStatus.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + /// The status of a UpdateRun. + public partial class FleetUpdateRunStatus + { + /// Initializes a new instance of FleetUpdateRunStatus. + internal FleetUpdateRunStatus() + { + Stages = new ChangeTrackingList(); + } + + /// Initializes a new instance of FleetUpdateRunStatus. + /// The status of the UpdateRun. + /// The stages composing an update run. Stages are run sequentially withing an UpdateRun. + /// The node image upgrade specs for the update run. It is only set in update run when `NodeImageSelection.type` is `Consistent`. + internal FleetUpdateRunStatus(FleetUpdateOperationStatus status, IReadOnlyList stages, NodeImageSelectionStatus nodeImageSelection) + { + Status = status; + Stages = stages; + NodeImageSelection = nodeImageSelection; + } + + /// The status of the UpdateRun. + public FleetUpdateOperationStatus Status { get; } + /// The stages composing an update run. Stages are run sequentially withing an UpdateRun. + public IReadOnlyList Stages { get; } + /// The node image upgrade specs for the update run. It is only set in update run when `NodeImageSelection.type` is `Consistent`. + internal NodeImageSelectionStatus NodeImageSelection { get; } + /// The image versions to upgrade the nodes to. + public IReadOnlyList SelectedNodeImageVersions + { + get => NodeImageSelection?.SelectedNodeImageVersions; + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateRunStrategy.Serialization.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateRunStrategy.Serialization.cs new file mode 100644 index 000000000000..89370aa3cb9e --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateRunStrategy.Serialization.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + internal partial class FleetUpdateRunStrategy : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("stages"u8); + writer.WriteStartArray(); + foreach (var item in Stages) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + writer.WriteEndObject(); + } + + internal static FleetUpdateRunStrategy DeserializeFleetUpdateRunStrategy(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList stages = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("stages"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(FleetUpdateStage.DeserializeFleetUpdateStage(item)); + } + stages = array; + continue; + } + } + return new FleetUpdateRunStrategy(stages); + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateRunStrategy.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateRunStrategy.cs new file mode 100644 index 000000000000..e9df241ad67a --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateRunStrategy.cs @@ -0,0 +1,38 @@ +// 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; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + /// The UpdateRunStrategy configures the sequence of Stages and Groups in which the clusters will be updated. + internal partial class FleetUpdateRunStrategy + { + /// Initializes a new instance of FleetUpdateRunStrategy. + /// The list of stages that compose this update run. + /// is null. + public FleetUpdateRunStrategy(IEnumerable stages) + { + Argument.AssertNotNull(stages, nameof(stages)); + + Stages = stages.ToList(); + } + + /// Initializes a new instance of FleetUpdateRunStrategy. + /// The list of stages that compose this update run. + internal FleetUpdateRunStrategy(IList stages) + { + Stages = stages; + } + + /// The list of stages that compose this update run. + public IList Stages { get; } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateStage.Serialization.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateStage.Serialization.cs new file mode 100644 index 000000000000..cc9e9445cfe7 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateStage.Serialization.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + public partial class FleetUpdateStage : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + if (Optional.IsCollectionDefined(Groups)) + { + writer.WritePropertyName("groups"u8); + writer.WriteStartArray(); + foreach (var item in Groups) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(AfterStageWaitInSeconds)) + { + writer.WritePropertyName("afterStageWaitInSeconds"u8); + writer.WriteNumberValue(AfterStageWaitInSeconds.Value); + } + writer.WriteEndObject(); + } + + internal static FleetUpdateStage DeserializeFleetUpdateStage(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + Optional> groups = default; + Optional afterStageWaitInSeconds = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("groups"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(FleetUpdateGroup.DeserializeFleetUpdateGroup(item)); + } + groups = array; + continue; + } + if (property.NameEquals("afterStageWaitInSeconds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + afterStageWaitInSeconds = property.Value.GetInt32(); + continue; + } + } + return new FleetUpdateStage(name, Optional.ToList(groups), Optional.ToNullable(afterStageWaitInSeconds)); + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateStage.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateStage.cs new file mode 100644 index 000000000000..7fab2c88d260 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateStage.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + /// + /// Contains the groups to be updated by an UpdateRun. + /// Update order: + /// - Sequential between stages: Stages run sequentially. The previous stage must complete before the next one starts. + /// - Parallel within a stage: Groups within a stage run in parallel. + /// - Sequential within a group: Clusters within a group are updated sequentially. + /// + public partial class FleetUpdateStage + { + /// Initializes a new instance of FleetUpdateStage. + /// The name of the stage. Must be unique within the UpdateRun. + /// is null. + public FleetUpdateStage(string name) + { + Argument.AssertNotNull(name, nameof(name)); + + Name = name; + Groups = new ChangeTrackingList(); + } + + /// Initializes a new instance of FleetUpdateStage. + /// The name of the stage. Must be unique within the UpdateRun. + /// + /// A list of group names that compose the stage. + /// The groups will be updated in parallel. Each group name can only appear once in the UpdateRun. + /// + /// The time in seconds to wait at the end of this stage before starting the next one. Defaults to 0 seconds if unspecified. + internal FleetUpdateStage(string name, IList groups, int? afterStageWaitInSeconds) + { + Name = name; + Groups = groups; + AfterStageWaitInSeconds = afterStageWaitInSeconds; + } + + /// The name of the stage. Must be unique within the UpdateRun. + public string Name { get; set; } + /// + /// A list of group names that compose the stage. + /// The groups will be updated in parallel. Each group name can only appear once in the UpdateRun. + /// + public IList Groups { get; } + /// The time in seconds to wait at the end of this stage before starting the next one. Defaults to 0 seconds if unspecified. + public int? AfterStageWaitInSeconds { get; set; } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateStageStatus.Serialization.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateStageStatus.Serialization.cs new file mode 100644 index 000000000000..b2377f6b1821 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateStageStatus.Serialization.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + public partial class FleetUpdateStageStatus + { + internal static FleetUpdateStageStatus DeserializeFleetUpdateStageStatus(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional status = default; + Optional name = default; + Optional> groups = default; + Optional afterStageWaitStatus = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = FleetUpdateOperationStatus.DeserializeFleetUpdateOperationStatus(property.Value); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("groups"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(FleetUpdateGroupStatus.DeserializeFleetUpdateGroupStatus(item)); + } + groups = array; + continue; + } + if (property.NameEquals("afterStageWaitStatus"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + afterStageWaitStatus = FleetWaitStatus.DeserializeFleetWaitStatus(property.Value); + continue; + } + } + return new FleetUpdateStageStatus(status.Value, name.Value, Optional.ToList(groups), afterStageWaitStatus.Value); + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateStageStatus.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateStageStatus.cs new file mode 100644 index 000000000000..fd5269182ee0 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateStageStatus.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + /// The status of a UpdateStage. + public partial class FleetUpdateStageStatus + { + /// Initializes a new instance of FleetUpdateStageStatus. + internal FleetUpdateStageStatus() + { + Groups = new ChangeTrackingList(); + } + + /// Initializes a new instance of FleetUpdateStageStatus. + /// The status of the UpdateStage. + /// The name of the UpdateStage. + /// The list of groups to be updated as part of this UpdateStage. + /// The status of the wait period configured on the UpdateStage. + internal FleetUpdateStageStatus(FleetUpdateOperationStatus status, string name, IReadOnlyList groups, FleetWaitStatus afterStageWaitStatus) + { + Status = status; + Name = name; + Groups = groups; + AfterStageWaitStatus = afterStageWaitStatus; + } + + /// The status of the UpdateStage. + public FleetUpdateOperationStatus Status { get; } + /// The name of the UpdateStage. + public string Name { get; } + /// The list of groups to be updated as part of this UpdateStage. + public IReadOnlyList Groups { get; } + /// The status of the wait period configured on the UpdateStage. + public FleetWaitStatus AfterStageWaitStatus { get; } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateState.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateState.cs new file mode 100644 index 000000000000..90a21844acfe --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetUpdateState.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + /// The state of the UpdateRun, UpdateStage, UpdateGroup, or MemberUpdate. + public readonly partial struct FleetUpdateState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public FleetUpdateState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NotStartedValue = "NotStarted"; + private const string RunningValue = "Running"; + private const string StoppingValue = "Stopping"; + private const string StoppedValue = "Stopped"; + private const string SkippedValue = "Skipped"; + private const string FailedValue = "Failed"; + private const string CompletedValue = "Completed"; + + /// The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has not been started. + public static FleetUpdateState NotStarted { get; } = new FleetUpdateState(NotStartedValue); + /// The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that is running. + public static FleetUpdateState Running { get; } = new FleetUpdateState(RunningValue); + /// The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that is being stopped. + public static FleetUpdateState Stopping { get; } = new FleetUpdateState(StoppingValue); + /// The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has stopped. + public static FleetUpdateState Stopped { get; } = new FleetUpdateState(StoppedValue); + /// The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has been skipped. + public static FleetUpdateState Skipped { get; } = new FleetUpdateState(SkippedValue); + /// The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has failed. + public static FleetUpdateState Failed { get; } = new FleetUpdateState(FailedValue); + /// The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has completed. + public static FleetUpdateState Completed { get; } = new FleetUpdateState(CompletedValue); + /// Determines if two values are the same. + public static bool operator ==(FleetUpdateState left, FleetUpdateState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(FleetUpdateState left, FleetUpdateState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator FleetUpdateState(string value) => new FleetUpdateState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is FleetUpdateState other && Equals(other); + /// + public bool Equals(FleetUpdateState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetWaitStatus.Serialization.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetWaitStatus.Serialization.cs new file mode 100644 index 000000000000..2dd7941b8057 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetWaitStatus.Serialization.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + public partial class FleetWaitStatus + { + internal static FleetWaitStatus DeserializeFleetWaitStatus(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional status = default; + Optional waitDurationInSeconds = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = FleetUpdateOperationStatus.DeserializeFleetUpdateOperationStatus(property.Value); + continue; + } + if (property.NameEquals("waitDurationInSeconds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + waitDurationInSeconds = property.Value.GetInt32(); + continue; + } + } + return new FleetWaitStatus(status.Value, Optional.ToNullable(waitDurationInSeconds)); + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetWaitStatus.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetWaitStatus.cs new file mode 100644 index 000000000000..2243516765ec --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/FleetWaitStatus.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + /// The status of the wait duration. + public partial class FleetWaitStatus + { + /// Initializes a new instance of FleetWaitStatus. + internal FleetWaitStatus() + { + } + + /// Initializes a new instance of FleetWaitStatus. + /// The status of the wait duration. + /// The wait duration configured in seconds. + internal FleetWaitStatus(FleetUpdateOperationStatus status, int? waitDurationInSeconds) + { + Status = status; + WaitDurationInSeconds = waitDurationInSeconds; + } + + /// The status of the wait duration. + public FleetUpdateOperationStatus Status { get; } + /// The wait duration configured in seconds. + public int? WaitDurationInSeconds { get; } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/MemberUpdateStatus.Serialization.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/MemberUpdateStatus.Serialization.cs new file mode 100644 index 000000000000..29bf5ae7636a --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/MemberUpdateStatus.Serialization.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + public partial class MemberUpdateStatus + { + internal static MemberUpdateStatus DeserializeMemberUpdateStatus(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional status = default; + Optional name = default; + Optional clusterResourceId = default; + Optional operationId = default; + Optional message = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = FleetUpdateOperationStatus.DeserializeFleetUpdateOperationStatus(property.Value); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("clusterResourceId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + clusterResourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("operationId"u8)) + { + operationId = property.Value.GetString(); + continue; + } + if (property.NameEquals("message"u8)) + { + message = property.Value.GetString(); + continue; + } + } + return new MemberUpdateStatus(status.Value, name.Value, clusterResourceId.Value, operationId.Value, message.Value); + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/MemberUpdateStatus.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/MemberUpdateStatus.cs new file mode 100644 index 000000000000..9458a11a2e2e --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/MemberUpdateStatus.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + /// The status of a member update operation. + public partial class MemberUpdateStatus + { + /// Initializes a new instance of MemberUpdateStatus. + internal MemberUpdateStatus() + { + } + + /// Initializes a new instance of MemberUpdateStatus. + /// The status of the MemberUpdate operation. + /// The name of the FleetMember. + /// The Azure resource id of the target Kubernetes cluster. + /// The operation resource id of the latest attempt to perform the operation. + /// The status message after processing the member update operation. + internal MemberUpdateStatus(FleetUpdateOperationStatus status, string name, ResourceIdentifier clusterResourceId, string operationId, string message) + { + Status = status; + Name = name; + ClusterResourceId = clusterResourceId; + OperationId = operationId; + Message = message; + } + + /// The status of the MemberUpdate operation. + public FleetUpdateOperationStatus Status { get; } + /// The name of the FleetMember. + public string Name { get; } + /// The Azure resource id of the target Kubernetes cluster. + public ResourceIdentifier ClusterResourceId { get; } + /// The operation resource id of the latest attempt to perform the operation. + public string OperationId { get; } + /// The status message after processing the member update operation. + public string Message { get; } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/NodeImageSelection.Serialization.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/NodeImageSelection.Serialization.cs new file mode 100644 index 000000000000..ccb58d817e35 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/NodeImageSelection.Serialization.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + internal partial class NodeImageSelection : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("type"u8); + writer.WriteStringValue(SelectionType.ToString()); + writer.WriteEndObject(); + } + + internal static NodeImageSelection DeserializeNodeImageSelection(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + NodeImageSelectionType type = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = new NodeImageSelectionType(property.Value.GetString()); + continue; + } + } + return new NodeImageSelection(type); + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/NodeImageSelection.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/NodeImageSelection.cs new file mode 100644 index 000000000000..44d6437934e3 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/NodeImageSelection.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + /// The node image upgrade to be applied to the target nodes in update run. + internal partial class NodeImageSelection + { + /// Initializes a new instance of NodeImageSelection. + /// The node image upgrade type. + public NodeImageSelection(NodeImageSelectionType selectionType) + { + SelectionType = selectionType; + } + + /// The node image upgrade type. + public NodeImageSelectionType SelectionType { get; set; } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/NodeImageSelectionStatus.Serialization.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/NodeImageSelectionStatus.Serialization.cs new file mode 100644 index 000000000000..1338a0389587 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/NodeImageSelectionStatus.Serialization.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + internal partial class NodeImageSelectionStatus + { + internal static NodeImageSelectionStatus DeserializeNodeImageSelectionStatus(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> selectedNodeImageVersions = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("selectedNodeImageVersions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(NodeImageVersion.DeserializeNodeImageVersion(item)); + } + selectedNodeImageVersions = array; + continue; + } + } + return new NodeImageSelectionStatus(Optional.ToList(selectedNodeImageVersions)); + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/NodeImageSelectionStatus.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/NodeImageSelectionStatus.cs new file mode 100644 index 000000000000..dac162a2535d --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/NodeImageSelectionStatus.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + /// The node image upgrade specs for the update run. + internal partial class NodeImageSelectionStatus + { + /// Initializes a new instance of NodeImageSelectionStatus. + internal NodeImageSelectionStatus() + { + SelectedNodeImageVersions = new ChangeTrackingList(); + } + + /// Initializes a new instance of NodeImageSelectionStatus. + /// The image versions to upgrade the nodes to. + internal NodeImageSelectionStatus(IReadOnlyList selectedNodeImageVersions) + { + SelectedNodeImageVersions = selectedNodeImageVersions; + } + + /// The image versions to upgrade the nodes to. + public IReadOnlyList SelectedNodeImageVersions { get; } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/NodeImageSelectionType.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/NodeImageSelectionType.cs new file mode 100644 index 000000000000..e05a61840979 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/NodeImageSelectionType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + /// The node image upgrade type. + public readonly partial struct NodeImageSelectionType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public NodeImageSelectionType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string LatestValue = "Latest"; + private const string ConsistentValue = "Consistent"; + + /// Use the latest image version when upgrading nodes. Clusters may use different image versions (e.g., 'AKSUbuntu-1804gen2containerd-2021.10.12' and 'AKSUbuntu-1804gen2containerd-2021.10.19') because, for example, the latest available version is different in different regions. + public static NodeImageSelectionType Latest { get; } = new NodeImageSelectionType(LatestValue); + /// The image versions to upgrade nodes to are selected as described below: for each node pool in managed clusters affected by the update run, the system selects the latest image version such that it is available across all other node pools (in all other clusters) of the same image type. As a result, all node pools of the same image type will be upgraded to the same image version. For example, if the latest image version for image type 'AKSUbuntu-1804gen2containerd' is 'AKSUbuntu-1804gen2containerd-2021.10.12' for a node pool in cluster A in region X, and is 'AKSUbuntu-1804gen2containerd-2021.10.17' for a node pool in cluster B in region Y, the system will upgrade both node pools to image version 'AKSUbuntu-1804gen2containerd-2021.10.12'. + public static NodeImageSelectionType Consistent { get; } = new NodeImageSelectionType(ConsistentValue); + /// Determines if two values are the same. + public static bool operator ==(NodeImageSelectionType left, NodeImageSelectionType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(NodeImageSelectionType left, NodeImageSelectionType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator NodeImageSelectionType(string value) => new NodeImageSelectionType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is NodeImageSelectionType other && Equals(other); + /// + public bool Equals(NodeImageSelectionType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/NodeImageVersion.Serialization.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/NodeImageVersion.Serialization.cs new file mode 100644 index 000000000000..74172caf165c --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/NodeImageVersion.Serialization.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + public partial class NodeImageVersion + { + internal static NodeImageVersion DeserializeNodeImageVersion(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional version = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("version"u8)) + { + version = property.Value.GetString(); + continue; + } + } + return new NodeImageVersion(version.Value); + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/NodeImageVersion.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/NodeImageVersion.cs new file mode 100644 index 000000000000..c214ea4bdd94 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/Models/NodeImageVersion.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.DatabaseFleetManager.Models +{ + /// The node upgrade image version. + public partial class NodeImageVersion + { + /// Initializes a new instance of NodeImageVersion. + internal NodeImageVersion() + { + } + + /// Initializes a new instance of NodeImageVersion. + /// The image version to upgrade the nodes to (e.g., 'AKSUbuntu-1804gen2containerd-2022.12.13'). + internal NodeImageVersion(string version) + { + Version = version; + } + + /// The image version to upgrade the nodes to (e.g., 'AKSUbuntu-1804gen2containerd-2022.12.13'). + public string Version { get; } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/ProviderConstants.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/ProviderConstants.cs new file mode 100644 index 000000000000..978185b579aa --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/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.DatabaseFleetManager +{ + internal static class ProviderConstants + { + public static string DefaultProviderNamespace { get; } = ClientDiagnostics.GetResourceProviderNamespace(typeof(ProviderConstants).Assembly); + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/RestOperations/FleetMembersRestOperations.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/RestOperations/FleetMembersRestOperations.cs new file mode 100644 index 000000000000..51463e8f2e45 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/RestOperations/FleetMembersRestOperations.cs @@ -0,0 +1,553 @@ +// 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; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DatabaseFleetManager.Models; + +namespace Azure.ResourceManager.DatabaseFleetManager +{ + internal partial class FleetMembersRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of FleetMembersRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public FleetMembersRestOperations(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 ?? "2023-06-15-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByFleetRequest(string subscriptionId, string resourceGroupName, string fleetName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/members", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List FleetMember resources by Fleet. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByFleetAsync(string subscriptionId, string resourceGroupName, string fleetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + + using var message = CreateListByFleetRequest(subscriptionId, resourceGroupName, fleetName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseFleetMemberListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseFleetMemberListResult.DeserializeDatabaseFleetMemberListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List FleetMember resources by Fleet. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByFleet(string subscriptionId, string resourceGroupName, string fleetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + + using var message = CreateListByFleetRequest(subscriptionId, resourceGroupName, fleetName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatabaseFleetMemberListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseFleetMemberListResult.DeserializeDatabaseFleetMemberListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string fleetName, string fleetMemberName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/members/", false); + uri.AppendPath(fleetMemberName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a FleetMember. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The name of the Fleet member 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 fleetName, string fleetMemberName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(fleetMemberName, nameof(fleetMemberName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, fleetName, fleetMemberName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseFleetMemberData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseFleetMemberData.DeserializeDatabaseFleetMemberData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DatabaseFleetMemberData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a FleetMember. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The name of the Fleet member 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 fleetName, string fleetMemberName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(fleetMemberName, nameof(fleetMemberName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, fleetName, fleetMemberName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatabaseFleetMemberData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseFleetMemberData.DeserializeDatabaseFleetMemberData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DatabaseFleetMemberData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string fleetName, string fleetMemberName, DatabaseFleetMemberData data, string ifMatch, string ifNoneMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/members/", false); + uri.AppendPath(fleetMemberName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch); + } + if (ifNoneMatch != null) + { + request.Headers.Add("If-None-Match", ifNoneMatch); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create a FleetMember. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The name of the Fleet member resource. + /// Resource create parameters. + /// The request should only proceed if an entity matches this string. + /// The request should only proceed if no entity matches this string. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task CreateAsync(string subscriptionId, string resourceGroupName, string fleetName, string fleetMemberName, DatabaseFleetMemberData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(fleetMemberName, nameof(fleetMemberName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, fleetName, fleetMemberName, data, ifMatch, ifNoneMatch); + 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 FleetMember. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The name of the Fleet member resource. + /// Resource create parameters. + /// The request should only proceed if an entity matches this string. + /// The request should only proceed if no entity matches this string. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Create(string subscriptionId, string resourceGroupName, string fleetName, string fleetMemberName, DatabaseFleetMemberData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(fleetMemberName, nameof(fleetMemberName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, fleetName, fleetMemberName, data, ifMatch, ifNoneMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string fleetName, string fleetMemberName, DatabaseFleetMemberPatch patch, string ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/members/", false); + uri.AppendPath(fleetMemberName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update a FleetMember. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The name of the Fleet member resource. + /// The resource properties to be updated. + /// The request should only proceed if an entity matches this string. + /// 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 fleetName, string fleetMemberName, DatabaseFleetMemberPatch patch, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(fleetMemberName, nameof(fleetMemberName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, fleetName, fleetMemberName, patch, ifMatch); + 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 FleetMember. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The name of the Fleet member resource. + /// The resource properties to be updated. + /// The request should only proceed if an entity matches this string. + /// 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 fleetName, string fleetMemberName, DatabaseFleetMemberPatch patch, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(fleetMemberName, nameof(fleetMemberName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, fleetName, fleetMemberName, patch, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string fleetName, string fleetMemberName, string ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/members/", false); + uri.AppendPath(fleetMemberName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch); + } + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a FleetMember. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The name of the Fleet member resource. + /// The request should only proceed if an entity matches this string. + /// 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 fleetName, string fleetMemberName, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(fleetMemberName, nameof(fleetMemberName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, fleetName, fleetMemberName, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a FleetMember. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The name of the Fleet member resource. + /// The request should only proceed if an entity matches this string. + /// 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 fleetName, string fleetMemberName, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(fleetMemberName, nameof(fleetMemberName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, fleetName, fleetMemberName, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByFleetNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string fleetName) + { + 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 FleetMember resources by Fleet. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByFleetNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string fleetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + + using var message = CreateListByFleetNextPageRequest(nextLink, subscriptionId, resourceGroupName, fleetName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseFleetMemberListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseFleetMemberListResult.DeserializeDatabaseFleetMemberListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List FleetMember resources by Fleet. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByFleetNextPage(string nextLink, string subscriptionId, string resourceGroupName, string fleetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + + using var message = CreateListByFleetNextPageRequest(nextLink, subscriptionId, resourceGroupName, fleetName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatabaseFleetMemberListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseFleetMemberListResult.DeserializeDatabaseFleetMemberListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/RestOperations/FleetsRestOperations.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/RestOperations/FleetsRestOperations.cs new file mode 100644 index 000000000000..7c134b97a1d5 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/RestOperations/FleetsRestOperations.cs @@ -0,0 +1,733 @@ +// 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; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DatabaseFleetManager.Models; + +namespace Azure.ResourceManager.DatabaseFleetManager +{ + internal partial class FleetsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of FleetsRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public FleetsRestOperations(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 ?? "2023-06-15-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists fleets in the specified subscription. + /// The ID of the target subscription. + /// 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: + { + DatabaseFleetListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseFleetListResult.DeserializeDatabaseFleetListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists fleets in the specified subscription. + /// The ID of the target subscription. + /// 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: + { + DatabaseFleetListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseFleetListResult.DeserializeDatabaseFleetListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists fleets in the specified subscription and resource group. + /// The ID of the target subscription. + /// 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: + { + DatabaseFleetListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseFleetListResult.DeserializeDatabaseFleetListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists fleets in the specified subscription and resource group. + /// The ID of the target subscription. + /// 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: + { + DatabaseFleetListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseFleetListResult.DeserializeDatabaseFleetListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string fleetName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a Fleet. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet 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 fleetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, fleetName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseFleetData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseFleetData.DeserializeDatabaseFleetData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DatabaseFleetData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a Fleet. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet 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 fleetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, fleetName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatabaseFleetData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseFleetData.DeserializeDatabaseFleetData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DatabaseFleetData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string fleetName, DatabaseFleetData data, string ifMatch, string ifNoneMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch); + } + if (ifNoneMatch != null) + { + request.Headers.Add("If-None-Match", ifNoneMatch); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates a Fleet. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// Resource create parameters. + /// The request should only proceed if an entity matches this string. + /// The request should only proceed if no entity matches this string. + /// 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 fleetName, DatabaseFleetData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, fleetName, data, ifMatch, ifNoneMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates or updates a Fleet. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// Resource create parameters. + /// The request should only proceed if an entity matches this string. + /// The request should only proceed if no entity matches this string. + /// 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 fleetName, DatabaseFleetData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, fleetName, data, ifMatch, ifNoneMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string fleetName, DatabaseFleetPatch patch, string ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update a Fleet. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The resource properties to be updated. + /// The request should only proceed if an entity matches this string. + /// 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 fleetName, DatabaseFleetPatch patch, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, fleetName, patch, ifMatch); + 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 Fleet. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The resource properties to be updated. + /// The request should only proceed if an entity matches this string. + /// 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 fleetName, DatabaseFleetPatch patch, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, fleetName, patch, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string fleetName, string ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch); + } + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a Fleet. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The request should only proceed if an entity matches this string. + /// 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 fleetName, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, fleetName, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a Fleet. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The request should only proceed if an entity matches this string. + /// 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 fleetName, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, fleetName, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListCredentialsRequest(string subscriptionId, string resourceGroupName, string fleetName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/listCredentials", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists the user credentials of a Fleet. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListCredentialsAsync(string subscriptionId, string resourceGroupName, string fleetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + + using var message = CreateListCredentialsRequest(subscriptionId, resourceGroupName, fleetName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + FleetCredentialResults value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = FleetCredentialResults.DeserializeFleetCredentialResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists the user credentials of a Fleet. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListCredentials(string subscriptionId, string resourceGroupName, string fleetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + + using var message = CreateListCredentialsRequest(subscriptionId, resourceGroupName, fleetName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + FleetCredentialResults value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = FleetCredentialResults.DeserializeFleetCredentialResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists fleets in the specified subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// 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: + { + DatabaseFleetListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseFleetListResult.DeserializeDatabaseFleetListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists fleets in the specified subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// 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: + { + DatabaseFleetListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseFleetListResult.DeserializeDatabaseFleetListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists fleets in the specified subscription and resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// 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: + { + DatabaseFleetListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseFleetListResult.DeserializeDatabaseFleetListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists fleets in the specified subscription and resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// 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: + { + DatabaseFleetListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseFleetListResult.DeserializeDatabaseFleetListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/RestOperations/UpdateRunsRestOperations.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/RestOperations/UpdateRunsRestOperations.cs new file mode 100644 index 000000000000..afef7ef223b9 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Generated/RestOperations/UpdateRunsRestOperations.cs @@ -0,0 +1,629 @@ +// 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; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DatabaseFleetManager.Models; + +namespace Azure.ResourceManager.DatabaseFleetManager +{ + internal partial class UpdateRunsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of UpdateRunsRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public UpdateRunsRestOperations(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 ?? "2023-06-15-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListByFleetRequest(string subscriptionId, string resourceGroupName, string fleetName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/updateRuns", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List UpdateRun resources by Fleet. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByFleetAsync(string subscriptionId, string resourceGroupName, string fleetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + + using var message = CreateListByFleetRequest(subscriptionId, resourceGroupName, fleetName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseFleetUpdateRunListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseFleetUpdateRunListResult.DeserializeDatabaseFleetUpdateRunListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List UpdateRun resources by Fleet. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByFleet(string subscriptionId, string resourceGroupName, string fleetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + + using var message = CreateListByFleetRequest(subscriptionId, resourceGroupName, fleetName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatabaseFleetUpdateRunListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseFleetUpdateRunListResult.DeserializeDatabaseFleetUpdateRunListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string fleetName, string updateRunName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/updateRuns/", false); + uri.AppendPath(updateRunName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a UpdateRun. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The name of the UpdateRun 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 fleetName, string updateRunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(updateRunName, nameof(updateRunName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, fleetName, updateRunName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseFleetUpdateRunData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseFleetUpdateRunData.DeserializeDatabaseFleetUpdateRunData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DatabaseFleetUpdateRunData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a UpdateRun. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The name of the UpdateRun 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 fleetName, string updateRunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(updateRunName, nameof(updateRunName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, fleetName, updateRunName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatabaseFleetUpdateRunData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseFleetUpdateRunData.DeserializeDatabaseFleetUpdateRunData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DatabaseFleetUpdateRunData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string fleetName, string updateRunName, DatabaseFleetUpdateRunData data, string ifMatch, string ifNoneMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/updateRuns/", false); + uri.AppendPath(updateRunName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch); + } + if (ifNoneMatch != null) + { + request.Headers.Add("If-None-Match", ifNoneMatch); + } + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create a UpdateRun. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The name of the UpdateRun resource. + /// Resource create parameters. + /// The request should only proceed if an entity matches this string. + /// The request should only proceed if no entity matches this string. + /// 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 fleetName, string updateRunName, DatabaseFleetUpdateRunData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(updateRunName, nameof(updateRunName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, fleetName, updateRunName, data, ifMatch, ifNoneMatch); + 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 UpdateRun. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The name of the UpdateRun resource. + /// Resource create parameters. + /// The request should only proceed if an entity matches this string. + /// The request should only proceed if no entity matches this string. + /// 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 fleetName, string updateRunName, DatabaseFleetUpdateRunData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(updateRunName, nameof(updateRunName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, fleetName, updateRunName, data, ifMatch, ifNoneMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string fleetName, string updateRunName, string ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/updateRuns/", false); + uri.AppendPath(updateRunName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch); + } + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a UpdateRun. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The name of the UpdateRun resource. + /// The request should only proceed if an entity matches this string. + /// 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 fleetName, string updateRunName, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(updateRunName, nameof(updateRunName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, fleetName, updateRunName, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a UpdateRun. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The name of the UpdateRun resource. + /// The request should only proceed if an entity matches this string. + /// 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 fleetName, string updateRunName, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(updateRunName, nameof(updateRunName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, fleetName, updateRunName, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateStartRequest(string subscriptionId, string resourceGroupName, string fleetName, string updateRunName, string ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/updateRuns/", false); + uri.AppendPath(updateRunName, true); + uri.AppendPath("/start", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch); + } + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Starts an UpdateRun. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The name of the UpdateRun resource. + /// The request should only proceed if an entity matches this string. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task StartAsync(string subscriptionId, string resourceGroupName, string fleetName, string updateRunName, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(updateRunName, nameof(updateRunName)); + + using var message = CreateStartRequest(subscriptionId, resourceGroupName, fleetName, updateRunName, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Starts an UpdateRun. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The name of the UpdateRun resource. + /// The request should only proceed if an entity matches this string. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Start(string subscriptionId, string resourceGroupName, string fleetName, string updateRunName, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(updateRunName, nameof(updateRunName)); + + using var message = CreateStartRequest(subscriptionId, resourceGroupName, fleetName, updateRunName, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateStopRequest(string subscriptionId, string resourceGroupName, string fleetName, string updateRunName, string ifMatch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/updateRuns/", false); + uri.AppendPath(updateRunName, true); + uri.AppendPath("/stop", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch); + } + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Stops an UpdateRun. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The name of the UpdateRun resource. + /// The request should only proceed if an entity matches this string. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task StopAsync(string subscriptionId, string resourceGroupName, string fleetName, string updateRunName, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(updateRunName, nameof(updateRunName)); + + using var message = CreateStopRequest(subscriptionId, resourceGroupName, fleetName, updateRunName, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Stops an UpdateRun. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The name of the UpdateRun resource. + /// The request should only proceed if an entity matches this string. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Stop(string subscriptionId, string resourceGroupName, string fleetName, string updateRunName, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(updateRunName, nameof(updateRunName)); + + using var message = CreateStopRequest(subscriptionId, resourceGroupName, fleetName, updateRunName, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByFleetNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string fleetName) + { + 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 UpdateRun resources by Fleet. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByFleetNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string fleetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + + using var message = CreateListByFleetNextPageRequest(nextLink, subscriptionId, resourceGroupName, fleetName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseFleetUpdateRunListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DatabaseFleetUpdateRunListResult.DeserializeDatabaseFleetUpdateRunListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List UpdateRun resources by Fleet. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByFleetNextPage(string nextLink, string subscriptionId, string resourceGroupName, string fleetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + + using var message = CreateListByFleetNextPageRequest(nextLink, subscriptionId, resourceGroupName, fleetName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatabaseFleetUpdateRunListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DatabaseFleetUpdateRunListResult.DeserializeDatabaseFleetUpdateRunListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Properties/AssemblyInfo.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..e3c63ee56c9e --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/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("Microsoft.ContainerService/fleet")] + +[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] +[assembly: InternalsVisibleTo("Azure.ResourceManager.DatabaseFleetManager.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/autorest.md b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/autorest.md new file mode 100644 index 000000000000..f9444ebe2ed5 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/src/autorest.md @@ -0,0 +1,78 @@ +# Generated code configuration + +Run `dotnet build /t:GenerateCode` to generate code. + +``` yaml +azure-arm: true +csharp: true +library-name: DatabaseFleetManager +namespace: Azure.ResourceManager.DatabaseFleetManager +require: https://github.com/Azure/azure-rest-api-specs/blob/de06c42bd985fb66b6a49c907aaf5baee693bc7b/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/readme.md +#tag: package-2023-06-preview +output-folder: $(this-folder)/Generated +clear-output-folder: true +sample-gen: + output-folder: $(this-folder)/../samples/Generated + clear-output-folder: true +skip-csproj: true +modelerfour: + flatten-payloads: false + +#mgmt-debug: +# show-serialized-names: true + +rename-mapping: + AgentProfile: FleetAgentProfile + APIServerAccessProfile: FleetApiServerAccessProfile + Fleet: DatabaseFleet + FleetListResult: DatabaseFleetListResult + FleetMember: DatabaseFleetMember + FleetMemberListResult: DatabaseFleetMemberListResult + ManagedClusterUpdate: FleetManagedClusterUpdate + ManagedClusterUpgradeSpec: FleetManagedClusterUpgradeSpec + ManagedClusterUpgradeType: FleetManagedClusterUpgradeType + MemberUpdateStatus.clusterResourceId: -|arm-id + UpdateGroup: FleetUpdateGroup + UpdateGroupStatus: FleetUpdateGroupStatus + UpdateRun: DatabaseFleetUpdateRun + UpdateRunListResult: DatabaseFleetUpdateRunListResult + UpdateRunProvisioningState: FleetUpdateRunProvisioningState + UpdateRunStatus: FleetUpdateRunStatus + UpdateRunStrategy: FleetUpdateRunStrategy + UpdateStage: FleetUpdateStage + UpdateStageStatus: FleetUpdateStageStatus + UpdateState: FleetUpdateState + UpdateStatus: FleetUpdateOperationStatus + WaitStatus: FleetWaitStatus + +format-by-name-rules: + 'tenantId': 'uuid' + 'ETag': 'etag' + 'location': 'azure-location' + '*Uri': 'Uri' + '*Uris': 'Uri' + +acronym-mapping: + CPU: Cpu + CPUs: Cpus + Os: OS + Ip: IP + Ips: IPs|ips + ID: Id + IDs: Ids + VM: Vm + VMs: Vms + Vmos: VmOS + VMScaleSet: VmScaleSet + DNS: Dns + VPN: Vpn + NAT: Nat + WAN: Wan + Ipv4: IPv4|ipv4 + Ipv6: IPv6|ipv6 + Ipsec: IPsec|ipsec + SSO: Sso + URI: Uri + Etag: ETag|etag + +``` \ No newline at end of file diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/tests/Azure.ResourceManager.DatabaseFleetManager.Tests.csproj b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/tests/Azure.ResourceManager.DatabaseFleetManager.Tests.csproj new file mode 100644 index 000000000000..800cc7d81572 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/tests/Azure.ResourceManager.DatabaseFleetManager.Tests.csproj @@ -0,0 +1,5 @@ + + + + + diff --git a/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/tests/DatabaseFleetManagerManagementTestBase.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/tests/DatabaseFleetManagerManagementTestBase.cs new file mode 100644 index 000000000000..b47a42a862e8 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/tests/DatabaseFleetManagerManagementTestBase.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.DatabaseFleetManager.Tests +{ + public class DatabaseFleetManagerManagementTestBase : ManagementRecordedTestBase + { + protected ArmClient Client { get; private set; } + protected SubscriptionResource DefaultSubscription { get; private set; } + + protected DatabaseFleetManagerManagementTestBase(bool isAsync, RecordedTestMode mode) + : base(isAsync, mode) + { + } + + protected DatabaseFleetManagerManagementTestBase(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/fleet/Azure.ResourceManager.DatabaseFleetManager/tests/DatabaseFleetManagerManagementTestEnvironment.cs b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/tests/DatabaseFleetManagerManagementTestEnvironment.cs new file mode 100644 index 000000000000..aa2ce828b954 --- /dev/null +++ b/sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/tests/DatabaseFleetManagerManagementTestEnvironment.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core.TestFramework; + +namespace Azure.ResourceManager.DatabaseFleetManager.Tests +{ + public class DatabaseFleetManagerManagementTestEnvironment : TestEnvironment + { + } +} \ No newline at end of file diff --git a/sdk/fleet/ci.mgmt.yml b/sdk/fleet/ci.mgmt.yml new file mode 100644 index 000000000000..08c7f125cee1 --- /dev/null +++ b/sdk/fleet/ci.mgmt.yml @@ -0,0 +1,23 @@ +# 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/fleet/ci.mgmt.yml + - sdk/fleet/Azure.ResourceManager.DatabaseFleetManager/ + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: fleet + LimitForPullRequest: true + Artifacts: + - name: Azure.ResourceManager.DatabaseFleetManager + safeName: AzureResourceManagerDatabaseFleetManager diff --git a/sdk/resourcemanager/ci.mgmt.yml b/sdk/resourcemanager/ci.mgmt.yml index e9486a555e2c..1e9862e171e3 100644 --- a/sdk/resourcemanager/ci.mgmt.yml +++ b/sdk/resourcemanager/ci.mgmt.yml @@ -78,6 +78,7 @@ trigger: - sdk/eventgrid/Azure.ResourceManager.EventGrid - sdk/eventhub/Azure.ResourceManager.EventHubs - sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations + - sdk/fleet/Azure.ResourceManager.DatabaseFleetManager - sdk/fluidrelay/Azure.ResourceManager.FluidRelay - sdk/frontdoor/Azure.ResourceManager.FrontDoor - sdk/grafana/Azure.ResourceManager.Grafana @@ -260,6 +261,7 @@ pr: - sdk/eventgrid/Azure.ResourceManager.EventGrid - sdk/eventhub/Azure.ResourceManager.EventHubs - sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations + - sdk/fleet/Azure.ResourceManager.DatabaseFleetManager - sdk/fluidrelay/Azure.ResourceManager.FluidRelay - sdk/frontdoor/Azure.ResourceManager.FrontDoor - sdk/grafana/Azure.ResourceManager.Grafana