diff --git a/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/src/autorest.md b/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/src/autorest.md index c9092189954e..006847c1f940 100644 --- a/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/src/autorest.md +++ b/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/src/autorest.md @@ -11,6 +11,9 @@ require: https://github.com/Azure/azure-rest-api-specs/blob/5372f410f6af3de9559b # 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 @@ -88,7 +91,7 @@ format-by-name-rules: '*Uri': 'Uri' '*Uris': 'Uri' -rename-rules: +acronym-mapping: CPU: Cpu CPUs: Cpus Os: OS diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/Azure.ResourceManager.RecoveryServicesDataReplication.sln b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/Azure.ResourceManager.RecoveryServicesDataReplication.sln new file mode 100644 index 000000000000..387760608181 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/Azure.ResourceManager.RecoveryServicesDataReplication.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("{046A2A51-F66F-49DD-83A1-96E02A95B305}") = "Azure.ResourceManager.RecoveryServicesDataReplication", "src\Azure.ResourceManager.RecoveryServicesDataReplication.csproj", "{587570EB-E5C5-4EBE-B38B-6F4E896C96F7}" +EndProject +Project("{046A2A51-F66F-49DD-83A1-96E02A95B305}") = "Azure.ResourceManager.RecoveryServicesDataReplication.Tests", "tests\Azure.ResourceManager.RecoveryServicesDataReplication.Tests.csproj", "{FA9B8A69-877B-4424-9FBC-CDDEB362A3ED}" +EndProject +Project("{046A2A51-F66F-49DD-83A1-96E02A95B305}") = "Azure.ResourceManager.RecoveryServicesDataReplication.Samples", "samples\Azure.ResourceManager.RecoveryServicesDataReplication.Samples.csproj", "{0429344B-5071-4E16-8FFA-DF84D1E4663E}" +EndProject +Global + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {998F958D-320F-420A-B882-6071D3E36D98} + 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 + {587570EB-E5C5-4EBE-B38B-6F4E896C96F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {587570EB-E5C5-4EBE-B38B-6F4E896C96F7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {587570EB-E5C5-4EBE-B38B-6F4E896C96F7}.Debug|x64.ActiveCfg = Debug|Any CPU + {587570EB-E5C5-4EBE-B38B-6F4E896C96F7}.Debug|x64.Build.0 = Debug|Any CPU + {587570EB-E5C5-4EBE-B38B-6F4E896C96F7}.Debug|x86.ActiveCfg = Debug|Any CPU + {587570EB-E5C5-4EBE-B38B-6F4E896C96F7}.Debug|x86.Build.0 = Debug|Any CPU + {587570EB-E5C5-4EBE-B38B-6F4E896C96F7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {587570EB-E5C5-4EBE-B38B-6F4E896C96F7}.Release|Any CPU.Build.0 = Release|Any CPU + {587570EB-E5C5-4EBE-B38B-6F4E896C96F7}.Release|x64.ActiveCfg = Release|Any CPU + {587570EB-E5C5-4EBE-B38B-6F4E896C96F7}.Release|x64.Build.0 = Release|Any CPU + {587570EB-E5C5-4EBE-B38B-6F4E896C96F7}.Release|x86.ActiveCfg = Release|Any CPU + {587570EB-E5C5-4EBE-B38B-6F4E896C96F7}.Release|x86.Build.0 = Release|Any CPU + {FA9B8A69-877B-4424-9FBC-CDDEB362A3ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FA9B8A69-877B-4424-9FBC-CDDEB362A3ED}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FA9B8A69-877B-4424-9FBC-CDDEB362A3ED}.Debug|x64.ActiveCfg = Debug|Any CPU + {FA9B8A69-877B-4424-9FBC-CDDEB362A3ED}.Debug|x64.Build.0 = Debug|Any CPU + {FA9B8A69-877B-4424-9FBC-CDDEB362A3ED}.Debug|x86.ActiveCfg = Debug|Any CPU + {FA9B8A69-877B-4424-9FBC-CDDEB362A3ED}.Debug|x86.Build.0 = Debug|Any CPU + {FA9B8A69-877B-4424-9FBC-CDDEB362A3ED}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FA9B8A69-877B-4424-9FBC-CDDEB362A3ED}.Release|Any CPU.Build.0 = Release|Any CPU + {FA9B8A69-877B-4424-9FBC-CDDEB362A3ED}.Release|x64.ActiveCfg = Release|Any CPU + {FA9B8A69-877B-4424-9FBC-CDDEB362A3ED}.Release|x64.Build.0 = Release|Any CPU + {FA9B8A69-877B-4424-9FBC-CDDEB362A3ED}.Release|x86.ActiveCfg = Release|Any CPU + {FA9B8A69-877B-4424-9FBC-CDDEB362A3ED}.Release|x86.Build.0 = Release|Any CPU + {0429344B-5071-4E16-8FFA-DF84D1E4663E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0429344B-5071-4E16-8FFA-DF84D1E4663E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0429344B-5071-4E16-8FFA-DF84D1E4663E}.Debug|x64.ActiveCfg = Debug|Any CPU + {0429344B-5071-4E16-8FFA-DF84D1E4663E}.Debug|x64.Build.0 = Debug|Any CPU + {0429344B-5071-4E16-8FFA-DF84D1E4663E}.Debug|x86.ActiveCfg = Debug|Any CPU + {0429344B-5071-4E16-8FFA-DF84D1E4663E}.Debug|x86.Build.0 = Debug|Any CPU + {0429344B-5071-4E16-8FFA-DF84D1E4663E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0429344B-5071-4E16-8FFA-DF84D1E4663E}.Release|Any CPU.Build.0 = Release|Any CPU + {0429344B-5071-4E16-8FFA-DF84D1E4663E}.Release|x64.ActiveCfg = Release|Any CPU + {0429344B-5071-4E16-8FFA-DF84D1E4663E}.Release|x64.Build.0 = Release|Any CPU + {0429344B-5071-4E16-8FFA-DF84D1E4663E}.Release|x86.ActiveCfg = Release|Any CPU + {0429344B-5071-4E16-8FFA-DF84D1E4663E}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/CHANGELOG.md b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/CHANGELOG.md new file mode 100644 index 000000000000..4f204a19265e --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/CHANGELOG.md @@ -0,0 +1,17 @@ +# Release History + +## 1.0.0-beta.1 (2023-09-30) + +### 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/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/Directory.Build.props b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/Directory.Build.props new file mode 100644 index 000000000000..1a9611bd4924 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/Directory.Build.props @@ -0,0 +1,6 @@ + + + + diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/README.md b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/README.md new file mode 100644 index 000000000000..f9a1842b1c84 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/README.md @@ -0,0 +1,80 @@ +# Microsoft Azure RecoveryServicesDataReplication management client library for .NET + +The Azure RecoveryServicesDataReplication provides VM migration capabilities from Hyper-V and VMware platforms to Azure Stack HCI utilizing Azure Migrate. The data movement that the service provides stays on-premises at all times while using Azure Migrate as the management plane. + +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 RecoveryServicesDataReplication management library for .NET with [NuGet](https://www.nuget.org/): + +```dotnetcli +dotnet add package Azure.ResourceManager.RecoveryServicesDataReplication --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/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/api/Azure.ResourceManager.RecoveryServicesDataReplication.netstandard2.0.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/api/Azure.ResourceManager.RecoveryServicesDataReplication.netstandard2.0.cs new file mode 100644 index 000000000000..1c9784be7f29 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/api/Azure.ResourceManager.RecoveryServicesDataReplication.netstandard2.0.cs @@ -0,0 +1,1407 @@ +namespace Azure.ResourceManager.RecoveryServicesDataReplication +{ + public partial class DataReplicationDraCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DataReplicationDraCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string fabricAgentName, Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationDraData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string fabricAgentName, Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationDraData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string fabricAgentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string fabricAgentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string fabricAgentName, 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 fabricAgentName, 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 DataReplicationDraData : Azure.ResourceManager.Models.ResourceData + { + public DataReplicationDraData(Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationDraProperties properties) { } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationDraProperties Properties { get { throw null; } set { } } + } + public partial class DataReplicationDraResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DataReplicationDraResource() { } + public virtual Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationDraData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string fabricName, string fabricAgentName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationDraData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationDraData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DataReplicationEmailConfigurationCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DataReplicationEmailConfigurationCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string emailConfigurationName, Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationEmailConfigurationData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string emailConfigurationName, Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationEmailConfigurationData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string emailConfigurationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string emailConfigurationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string emailConfigurationName, 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 emailConfigurationName, 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 DataReplicationEmailConfigurationData : Azure.ResourceManager.Models.ResourceData + { + public DataReplicationEmailConfigurationData(Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationEmailConfigurationProperties properties) { } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationEmailConfigurationProperties Properties { get { throw null; } set { } } + } + public partial class DataReplicationEmailConfigurationResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DataReplicationEmailConfigurationResource() { } + public virtual Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationEmailConfigurationData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string emailConfigurationName) { 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.RecoveryServicesDataReplication.DataReplicationEmailConfigurationData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationEmailConfigurationData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DataReplicationEventCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DataReplicationEventCollection() { } + public virtual Azure.Response Exists(string eventName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string eventName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string eventName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(string filter = null, string continuationToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(string filter = null, string continuationToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string eventName, 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 DataReplicationEventData : Azure.ResourceManager.Models.ResourceData + { + internal DataReplicationEventData() { } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationEventProperties Properties { get { throw null; } } + } + public partial class DataReplicationEventResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DataReplicationEventResource() { } + public virtual Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationEventData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string eventName) { 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 partial class DataReplicationFabricCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DataReplicationFabricCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string fabricName, Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationFabricData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string fabricName, Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationFabricData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string fabricName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string fabricName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string fabricName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(string continuationToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(string continuationToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string fabricName, 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 DataReplicationFabricData : Azure.ResourceManager.Models.TrackedResourceData + { + public DataReplicationFabricData(Azure.Core.AzureLocation location, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationFabricProperties properties) : base (default(Azure.Core.AzureLocation)) { } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationFabricProperties Properties { get { throw null; } set { } } + } + public partial class DataReplicationFabricResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DataReplicationFabricResource() { } + public virtual Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationFabricData 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 fabricName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetDataReplicationDra(string fabricAgentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDataReplicationDraAsync(string fabricAgentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationDraCollection GetDataReplicationDras() { 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.RecoveryServicesDataReplication.Models.DataReplicationFabricPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationFabricPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DataReplicationPolicyCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DataReplicationPolicyCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string policyName, Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationPolicyData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string policyName, Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationPolicyData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string policyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string policyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string policyName, 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 policyName, 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 DataReplicationPolicyData : Azure.ResourceManager.Models.ResourceData + { + public DataReplicationPolicyData(Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationPolicyProperties properties) { } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationPolicyProperties Properties { get { throw null; } set { } } + } + public partial class DataReplicationPolicyResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DataReplicationPolicyResource() { } + public virtual Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationPolicyData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string policyName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationPolicyData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationPolicyData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DataReplicationProtectedItemCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DataReplicationProtectedItemCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string protectedItemName, Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationProtectedItemData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string protectedItemName, Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationProtectedItemData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string protectedItemName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string protectedItemName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string protectedItemName, 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 protectedItemName, 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 DataReplicationProtectedItemData : Azure.ResourceManager.Models.ResourceData + { + public DataReplicationProtectedItemData(Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectedItemProperties properties) { } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectedItemProperties Properties { get { throw null; } set { } } + } + public partial class DataReplicationProtectedItemResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DataReplicationProtectedItemResource() { } + public virtual Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationProtectedItemData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string protectedItemName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, bool? forceDelete = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, bool? forceDelete = default(bool?), 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 GetDataReplicationRecoveryPoint(string recoveryPointName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDataReplicationRecoveryPointAsync(string recoveryPointName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationRecoveryPointCollection GetDataReplicationRecoveryPoints() { throw null; } + public virtual Azure.ResourceManager.ArmOperation PlannedFailover(Azure.WaitUntil waitUntil, Azure.ResourceManager.RecoveryServicesDataReplication.Models.PlannedFailoverModel body = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> PlannedFailoverAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.RecoveryServicesDataReplication.Models.PlannedFailoverModel body = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationProtectedItemData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationProtectedItemData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DataReplicationRecoveryPointCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DataReplicationRecoveryPointCollection() { } + public virtual Azure.Response Exists(string recoveryPointName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string recoveryPointName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string recoveryPointName, 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 recoveryPointName, 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 DataReplicationRecoveryPointData : Azure.ResourceManager.Models.ResourceData + { + internal DataReplicationRecoveryPointData() { } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationRecoveryPointProperties Properties { get { throw null; } } + } + public partial class DataReplicationRecoveryPointResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DataReplicationRecoveryPointResource() { } + public virtual Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationRecoveryPointData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string protectedItemName, string recoveryPointName) { 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 partial class DataReplicationReplicationExtensionCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DataReplicationReplicationExtensionCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string replicationExtensionName, Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationReplicationExtensionData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string replicationExtensionName, Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationReplicationExtensionData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string replicationExtensionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string replicationExtensionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string replicationExtensionName, 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 replicationExtensionName, 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 DataReplicationReplicationExtensionData : Azure.ResourceManager.Models.ResourceData + { + public DataReplicationReplicationExtensionData(Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationReplicationExtensionProperties properties) { } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationReplicationExtensionProperties Properties { get { throw null; } set { } } + } + public partial class DataReplicationReplicationExtensionResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DataReplicationReplicationExtensionResource() { } + public virtual Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationReplicationExtensionData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string replicationExtensionName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationReplicationExtensionData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationReplicationExtensionData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DataReplicationVaultCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DataReplicationVaultCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string vaultName, Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationVaultData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string vaultName, Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationVaultData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(string continuationToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(string continuationToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string vaultName, 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 DataReplicationVaultData : Azure.ResourceManager.Models.TrackedResourceData + { + public DataReplicationVaultData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationVaultProperties Properties { get { throw null; } set { } } + } + public partial class DataReplicationVaultResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DataReplicationVaultResource() { } + public virtual Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationVaultData 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 vaultName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetDataReplicationEmailConfiguration(string emailConfigurationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDataReplicationEmailConfigurationAsync(string emailConfigurationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationEmailConfigurationCollection GetDataReplicationEmailConfigurations() { throw null; } + public virtual Azure.Response GetDataReplicationEvent(string eventName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDataReplicationEventAsync(string eventName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationEventCollection GetDataReplicationEvents() { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationPolicyCollection GetDataReplicationPolicies() { throw null; } + public virtual Azure.Response GetDataReplicationPolicy(string policyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDataReplicationPolicyAsync(string policyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetDataReplicationProtectedItem(string protectedItemName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDataReplicationProtectedItemAsync(string protectedItemName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationProtectedItemCollection GetDataReplicationProtectedItems() { throw null; } + public virtual Azure.Response GetDataReplicationReplicationExtension(string replicationExtensionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDataReplicationReplicationExtensionAsync(string replicationExtensionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationReplicationExtensionCollection GetDataReplicationReplicationExtensions() { throw null; } + public virtual Azure.Response GetDataReplicationWorkflow(string jobName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDataReplicationWorkflowAsync(string jobName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationWorkflowCollection GetDataReplicationWorkflows() { 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.RecoveryServicesDataReplication.Models.DataReplicationVaultPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationVaultPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DataReplicationWorkflowCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DataReplicationWorkflowCollection() { } + public virtual Azure.Response Exists(string jobName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string jobName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string jobName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(string filter = null, string continuationToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(string filter = null, string continuationToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string jobName, 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 DataReplicationWorkflowData : Azure.ResourceManager.Models.ResourceData + { + internal DataReplicationWorkflowData() { } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationWorkflowProperties Properties { get { throw null; } } + } + public partial class DataReplicationWorkflowResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DataReplicationWorkflowResource() { } + public virtual Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationWorkflowData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string jobName) { 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 static partial class RecoveryServicesDataReplicationExtensions + { + public static Azure.Response CheckDataReplicationNameAvailability(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationNameAvailabilityContent content = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> CheckDataReplicationNameAvailabilityAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationNameAvailabilityContent content = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response DeploymentPreflight(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string deploymentId, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DeploymentPreflightModel body = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> DeploymentPreflightAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string deploymentId, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DeploymentPreflightModel body = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationDraResource GetDataReplicationDraResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationEmailConfigurationResource GetDataReplicationEmailConfigurationResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationEventResource GetDataReplicationEventResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.Response GetDataReplicationFabric(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string fabricName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetDataReplicationFabricAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string fabricName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationFabricResource GetDataReplicationFabricResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationFabricCollection GetDataReplicationFabrics(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetDataReplicationFabrics(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string continuationToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetDataReplicationFabricsAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string continuationToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationPolicyResource GetDataReplicationPolicyResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationProtectedItemResource GetDataReplicationProtectedItemResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationRecoveryPointResource GetDataReplicationRecoveryPointResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationReplicationExtensionResource GetDataReplicationReplicationExtensionResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.Response GetDataReplicationVault(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetDataReplicationVaultAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string vaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationVaultResource GetDataReplicationVaultResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationVaultCollection GetDataReplicationVaults(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetDataReplicationVaults(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string continuationToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetDataReplicationVaultsAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string continuationToken = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationWorkflowResource GetDataReplicationWorkflowResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + } +} +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + public static partial class ArmRecoveryServicesDataReplicationModelFactory + { + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.AzStackHciFabricModelCustomProperties AzStackHciFabricModelCustomProperties(Azure.Core.ResourceIdentifier azStackHciSiteId = null, System.Collections.Generic.IEnumerable applianceName = null, Azure.ResourceManager.RecoveryServicesDataReplication.Models.AzStackHciClusterProperties cluster = null, Azure.Core.ResourceIdentifier fabricResourceId = null, string fabricContainerId = null, Azure.Core.ResourceIdentifier migrationSolutionId = null, System.Uri migrationHubUri = null) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationDraData DataReplicationDraData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationDraProperties properties = null) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationDraProperties DataReplicationDraProperties(string correlationId = null, string machineId = null, string machineName = null, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationIdentity authenticationIdentity = null, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationIdentity resourceAccessIdentity = null, bool? isResponsive = default(bool?), System.DateTimeOffset? lastHeartbeatOn = default(System.DateTimeOffset?), string versionNumber = null, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProvisioningState? provisioningState = default(Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProvisioningState?), System.Collections.Generic.IEnumerable healthErrors = null, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DraModelCustomProperties customProperties = null) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationEmailConfigurationData DataReplicationEmailConfigurationData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationEmailConfigurationProperties properties = null) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationErrorInfo DataReplicationErrorInfo(string code = null, string errorModelType = null, string severity = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), string message = null, string causes = null, string recommendation = null) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationEventData DataReplicationEventData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationEventProperties properties = null) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationEventProperties DataReplicationEventProperties(Azure.Core.ResourceType? resourceType = default(Azure.Core.ResourceType?), string resourceName = null, string eventType = null, string eventName = null, System.DateTimeOffset? occurredOn = default(System.DateTimeOffset?), string severity = null, string description = null, string correlationId = null, System.Collections.Generic.IEnumerable healthErrors = null, Azure.ResourceManager.RecoveryServicesDataReplication.Models.EventModelCustomProperties customProperties = null) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationFabricData DataReplicationFabricData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationFabricProperties properties = null) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationFabricProperties DataReplicationFabricProperties(Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProvisioningState? provisioningState = default(Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProvisioningState?), string serviceEndpoint = null, Azure.Core.ResourceIdentifier serviceResourceId = null, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationHealthStatus? health = default(Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationHealthStatus?), System.Collections.Generic.IEnumerable healthErrors = null, Azure.ResourceManager.RecoveryServicesDataReplication.Models.FabricModelCustomProperties customProperties = null) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationHealthErrorInfo DataReplicationHealthErrorInfo(string affectedResourceType = null, System.Collections.Generic.IEnumerable affectedResourceCorrelationIds = null, System.Collections.Generic.IEnumerable childErrors = null, string code = null, string healthCategory = null, string category = null, string severity = null, string source = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), bool? isCustomerResolvable = default(bool?), string summary = null, string message = null, string causes = null, string recommendation = null) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationInnerHealthErrorInfo DataReplicationInnerHealthErrorInfo(string code = null, string healthCategory = null, string category = null, string severity = null, string source = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), bool? isCustomerResolvable = default(bool?), string summary = null, string message = null, string causes = null, string recommendation = null) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationNameAvailabilityResult DataReplicationNameAvailabilityResult(bool? isNameAvailable = default(bool?), string reason = null, string message = null) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationPolicyData DataReplicationPolicyData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationPolicyProperties properties = null) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationPolicyProperties DataReplicationPolicyProperties(Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProvisioningState? provisioningState = default(Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProvisioningState?), Azure.ResourceManager.RecoveryServicesDataReplication.Models.PolicyModelCustomProperties customProperties = null) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationProtectedItemData DataReplicationProtectedItemData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectedItemProperties properties = null) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectedItemProperties DataReplicationProtectedItemProperties(string policyName = null, string replicationExtensionName = null, string correlationId = null, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProvisioningState? provisioningState = default(Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProvisioningState?), Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState? protectionState = default(Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState?), string protectionStateDescription = null, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationTestFailoverState? testFailoverState = default(Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationTestFailoverState?), string testFailoverStateDescription = null, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationResynchronizationState? resynchronizationState = default(Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationResynchronizationState?), string fabricObjectId = null, string fabricObjectName = null, string sourceFabricProviderId = null, string targetFabricProviderId = null, string fabricId = null, string targetFabricId = null, string draId = null, string targetDraId = null, bool? isResyncRequired = default(bool?), System.DateTimeOffset? lastSuccessfulPlannedFailoverOn = default(System.DateTimeOffset?), System.DateTimeOffset? lastSuccessfulUnplannedFailoverOn = default(System.DateTimeOffset?), System.DateTimeOffset? lastSuccessfulTestFailoverOn = default(System.DateTimeOffset?), Azure.ResourceManager.RecoveryServicesDataReplication.Models.ProtectedItemJobProperties currentJob = null, System.Collections.Generic.IEnumerable allowedJobs = null, Azure.ResourceManager.RecoveryServicesDataReplication.Models.ProtectedItemJobProperties lastFailedEnableProtectionJob = null, Azure.ResourceManager.RecoveryServicesDataReplication.Models.ProtectedItemJobProperties lastFailedPlannedFailoverJob = null, Azure.ResourceManager.RecoveryServicesDataReplication.Models.ProtectedItemJobProperties lastTestFailoverJob = null, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationHealthStatus? replicationHealth = default(Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationHealthStatus?), System.Collections.Generic.IEnumerable healthErrors = null, Azure.ResourceManager.RecoveryServicesDataReplication.Models.ProtectedItemModelCustomProperties customProperties = null) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationRecoveryPointData DataReplicationRecoveryPointData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationRecoveryPointProperties properties = null) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationRecoveryPointProperties DataReplicationRecoveryPointProperties(System.DateTimeOffset recoveryPointOn = default(System.DateTimeOffset), Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationRecoveryPointType recoveryPointType = default(Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationRecoveryPointType), Azure.ResourceManager.RecoveryServicesDataReplication.Models.RecoveryPointModelCustomProperties customProperties = null) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationReplicationExtensionData DataReplicationReplicationExtensionData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationReplicationExtensionProperties properties = null) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationReplicationExtensionProperties DataReplicationReplicationExtensionProperties(Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProvisioningState? provisioningState = default(Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProvisioningState?), Azure.ResourceManager.RecoveryServicesDataReplication.Models.ReplicationExtensionModelCustomProperties customProperties = null) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationTask DataReplicationTask(string taskName = null, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationTaskState? state = default(Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationTaskState?), System.DateTimeOffset? startOn = default(System.DateTimeOffset?), System.DateTimeOffset? endOn = default(System.DateTimeOffset?), string customInstanceType = null, System.Collections.Generic.IEnumerable childrenWorkflows = null) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationVaultData DataReplicationVaultData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationVaultProperties properties = null) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationVaultProperties DataReplicationVaultProperties(Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProvisioningState? provisioningState = default(Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProvisioningState?), Azure.Core.ResourceIdentifier serviceResourceId = null, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationReplicationVaultType? vaultType = default(Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationReplicationVaultType?)) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.DataReplicationWorkflowData DataReplicationWorkflowData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationWorkflowProperties properties = null) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationWorkflowProperties DataReplicationWorkflowProperties(string displayName = null, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationWorkflowState? state = default(Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationWorkflowState?), System.DateTimeOffset? startOn = default(System.DateTimeOffset?), System.DateTimeOffset? endOn = default(System.DateTimeOffset?), string objectId = null, string objectName = null, string objectInternalId = null, string objectInternalName = null, Azure.ResourceManager.RecoveryServicesDataReplication.Models.WorkflowObjectType? objectType = default(Azure.ResourceManager.RecoveryServicesDataReplication.Models.WorkflowObjectType?), string replicationProviderId = null, string sourceFabricProviderId = null, string targetFabricProviderId = null, System.Collections.Generic.IEnumerable allowedActions = null, string activityId = null, System.Collections.Generic.IEnumerable tasks = null, System.Collections.Generic.IEnumerable errors = null, Azure.ResourceManager.RecoveryServicesDataReplication.Models.WorkflowModelCustomProperties customProperties = null) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.FailoverProtectedItemProperties FailoverProtectedItemProperties(string protectedItemName = null, string vmName = null, string testVmName = null, string recoveryPointId = null, System.DateTimeOffset? recoveryPointOn = default(System.DateTimeOffset?), string networkName = null, string subnet = null) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.FailoverWorkflowModelCustomProperties FailoverWorkflowModelCustomProperties(System.Collections.Generic.IReadOnlyDictionary affectedObjectDetails = null, System.Collections.Generic.IEnumerable protectedItemDetails = null) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.HyperVMigrateFabricModelCustomProperties HyperVMigrateFabricModelCustomProperties(Azure.Core.ResourceIdentifier hyperVSiteId = null, Azure.Core.ResourceIdentifier fabricResourceId = null, string fabricContainerId = null, Azure.Core.ResourceIdentifier migrationSolutionId = null, System.Uri migrationHubUri = null) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.HyperVToAzStackHciEventModelCustomProperties HyperVToAzStackHciEventModelCustomProperties(string eventSourceFriendlyName = null, string protectedItemFriendlyName = null, string sourceApplianceName = null, string targetApplianceName = null, string serverType = null) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.HyperVToAzStackHciNicInput HyperVToAzStackHciNicInput(string nicId = null, string networkName = null, string targetNetworkId = null, string testNetworkId = null, Azure.ResourceManager.RecoveryServicesDataReplication.Models.VmNicSelection selectionTypeForFailover = default(Azure.ResourceManager.RecoveryServicesDataReplication.Models.VmNicSelection)) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.HyperVToAzStackHciProtectedDiskProperties HyperVToAzStackHciProtectedDiskProperties(Azure.Core.ResourceIdentifier storageContainerId = null, string storageContainerLocalPath = null, string sourceDiskId = null, string sourceDiskName = null, string seedDiskName = null, string testMigrateDiskName = null, string migrateDiskName = null, bool? isOSDisk = default(bool?), long? capacityInBytes = default(long?), bool? isDynamic = default(bool?), string diskType = null) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.HyperVToAzStackHciProtectedItemModelCustomProperties HyperVToAzStackHciProtectedItemModelCustomProperties(Azure.ResourceManager.RecoveryServicesDataReplication.Models.ProtectedItemActiveLocation? activeLocation = default(Azure.ResourceManager.RecoveryServicesDataReplication.Models.ProtectedItemActiveLocation?), Azure.Core.ResourceIdentifier targetHciClusterId = null, Azure.Core.ResourceIdentifier targetArcClusterCustomLocationId = null, string targetAzStackHciClusterName = null, Azure.Core.ResourceIdentifier fabricDiscoveryMachineId = null, System.Collections.Generic.IEnumerable disksToInclude = null, System.Collections.Generic.IEnumerable nicsToInclude = null, string sourceVmName = null, int? sourceCpuCores = default(int?), double? sourceMemoryInMegaBytes = default(double?), string targetVmName = null, Azure.Core.ResourceIdentifier targetResourceGroupId = null, Azure.Core.ResourceIdentifier storageContainerId = null, string hyperVGeneration = null, string targetNetworkId = null, string testNetworkId = null, int? targetCpuCores = default(int?), bool? isDynamicRam = default(bool?), Azure.ResourceManager.RecoveryServicesDataReplication.Models.ProtectedItemDynamicMemoryConfig dynamicMemoryConfig = null, int? targetMemoryInMegaBytes = default(int?), string runAsAccountId = null, string sourceDraName = null, string targetDraName = null, string sourceApplianceName = null, string targetApplianceName = null, string osType = null, string osName = null, string firmwareType = null, string targetLocation = null, string customLocationRegion = null, string failoverRecoveryPointId = null, System.DateTimeOffset? lastRecoveryPointReceived = default(System.DateTimeOffset?), string lastRecoveryPointId = null, int? initialReplicationProgressPercentage = default(int?), int? resyncProgressPercentage = default(int?), System.Collections.Generic.IEnumerable protectedDisks = null, System.Collections.Generic.IEnumerable protectedNics = null, string targetVmBiosId = null, System.DateTimeOffset? lastReplicationUpdateOn = default(System.DateTimeOffset?)) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.HyperVToAzStackHciProtectedNicProperties HyperVToAzStackHciProtectedNicProperties(string nicId = null, string macAddress = null, string networkName = null, string targetNetworkId = null, string testNetworkId = null, Azure.ResourceManager.RecoveryServicesDataReplication.Models.VmNicSelection? selectionTypeForFailover = default(Azure.ResourceManager.RecoveryServicesDataReplication.Models.VmNicSelection?)) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.HyperVToAzStackHciRecoveryPointModelCustomProperties HyperVToAzStackHciRecoveryPointModelCustomProperties(System.Collections.Generic.IEnumerable diskIds = null) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.HyperVToAzStackHciReplicationExtensionModelCustomProperties HyperVToAzStackHciReplicationExtensionModelCustomProperties(Azure.Core.ResourceIdentifier hyperVFabricArmId = null, Azure.Core.ResourceIdentifier hyperVSiteId = null, Azure.Core.ResourceIdentifier azStackHciFabricArmId = null, Azure.Core.ResourceIdentifier azStackHciSiteId = null, string storageAccountId = null, string storageAccountSasSecretName = null, System.Uri asrServiceUri = null, System.Uri rcmServiceUri = null, System.Uri gatewayServiceUri = null, string sourceGatewayServiceId = null, string targetGatewayServiceId = null, string sourceStorageContainerName = null, string targetStorageContainerName = null, string resourceLocation = null, string subscriptionId = null, string resourceGroup = null) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.ProtectedItemJobProperties ProtectedItemJobProperties(string scenarioName = null, string id = null, string name = null, string displayName = null, string state = null, System.DateTimeOffset? startOn = default(System.DateTimeOffset?), System.DateTimeOffset? endOn = default(System.DateTimeOffset?)) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.TestFailoverCleanupWorkflowModelCustomProperties TestFailoverCleanupWorkflowModelCustomProperties(System.Collections.Generic.IReadOnlyDictionary affectedObjectDetails = null, string comments = null) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.TestFailoverWorkflowModelCustomProperties TestFailoverWorkflowModelCustomProperties(System.Collections.Generic.IReadOnlyDictionary affectedObjectDetails = null, System.Collections.Generic.IEnumerable protectedItemDetails = null) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.VMwareToAzStackHciNicInput VMwareToAzStackHciNicInput(string nicId = null, string label = null, string networkName = null, string targetNetworkId = null, string testNetworkId = null, Azure.ResourceManager.RecoveryServicesDataReplication.Models.VmNicSelection selectionTypeForFailover = default(Azure.ResourceManager.RecoveryServicesDataReplication.Models.VmNicSelection)) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.VMwareToAzStackHciProtectedDiskProperties VMwareToAzStackHciProtectedDiskProperties(Azure.Core.ResourceIdentifier storageContainerId = null, string storageContainerLocalPath = null, string sourceDiskId = null, string sourceDiskName = null, string seedDiskName = null, string testMigrateDiskName = null, string migrateDiskName = null, bool? isOSDisk = default(bool?), long? capacityInBytes = default(long?), bool? isDynamic = default(bool?), string diskType = null) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.VMwareToAzStackHciProtectedItemModelCustomProperties VMwareToAzStackHciProtectedItemModelCustomProperties(Azure.ResourceManager.RecoveryServicesDataReplication.Models.ProtectedItemActiveLocation? activeLocation = default(Azure.ResourceManager.RecoveryServicesDataReplication.Models.ProtectedItemActiveLocation?), Azure.Core.ResourceIdentifier targetHciClusterId = null, Azure.Core.ResourceIdentifier targetArcClusterCustomLocationId = null, string targetAzStackHciClusterName = null, Azure.Core.ResourceIdentifier storageContainerId = null, Azure.Core.ResourceIdentifier targetResourceGroupId = null, string targetLocation = null, string customLocationRegion = null, System.Collections.Generic.IEnumerable disksToInclude = null, System.Collections.Generic.IEnumerable nicsToInclude = null, System.Collections.Generic.IEnumerable protectedDisks = null, System.Collections.Generic.IEnumerable protectedNics = null, string targetVmBiosId = null, string targetVmName = null, string hyperVGeneration = null, string targetNetworkId = null, string testNetworkId = null, int? targetCpuCores = default(int?), bool? isDynamicRam = default(bool?), Azure.ResourceManager.RecoveryServicesDataReplication.Models.ProtectedItemDynamicMemoryConfig dynamicMemoryConfig = null, int? targetMemoryInMegaBytes = default(int?), string osType = null, string osName = null, string firmwareType = null, Azure.Core.ResourceIdentifier fabricDiscoveryMachineId = null, string sourceVmName = null, int? sourceCpuCores = default(int?), double? sourceMemoryInMegaBytes = default(double?), string runAsAccountId = null, string sourceDraName = null, string targetDraName = null, string sourceApplianceName = null, string targetApplianceName = null, string failoverRecoveryPointId = null, System.DateTimeOffset? lastRecoveryPointReceived = default(System.DateTimeOffset?), string lastRecoveryPointId = null, int? initialReplicationProgressPercentage = default(int?), int? migrationProgressPercentage = default(int?), int? resumeProgressPercentage = default(int?), int? resyncProgressPercentage = default(int?), long? resyncRetryCount = default(long?), bool? resyncRequired = default(bool?), Azure.ResourceManager.RecoveryServicesDataReplication.Models.VMwareToAzureMigrateResyncState? resyncState = default(Azure.ResourceManager.RecoveryServicesDataReplication.Models.VMwareToAzureMigrateResyncState?), bool? performAutoResync = default(bool?), long? resumeRetryCount = default(long?), System.DateTimeOffset? lastReplicationUpdateOn = default(System.DateTimeOffset?)) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.VMwareToAzStackHciProtectedNicProperties VMwareToAzStackHciProtectedNicProperties(string nicId = null, string macAddress = null, string label = null, bool? isPrimaryNic = default(bool?), string networkName = null, string targetNetworkId = null, string testNetworkId = null, Azure.ResourceManager.RecoveryServicesDataReplication.Models.VmNicSelection? selectionTypeForFailover = default(Azure.ResourceManager.RecoveryServicesDataReplication.Models.VmNicSelection?)) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.VMwareToAzStackHciReplicationExtensionModelCustomProperties VMwareToAzStackHciReplicationExtensionModelCustomProperties(Azure.Core.ResourceIdentifier vmwareFabricArmId = null, Azure.Core.ResourceIdentifier vmwareSiteId = null, Azure.Core.ResourceIdentifier azStackHciFabricArmId = null, Azure.Core.ResourceIdentifier azStackHciSiteId = null, Azure.Core.ResourceIdentifier storageAccountId = null, string storageAccountSasSecretName = null, System.Uri asrServiceUri = null, System.Uri rcmServiceUri = null, System.Uri gatewayServiceUri = null, string sourceGatewayServiceId = null, string targetGatewayServiceId = null, string sourceStorageContainerName = null, string targetStorageContainerName = null, string resourceLocation = null, string subscriptionId = null, string resourceGroup = null) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.WorkflowModelCustomProperties WorkflowModelCustomProperties(string instanceType = null, System.Collections.Generic.IReadOnlyDictionary affectedObjectDetails = null) { throw null; } + } + public partial class AzStackHciClusterProperties + { + public AzStackHciClusterProperties(string clusterName, string resourceName, string storageAccountName, System.Collections.Generic.IEnumerable storageContainers) { } + public string ClusterName { get { throw null; } set { } } + public string ResourceName { get { throw null; } set { } } + public string StorageAccountName { get { throw null; } set { } } + public System.Collections.Generic.IList StorageContainers { get { throw null; } } + } + public partial class AzStackHciFabricModelCustomProperties : Azure.ResourceManager.RecoveryServicesDataReplication.Models.FabricModelCustomProperties + { + public AzStackHciFabricModelCustomProperties(Azure.Core.ResourceIdentifier azStackHciSiteId, Azure.ResourceManager.RecoveryServicesDataReplication.Models.AzStackHciClusterProperties cluster, Azure.Core.ResourceIdentifier migrationSolutionId) { } + public System.Collections.Generic.IReadOnlyList ApplianceName { get { throw null; } } + public Azure.Core.ResourceIdentifier AzStackHciSiteId { get { throw null; } set { } } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.AzStackHciClusterProperties Cluster { get { throw null; } set { } } + public string FabricContainerId { get { throw null; } } + public Azure.Core.ResourceIdentifier FabricResourceId { get { throw null; } } + public System.Uri MigrationHubUri { get { throw null; } } + public Azure.Core.ResourceIdentifier MigrationSolutionId { get { throw null; } set { } } + } + public partial class DataReplicationDraProperties + { + public DataReplicationDraProperties(string machineId, string machineName, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationIdentity authenticationIdentity, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationIdentity resourceAccessIdentity, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DraModelCustomProperties customProperties) { } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationIdentity AuthenticationIdentity { get { throw null; } set { } } + public string CorrelationId { get { throw null; } } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.DraModelCustomProperties CustomProperties { get { throw null; } set { } } + public System.Collections.Generic.IReadOnlyList HealthErrors { get { throw null; } } + public bool? IsResponsive { get { throw null; } } + public System.DateTimeOffset? LastHeartbeatOn { get { throw null; } } + public string MachineId { get { throw null; } set { } } + public string MachineName { get { throw null; } set { } } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProvisioningState? ProvisioningState { get { throw null; } } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationIdentity ResourceAccessIdentity { get { throw null; } set { } } + public string VersionNumber { get { throw null; } } + } + public partial class DataReplicationEmailConfigurationProperties + { + public DataReplicationEmailConfigurationProperties(bool sendToOwners) { } + public System.Collections.Generic.IList CustomEmailAddresses { get { throw null; } } + public string Locale { get { throw null; } set { } } + public bool SendToOwners { get { throw null; } set { } } + } + public partial class DataReplicationErrorInfo + { + internal DataReplicationErrorInfo() { } + public string Causes { get { throw null; } } + public string Code { get { throw null; } } + public System.DateTimeOffset? CreatedOn { get { throw null; } } + public string ErrorModelType { get { throw null; } } + public string Message { get { throw null; } } + public string Recommendation { get { throw null; } } + public string Severity { get { throw null; } } + } + public partial class DataReplicationEventProperties + { + internal DataReplicationEventProperties() { } + public string CorrelationId { get { throw null; } } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.EventModelCustomProperties CustomProperties { get { throw null; } } + public string Description { get { throw null; } } + public string EventName { get { throw null; } } + public string EventType { get { throw null; } } + public System.Collections.Generic.IReadOnlyList HealthErrors { get { throw null; } } + public System.DateTimeOffset? OccurredOn { get { throw null; } } + public string ResourceName { get { throw null; } } + public Azure.Core.ResourceType? ResourceType { get { throw null; } } + public string Severity { get { throw null; } } + } + public partial class DataReplicationFabricPatch : Azure.ResourceManager.Models.ResourceData + { + public DataReplicationFabricPatch() { } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationFabricProperties Properties { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + } + public partial class DataReplicationFabricProperties + { + public DataReplicationFabricProperties(Azure.ResourceManager.RecoveryServicesDataReplication.Models.FabricModelCustomProperties customProperties) { } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.FabricModelCustomProperties CustomProperties { get { throw null; } set { } } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationHealthStatus? Health { get { throw null; } } + public System.Collections.Generic.IReadOnlyList HealthErrors { get { throw null; } } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProvisioningState? ProvisioningState { get { throw null; } } + public string ServiceEndpoint { get { throw null; } } + public Azure.Core.ResourceIdentifier ServiceResourceId { get { throw null; } } + } + public partial class DataReplicationHealthErrorInfo + { + internal DataReplicationHealthErrorInfo() { } + public System.Collections.Generic.IReadOnlyList AffectedResourceCorrelationIds { get { throw null; } } + public string AffectedResourceType { get { throw null; } } + public string Category { get { throw null; } } + public string Causes { get { throw null; } } + public System.Collections.Generic.IReadOnlyList ChildErrors { get { throw null; } } + public string Code { get { throw null; } } + public System.DateTimeOffset? CreatedOn { get { throw null; } } + public string HealthCategory { get { throw null; } } + public bool? IsCustomerResolvable { get { throw null; } } + public string Message { get { throw null; } } + public string Recommendation { get { throw null; } } + public string Severity { get { throw null; } } + public string Source { get { throw null; } } + public string Summary { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DataReplicationHealthStatus : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DataReplicationHealthStatus(string value) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationHealthStatus Critical { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationHealthStatus Normal { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationHealthStatus Warning { get { throw null; } } + public bool Equals(Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationHealthStatus 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.RecoveryServicesDataReplication.Models.DataReplicationHealthStatus left, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationHealthStatus right) { throw null; } + public static implicit operator Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationHealthStatus (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationHealthStatus left, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationHealthStatus right) { throw null; } + public override string ToString() { throw null; } + } + public partial class DataReplicationIdentity + { + public DataReplicationIdentity(System.Guid tenantId, string applicationId, string objectId, string audience, string aadAuthority) { } + public string AadAuthority { get { throw null; } set { } } + public string ApplicationId { get { throw null; } set { } } + public string Audience { get { throw null; } set { } } + public string ObjectId { get { throw null; } set { } } + public System.Guid TenantId { get { throw null; } set { } } + } + public partial class DataReplicationInnerHealthErrorInfo + { + internal DataReplicationInnerHealthErrorInfo() { } + public string Category { get { throw null; } } + public string Causes { get { throw null; } } + public string Code { get { throw null; } } + public System.DateTimeOffset? CreatedOn { get { throw null; } } + public string HealthCategory { get { throw null; } } + public bool? IsCustomerResolvable { get { throw null; } } + public string Message { get { throw null; } } + public string Recommendation { get { throw null; } } + public string Severity { get { throw null; } } + public string Source { get { throw null; } } + public string Summary { get { throw null; } } + } + public partial class DataReplicationNameAvailabilityContent + { + public DataReplicationNameAvailabilityContent() { } + public string Name { get { throw null; } set { } } + public Azure.Core.ResourceType? ResourceType { get { throw null; } set { } } + } + public partial class DataReplicationNameAvailabilityResult + { + internal DataReplicationNameAvailabilityResult() { } + public bool? IsNameAvailable { get { throw null; } } + public string Message { get { throw null; } } + public string Reason { get { throw null; } } + } + public partial class DataReplicationPolicyProperties + { + public DataReplicationPolicyProperties(Azure.ResourceManager.RecoveryServicesDataReplication.Models.PolicyModelCustomProperties customProperties) { } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.PolicyModelCustomProperties CustomProperties { get { throw null; } set { } } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProvisioningState? ProvisioningState { get { throw null; } } + } + public partial class DataReplicationProtectedItemProperties + { + public DataReplicationProtectedItemProperties(string policyName, string replicationExtensionName, Azure.ResourceManager.RecoveryServicesDataReplication.Models.ProtectedItemModelCustomProperties customProperties) { } + public System.Collections.Generic.IReadOnlyList AllowedJobs { get { throw null; } } + public string CorrelationId { get { throw null; } } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.ProtectedItemJobProperties CurrentJob { get { throw null; } } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.ProtectedItemModelCustomProperties CustomProperties { get { throw null; } set { } } + public string DraId { get { throw null; } } + public string FabricId { get { throw null; } } + public string FabricObjectId { get { throw null; } } + public string FabricObjectName { get { throw null; } } + public System.Collections.Generic.IReadOnlyList HealthErrors { get { throw null; } } + public bool? IsResyncRequired { get { throw null; } } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.ProtectedItemJobProperties LastFailedEnableProtectionJob { get { throw null; } } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.ProtectedItemJobProperties LastFailedPlannedFailoverJob { get { throw null; } } + public System.DateTimeOffset? LastSuccessfulPlannedFailoverOn { get { throw null; } } + public System.DateTimeOffset? LastSuccessfulTestFailoverOn { get { throw null; } } + public System.DateTimeOffset? LastSuccessfulUnplannedFailoverOn { get { throw null; } } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.ProtectedItemJobProperties LastTestFailoverJob { get { throw null; } } + public string PolicyName { get { throw null; } set { } } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState? ProtectionState { get { throw null; } } + public string ProtectionStateDescription { get { throw null; } } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProvisioningState? ProvisioningState { get { throw null; } } + public string ReplicationExtensionName { get { throw null; } set { } } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationHealthStatus? ReplicationHealth { get { throw null; } } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationResynchronizationState? ResynchronizationState { get { throw null; } } + public string SourceFabricProviderId { get { throw null; } } + public string TargetDraId { get { throw null; } } + public string TargetFabricId { get { throw null; } } + public string TargetFabricProviderId { get { throw null; } } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationTestFailoverState? TestFailoverState { get { throw null; } } + public string TestFailoverStateDescription { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DataReplicationProtectionState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DataReplicationProtectionState(string value) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState CancelFailoverFailedOnPrimary { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState CancelFailoverFailedOnRecovery { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState CancelFailoverInProgressOnPrimary { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState CancelFailoverInProgressOnRecovery { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState CancelFailoverStatesBegin { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState CancelFailoverStatesEnd { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState ChangeRecoveryPointCompleted { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState ChangeRecoveryPointFailed { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState ChangeRecoveryPointInitiated { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState ChangeRecoveryPointStatesBegin { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState ChangeRecoveryPointStatesEnd { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState CommitFailoverCompleted { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState CommitFailoverFailedOnPrimary { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState CommitFailoverFailedOnRecovery { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState CommitFailoverInProgressOnPrimary { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState CommitFailoverInProgressOnRecovery { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState CommitFailoverStatesBegin { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState CommitFailoverStatesEnd { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState DisablingFailed { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState DisablingProtection { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState EnablingFailed { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState EnablingProtection { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState InitialReplicationCompletedOnPrimary { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState InitialReplicationCompletedOnRecovery { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState InitialReplicationFailed { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState InitialReplicationInProgress { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState InitialReplicationStatesBegin { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState InitialReplicationStatesEnd { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState MarkedForDeletion { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState PlannedFailoverCompleted { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState PlannedFailoverCompleting { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState PlannedFailoverCompletionFailed { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState PlannedFailoverFailed { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState PlannedFailoverInitiated { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState PlannedFailoverTransitionStatesBegin { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState PlannedFailoverTransitionStatesEnd { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState Protected { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState ProtectedStatesBegin { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState ProtectedStatesEnd { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState ReprotectFailed { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState ReprotectInitiated { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState ReprotectStatesBegin { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState ReprotectStatesEnd { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState UnplannedFailoverCompleted { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState UnplannedFailoverCompleting { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState UnplannedFailoverCompletionFailed { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState UnplannedFailoverFailed { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState UnplannedFailoverInitiated { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState UnplannedFailoverTransitionStatesBegin { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState UnplannedFailoverTransitionStatesEnd { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState UnprotectedStatesBegin { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState UnprotectedStatesEnd { get { throw null; } } + public bool Equals(Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState 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.RecoveryServicesDataReplication.Models.DataReplicationProtectionState left, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState right) { throw null; } + public static implicit operator Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState left, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProtectionState right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DataReplicationProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DataReplicationProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProvisioningState Creating { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProvisioningState Deleted { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProvisioningState Deleting { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProvisioningState Succeeded { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProvisioningState Updating { get { throw null; } } + public bool Equals(Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProvisioningState 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.RecoveryServicesDataReplication.Models.DataReplicationProvisioningState left, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProvisioningState left, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class DataReplicationRecoveryPointProperties + { + internal DataReplicationRecoveryPointProperties() { } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.RecoveryPointModelCustomProperties CustomProperties { get { throw null; } } + public System.DateTimeOffset RecoveryPointOn { get { throw null; } } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationRecoveryPointType RecoveryPointType { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DataReplicationRecoveryPointType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DataReplicationRecoveryPointType(string value) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationRecoveryPointType ApplicationConsistent { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationRecoveryPointType CrashConsistent { get { throw null; } } + public bool Equals(Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationRecoveryPointType 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.RecoveryServicesDataReplication.Models.DataReplicationRecoveryPointType left, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationRecoveryPointType right) { throw null; } + public static implicit operator Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationRecoveryPointType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationRecoveryPointType left, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationRecoveryPointType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class DataReplicationReplicationExtensionProperties + { + public DataReplicationReplicationExtensionProperties(Azure.ResourceManager.RecoveryServicesDataReplication.Models.ReplicationExtensionModelCustomProperties customProperties) { } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.ReplicationExtensionModelCustomProperties CustomProperties { get { throw null; } set { } } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProvisioningState? ProvisioningState { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DataReplicationReplicationVaultType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DataReplicationReplicationVaultType(string value) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationReplicationVaultType DisasterRecovery { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationReplicationVaultType Migrate { get { throw null; } } + public bool Equals(Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationReplicationVaultType 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.RecoveryServicesDataReplication.Models.DataReplicationReplicationVaultType left, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationReplicationVaultType right) { throw null; } + public static implicit operator Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationReplicationVaultType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationReplicationVaultType left, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationReplicationVaultType right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DataReplicationResynchronizationState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DataReplicationResynchronizationState(string value) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationResynchronizationState None { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationResynchronizationState ResynchronizationCompleted { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationResynchronizationState ResynchronizationFailed { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationResynchronizationState ResynchronizationInitiated { get { throw null; } } + public bool Equals(Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationResynchronizationState 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.RecoveryServicesDataReplication.Models.DataReplicationResynchronizationState left, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationResynchronizationState right) { throw null; } + public static implicit operator Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationResynchronizationState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationResynchronizationState left, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationResynchronizationState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class DataReplicationTask + { + internal DataReplicationTask() { } + public System.Collections.Generic.IReadOnlyList ChildrenWorkflows { get { throw null; } } + public string CustomInstanceType { get { throw null; } } + public System.DateTimeOffset? EndOn { get { throw null; } } + public System.DateTimeOffset? StartOn { get { throw null; } } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationTaskState? State { get { throw null; } } + public string TaskName { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DataReplicationTaskState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DataReplicationTaskState(string value) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationTaskState Cancelled { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationTaskState Failed { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationTaskState Pending { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationTaskState Skipped { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationTaskState Started { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationTaskState Succeeded { get { throw null; } } + public bool Equals(Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationTaskState 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.RecoveryServicesDataReplication.Models.DataReplicationTaskState left, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationTaskState right) { throw null; } + public static implicit operator Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationTaskState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationTaskState left, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationTaskState right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DataReplicationTestFailoverState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DataReplicationTestFailoverState(string value) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationTestFailoverState MarkedForDeletion { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationTestFailoverState None { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationTestFailoverState TestFailoverCleanupCompleting { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationTestFailoverState TestFailoverCleanupInitiated { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationTestFailoverState TestFailoverCompleted { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationTestFailoverState TestFailoverCompleting { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationTestFailoverState TestFailoverCompletionFailed { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationTestFailoverState TestFailoverFailed { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationTestFailoverState TestFailoverInitiated { get { throw null; } } + public bool Equals(Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationTestFailoverState 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.RecoveryServicesDataReplication.Models.DataReplicationTestFailoverState left, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationTestFailoverState right) { throw null; } + public static implicit operator Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationTestFailoverState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationTestFailoverState left, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationTestFailoverState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class DataReplicationVaultPatch : Azure.ResourceManager.Models.ResourceData + { + public DataReplicationVaultPatch() { } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationVaultProperties Properties { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + } + public partial class DataReplicationVaultProperties + { + public DataReplicationVaultProperties() { } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationProvisioningState? ProvisioningState { get { throw null; } } + public Azure.Core.ResourceIdentifier ServiceResourceId { get { throw null; } } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationReplicationVaultType? VaultType { get { throw null; } set { } } + } + public partial class DataReplicationWorkflowProperties + { + internal DataReplicationWorkflowProperties() { } + public string ActivityId { get { throw null; } } + public System.Collections.Generic.IReadOnlyList AllowedActions { get { throw null; } } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.WorkflowModelCustomProperties CustomProperties { get { throw null; } } + public string DisplayName { get { throw null; } } + public System.DateTimeOffset? EndOn { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public string ObjectId { get { throw null; } } + public string ObjectInternalId { get { throw null; } } + public string ObjectInternalName { get { throw null; } } + public string ObjectName { get { throw null; } } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.WorkflowObjectType? ObjectType { get { throw null; } } + public string ReplicationProviderId { get { throw null; } } + public string SourceFabricProviderId { get { throw null; } } + public System.DateTimeOffset? StartOn { get { throw null; } } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationWorkflowState? State { get { throw null; } } + public string TargetFabricProviderId { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Tasks { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DataReplicationWorkflowState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DataReplicationWorkflowState(string value) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationWorkflowState Cancelled { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationWorkflowState Cancelling { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationWorkflowState CompletedWithErrors { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationWorkflowState CompletedWithInformation { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationWorkflowState CompletedWithWarnings { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationWorkflowState Failed { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationWorkflowState Pending { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationWorkflowState Started { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationWorkflowState Succeeded { get { throw null; } } + public bool Equals(Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationWorkflowState 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.RecoveryServicesDataReplication.Models.DataReplicationWorkflowState left, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationWorkflowState right) { throw null; } + public static implicit operator Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationWorkflowState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationWorkflowState left, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationWorkflowState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class DeploymentPreflightModel + { + public DeploymentPreflightModel() { } + public System.Collections.Generic.IList Resources { get { throw null; } } + } + public partial class DeploymentPreflightResource + { + public DeploymentPreflightResource() { } + public string ApiVersion { get { throw null; } set { } } + public Azure.Core.ResourceType? DeploymentPreflightResourceType { get { throw null; } set { } } + public Azure.Core.AzureLocation? Location { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + } + public abstract partial class DraModelCustomProperties + { + protected DraModelCustomProperties() { } + } + public abstract partial class EventModelCustomProperties + { + protected EventModelCustomProperties() { } + } + public abstract partial class FabricModelCustomProperties + { + protected FabricModelCustomProperties() { } + } + public partial class FailoverProtectedItemProperties + { + internal FailoverProtectedItemProperties() { } + public string NetworkName { get { throw null; } } + public string ProtectedItemName { get { throw null; } } + public string RecoveryPointId { get { throw null; } } + public System.DateTimeOffset? RecoveryPointOn { get { throw null; } } + public string Subnet { get { throw null; } } + public string TestVmName { get { throw null; } } + public string VmName { get { throw null; } } + } + public partial class FailoverWorkflowModelCustomProperties : Azure.ResourceManager.RecoveryServicesDataReplication.Models.WorkflowModelCustomProperties + { + internal FailoverWorkflowModelCustomProperties() { } + public System.Collections.Generic.IReadOnlyList ProtectedItemDetails { get { throw null; } } + } + public partial class GeneralDraModelCustomProperties : Azure.ResourceManager.RecoveryServicesDataReplication.Models.DraModelCustomProperties + { + public GeneralDraModelCustomProperties() { } + } + public partial class GeneralFabricModelCustomProperties : Azure.ResourceManager.RecoveryServicesDataReplication.Models.FabricModelCustomProperties + { + public GeneralFabricModelCustomProperties() { } + } + public partial class GeneralPlannedFailoverModelCustomProperties : Azure.ResourceManager.RecoveryServicesDataReplication.Models.PlannedFailoverModelCustomProperties + { + public GeneralPlannedFailoverModelCustomProperties() { } + } + public partial class GeneralPolicyModelCustomProperties : Azure.ResourceManager.RecoveryServicesDataReplication.Models.PolicyModelCustomProperties + { + public GeneralPolicyModelCustomProperties() { } + } + public partial class GeneralProtectedItemModelCustomProperties : Azure.ResourceManager.RecoveryServicesDataReplication.Models.ProtectedItemModelCustomProperties + { + public GeneralProtectedItemModelCustomProperties() { } + } + public partial class GeneralReplicationExtensionModelCustomProperties : Azure.ResourceManager.RecoveryServicesDataReplication.Models.ReplicationExtensionModelCustomProperties + { + public GeneralReplicationExtensionModelCustomProperties() { } + } + public partial class HyperVMigrateFabricModelCustomProperties : Azure.ResourceManager.RecoveryServicesDataReplication.Models.FabricModelCustomProperties + { + public HyperVMigrateFabricModelCustomProperties(Azure.Core.ResourceIdentifier hyperVSiteId, Azure.Core.ResourceIdentifier migrationSolutionId) { } + public string FabricContainerId { get { throw null; } } + public Azure.Core.ResourceIdentifier FabricResourceId { get { throw null; } } + public Azure.Core.ResourceIdentifier HyperVSiteId { get { throw null; } set { } } + public System.Uri MigrationHubUri { get { throw null; } } + public Azure.Core.ResourceIdentifier MigrationSolutionId { get { throw null; } set { } } + } + public partial class HyperVToAzStackHciDiskInput + { + public HyperVToAzStackHciDiskInput(string diskId, long diskSizeGB, string diskFileFormat, bool isOSDisk) { } + public string DiskFileFormat { get { throw null; } set { } } + public string DiskId { get { throw null; } set { } } + public long DiskSizeGB { get { throw null; } set { } } + public bool? IsDynamic { get { throw null; } set { } } + public bool IsOSDisk { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier StorageContainerId { get { throw null; } set { } } + } + public partial class HyperVToAzStackHciEventModelCustomProperties : Azure.ResourceManager.RecoveryServicesDataReplication.Models.EventModelCustomProperties + { + internal HyperVToAzStackHciEventModelCustomProperties() { } + public string EventSourceFriendlyName { get { throw null; } } + public string ProtectedItemFriendlyName { get { throw null; } } + public string ServerType { get { throw null; } } + public string SourceApplianceName { get { throw null; } } + public string TargetApplianceName { get { throw null; } } + } + public partial class HyperVToAzStackHciNicInput + { + public HyperVToAzStackHciNicInput(string nicId, string targetNetworkId, string testNetworkId, Azure.ResourceManager.RecoveryServicesDataReplication.Models.VmNicSelection selectionTypeForFailover) { } + public string NetworkName { get { throw null; } } + public string NicId { get { throw null; } set { } } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.VmNicSelection SelectionTypeForFailover { get { throw null; } set { } } + public string TargetNetworkId { get { throw null; } set { } } + public string TestNetworkId { get { throw null; } set { } } + } + public partial class HyperVToAzStackHciPlannedFailoverModelCustomProperties : Azure.ResourceManager.RecoveryServicesDataReplication.Models.PlannedFailoverModelCustomProperties + { + public HyperVToAzStackHciPlannedFailoverModelCustomProperties(bool shutdownSourceVm) { } + public bool ShutdownSourceVm { get { throw null; } set { } } + } + public partial class HyperVToAzStackHciPolicyModelCustomProperties : Azure.ResourceManager.RecoveryServicesDataReplication.Models.PolicyModelCustomProperties + { + public HyperVToAzStackHciPolicyModelCustomProperties(int recoveryPointHistoryInMinutes, int crashConsistentFrequencyInMinutes, int appConsistentFrequencyInMinutes) { } + public int AppConsistentFrequencyInMinutes { get { throw null; } set { } } + public int CrashConsistentFrequencyInMinutes { get { throw null; } set { } } + public int RecoveryPointHistoryInMinutes { get { throw null; } set { } } + } + public partial class HyperVToAzStackHciProtectedDiskProperties + { + internal HyperVToAzStackHciProtectedDiskProperties() { } + public long? CapacityInBytes { get { throw null; } } + public string DiskType { get { throw null; } } + public bool? IsDynamic { get { throw null; } } + public bool? IsOSDisk { get { throw null; } } + public string MigrateDiskName { get { throw null; } } + public string SeedDiskName { get { throw null; } } + public string SourceDiskId { get { throw null; } } + public string SourceDiskName { get { throw null; } } + public Azure.Core.ResourceIdentifier StorageContainerId { get { throw null; } } + public string StorageContainerLocalPath { get { throw null; } } + public string TestMigrateDiskName { get { throw null; } } + } + public partial class HyperVToAzStackHciProtectedItemModelCustomProperties : Azure.ResourceManager.RecoveryServicesDataReplication.Models.ProtectedItemModelCustomProperties + { + public HyperVToAzStackHciProtectedItemModelCustomProperties(Azure.Core.ResourceIdentifier targetHciClusterId, Azure.Core.ResourceIdentifier targetArcClusterCustomLocationId, Azure.Core.ResourceIdentifier fabricDiscoveryMachineId, System.Collections.Generic.IEnumerable disksToInclude, System.Collections.Generic.IEnumerable nicsToInclude, Azure.Core.ResourceIdentifier targetResourceGroupId, Azure.Core.ResourceIdentifier storageContainerId, string hyperVGeneration, string runAsAccountId, string sourceDraName, string targetDraName, string customLocationRegion) { } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.ProtectedItemActiveLocation? ActiveLocation { get { throw null; } } + public string CustomLocationRegion { get { throw null; } set { } } + public System.Collections.Generic.IList DisksToInclude { get { throw null; } } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.ProtectedItemDynamicMemoryConfig DynamicMemoryConfig { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier FabricDiscoveryMachineId { get { throw null; } set { } } + public string FailoverRecoveryPointId { get { throw null; } } + public string FirmwareType { get { throw null; } } + public string HyperVGeneration { get { throw null; } set { } } + public int? InitialReplicationProgressPercentage { get { throw null; } } + public bool? IsDynamicRam { get { throw null; } set { } } + public string LastRecoveryPointId { get { throw null; } } + public System.DateTimeOffset? LastRecoveryPointReceived { get { throw null; } } + public System.DateTimeOffset? LastReplicationUpdateOn { get { throw null; } } + public System.Collections.Generic.IList NicsToInclude { get { throw null; } } + public string OSName { get { throw null; } } + public string OSType { get { throw null; } } + public System.Collections.Generic.IReadOnlyList ProtectedDisks { get { throw null; } } + public System.Collections.Generic.IReadOnlyList ProtectedNics { get { throw null; } } + public int? ResyncProgressPercentage { get { throw null; } } + public string RunAsAccountId { get { throw null; } set { } } + public string SourceApplianceName { get { throw null; } } + public int? SourceCpuCores { get { throw null; } } + public string SourceDraName { get { throw null; } set { } } + public double? SourceMemoryInMegaBytes { get { throw null; } } + public string SourceVmName { get { throw null; } } + public Azure.Core.ResourceIdentifier StorageContainerId { get { throw null; } set { } } + public string TargetApplianceName { get { throw null; } } + public Azure.Core.ResourceIdentifier TargetArcClusterCustomLocationId { get { throw null; } set { } } + public string TargetAzStackHciClusterName { get { throw null; } } + public int? TargetCpuCores { get { throw null; } set { } } + public string TargetDraName { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier TargetHciClusterId { get { throw null; } set { } } + public string TargetLocation { get { throw null; } } + public int? TargetMemoryInMegaBytes { get { throw null; } set { } } + public string TargetNetworkId { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier TargetResourceGroupId { get { throw null; } set { } } + public string TargetVmBiosId { get { throw null; } } + public string TargetVmName { get { throw null; } set { } } + public string TestNetworkId { get { throw null; } set { } } + } + public partial class HyperVToAzStackHciProtectedNicProperties + { + internal HyperVToAzStackHciProtectedNicProperties() { } + public string MacAddress { get { throw null; } } + public string NetworkName { get { throw null; } } + public string NicId { get { throw null; } } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.VmNicSelection? SelectionTypeForFailover { get { throw null; } } + public string TargetNetworkId { get { throw null; } } + public string TestNetworkId { get { throw null; } } + } + public partial class HyperVToAzStackHciRecoveryPointModelCustomProperties : Azure.ResourceManager.RecoveryServicesDataReplication.Models.RecoveryPointModelCustomProperties + { + internal HyperVToAzStackHciRecoveryPointModelCustomProperties() { } + public System.Collections.Generic.IReadOnlyList DiskIds { get { throw null; } } + } + public partial class HyperVToAzStackHciReplicationExtensionModelCustomProperties : Azure.ResourceManager.RecoveryServicesDataReplication.Models.ReplicationExtensionModelCustomProperties + { + public HyperVToAzStackHciReplicationExtensionModelCustomProperties(Azure.Core.ResourceIdentifier hyperVFabricArmId, Azure.Core.ResourceIdentifier azStackHciFabricArmId) { } + public System.Uri AsrServiceUri { get { throw null; } } + public Azure.Core.ResourceIdentifier AzStackHciFabricArmId { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier AzStackHciSiteId { get { throw null; } } + public System.Uri GatewayServiceUri { get { throw null; } } + public Azure.Core.ResourceIdentifier HyperVFabricArmId { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier HyperVSiteId { get { throw null; } } + public System.Uri RcmServiceUri { get { throw null; } } + public string ResourceGroup { get { throw null; } } + public string ResourceLocation { get { throw null; } } + public string SourceGatewayServiceId { get { throw null; } } + public string SourceStorageContainerName { get { throw null; } } + public string StorageAccountId { get { throw null; } set { } } + public string StorageAccountSasSecretName { get { throw null; } set { } } + public string SubscriptionId { get { throw null; } } + public string TargetGatewayServiceId { get { throw null; } } + public string TargetStorageContainerName { get { throw null; } } + } + public partial class PlannedFailoverModel + { + public PlannedFailoverModel(Azure.ResourceManager.RecoveryServicesDataReplication.Models.PlannedFailoverModelProperties properties) { } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.PlannedFailoverModelCustomProperties PlannedFailoverModelCustomProperties { get { throw null; } set { } } + } + public abstract partial class PlannedFailoverModelCustomProperties + { + protected PlannedFailoverModelCustomProperties() { } + } + public partial class PlannedFailoverModelProperties + { + public PlannedFailoverModelProperties(Azure.ResourceManager.RecoveryServicesDataReplication.Models.PlannedFailoverModelCustomProperties customProperties) { } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.PlannedFailoverModelCustomProperties CustomProperties { get { throw null; } set { } } + } + public abstract partial class PolicyModelCustomProperties + { + protected PolicyModelCustomProperties() { } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ProtectedItemActiveLocation : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ProtectedItemActiveLocation(string value) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.ProtectedItemActiveLocation Primary { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.ProtectedItemActiveLocation Recovery { get { throw null; } } + public bool Equals(Azure.ResourceManager.RecoveryServicesDataReplication.Models.ProtectedItemActiveLocation 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.RecoveryServicesDataReplication.Models.ProtectedItemActiveLocation left, Azure.ResourceManager.RecoveryServicesDataReplication.Models.ProtectedItemActiveLocation right) { throw null; } + public static implicit operator Azure.ResourceManager.RecoveryServicesDataReplication.Models.ProtectedItemActiveLocation (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.RecoveryServicesDataReplication.Models.ProtectedItemActiveLocation left, Azure.ResourceManager.RecoveryServicesDataReplication.Models.ProtectedItemActiveLocation right) { throw null; } + public override string ToString() { throw null; } + } + public partial class ProtectedItemDynamicMemoryConfig + { + public ProtectedItemDynamicMemoryConfig(long maximumMemoryInMegaBytes, long minimumMemoryInMegaBytes, int targetMemoryBufferPercentage) { } + public long MaximumMemoryInMegaBytes { get { throw null; } set { } } + public long MinimumMemoryInMegaBytes { get { throw null; } set { } } + public int TargetMemoryBufferPercentage { get { throw null; } set { } } + } + public partial class ProtectedItemJobProperties + { + internal ProtectedItemJobProperties() { } + public string DisplayName { get { throw null; } } + public System.DateTimeOffset? EndOn { get { throw null; } } + public string Id { get { throw null; } } + public string Name { get { throw null; } } + public string ScenarioName { get { throw null; } } + public System.DateTimeOffset? StartOn { get { throw null; } } + public string State { get { throw null; } } + } + public abstract partial class ProtectedItemModelCustomProperties + { + protected ProtectedItemModelCustomProperties() { } + } + public abstract partial class RecoveryPointModelCustomProperties + { + protected RecoveryPointModelCustomProperties() { } + } + public abstract partial class ReplicationExtensionModelCustomProperties + { + protected ReplicationExtensionModelCustomProperties() { } + } + public partial class StorageContainerProperties + { + public StorageContainerProperties(string name, string clusterSharedVolumePath) { } + public string ClusterSharedVolumePath { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + } + public partial class TestFailoverCleanupWorkflowModelCustomProperties : Azure.ResourceManager.RecoveryServicesDataReplication.Models.WorkflowModelCustomProperties + { + internal TestFailoverCleanupWorkflowModelCustomProperties() { } + public string Comments { get { throw null; } } + } + public partial class TestFailoverWorkflowModelCustomProperties : Azure.ResourceManager.RecoveryServicesDataReplication.Models.WorkflowModelCustomProperties + { + internal TestFailoverWorkflowModelCustomProperties() { } + public System.Collections.Generic.IReadOnlyList ProtectedItemDetails { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct VmNicSelection : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public VmNicSelection(string value) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.VmNicSelection NotSelected { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.VmNicSelection SelectedByDefault { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.VmNicSelection SelectedByUser { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.VmNicSelection SelectedByUserOverride { get { throw null; } } + public bool Equals(Azure.ResourceManager.RecoveryServicesDataReplication.Models.VmNicSelection 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.RecoveryServicesDataReplication.Models.VmNicSelection left, Azure.ResourceManager.RecoveryServicesDataReplication.Models.VmNicSelection right) { throw null; } + public static implicit operator Azure.ResourceManager.RecoveryServicesDataReplication.Models.VmNicSelection (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.RecoveryServicesDataReplication.Models.VmNicSelection left, Azure.ResourceManager.RecoveryServicesDataReplication.Models.VmNicSelection right) { throw null; } + public override string ToString() { throw null; } + } + public partial class VMwareDraModelCustomProperties : Azure.ResourceManager.RecoveryServicesDataReplication.Models.DraModelCustomProperties + { + public VMwareDraModelCustomProperties(string biosId, Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationIdentity marsAuthenticationIdentity) { } + public string BiosId { get { throw null; } set { } } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.DataReplicationIdentity MarsAuthenticationIdentity { get { throw null; } set { } } + } + public partial class VMwareMigrateFabricModelCustomProperties : Azure.ResourceManager.RecoveryServicesDataReplication.Models.FabricModelCustomProperties + { + public VMwareMigrateFabricModelCustomProperties(Azure.Core.ResourceIdentifier vMwareSiteId, Azure.Core.ResourceIdentifier migrationSolutionId) { } + public Azure.Core.ResourceIdentifier MigrationSolutionId { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier VMwareSiteId { get { throw null; } set { } } + } + public partial class VMwareToAzStackHciDiskInput + { + public VMwareToAzStackHciDiskInput(string diskId, long diskSizeGB, string diskFileFormat, bool isOSDisk) { } + public string DiskFileFormat { get { throw null; } set { } } + public string DiskId { get { throw null; } set { } } + public long DiskSizeGB { get { throw null; } set { } } + public bool? IsDynamic { get { throw null; } set { } } + public bool IsOSDisk { get { throw null; } set { } } + public string StorageContainerId { get { throw null; } set { } } + } + public partial class VMwareToAzStackHciNicInput + { + public VMwareToAzStackHciNicInput(string nicId, string label, string targetNetworkId, string testNetworkId, Azure.ResourceManager.RecoveryServicesDataReplication.Models.VmNicSelection selectionTypeForFailover) { } + public string Label { get { throw null; } set { } } + public string NetworkName { get { throw null; } } + public string NicId { get { throw null; } set { } } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.VmNicSelection SelectionTypeForFailover { get { throw null; } set { } } + public string TargetNetworkId { get { throw null; } set { } } + public string TestNetworkId { get { throw null; } set { } } + } + public partial class VMwareToAzStackHciPlannedFailoverModelCustomProperties : Azure.ResourceManager.RecoveryServicesDataReplication.Models.PlannedFailoverModelCustomProperties + { + public VMwareToAzStackHciPlannedFailoverModelCustomProperties(bool shutdownSourceVm) { } + public bool ShutdownSourceVm { get { throw null; } set { } } + } + public partial class VMwareToAzStackHciPolicyModelCustomProperties : Azure.ResourceManager.RecoveryServicesDataReplication.Models.PolicyModelCustomProperties + { + public VMwareToAzStackHciPolicyModelCustomProperties(int recoveryPointHistoryInMinutes, int crashConsistentFrequencyInMinutes, int appConsistentFrequencyInMinutes) { } + public int AppConsistentFrequencyInMinutes { get { throw null; } set { } } + public int CrashConsistentFrequencyInMinutes { get { throw null; } set { } } + public int RecoveryPointHistoryInMinutes { get { throw null; } set { } } + } + public partial class VMwareToAzStackHciProtectedDiskProperties + { + internal VMwareToAzStackHciProtectedDiskProperties() { } + public long? CapacityInBytes { get { throw null; } } + public string DiskType { get { throw null; } } + public bool? IsDynamic { get { throw null; } } + public bool? IsOSDisk { get { throw null; } } + public string MigrateDiskName { get { throw null; } } + public string SeedDiskName { get { throw null; } } + public string SourceDiskId { get { throw null; } } + public string SourceDiskName { get { throw null; } } + public Azure.Core.ResourceIdentifier StorageContainerId { get { throw null; } } + public string StorageContainerLocalPath { get { throw null; } } + public string TestMigrateDiskName { get { throw null; } } + } + public partial class VMwareToAzStackHciProtectedItemModelCustomProperties : Azure.ResourceManager.RecoveryServicesDataReplication.Models.ProtectedItemModelCustomProperties + { + public VMwareToAzStackHciProtectedItemModelCustomProperties(Azure.Core.ResourceIdentifier targetHciClusterId, Azure.Core.ResourceIdentifier targetArcClusterCustomLocationId, Azure.Core.ResourceIdentifier storageContainerId, Azure.Core.ResourceIdentifier targetResourceGroupId, string customLocationRegion, System.Collections.Generic.IEnumerable disksToInclude, System.Collections.Generic.IEnumerable nicsToInclude, string hyperVGeneration, Azure.Core.ResourceIdentifier fabricDiscoveryMachineId, string runAsAccountId, string sourceDraName, string targetDraName) { } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.ProtectedItemActiveLocation? ActiveLocation { get { throw null; } } + public string CustomLocationRegion { get { throw null; } set { } } + public System.Collections.Generic.IList DisksToInclude { get { throw null; } } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.ProtectedItemDynamicMemoryConfig DynamicMemoryConfig { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier FabricDiscoveryMachineId { get { throw null; } set { } } + public string FailoverRecoveryPointId { get { throw null; } } + public string FirmwareType { get { throw null; } } + public string HyperVGeneration { get { throw null; } set { } } + public int? InitialReplicationProgressPercentage { get { throw null; } } + public bool? IsDynamicRam { get { throw null; } set { } } + public string LastRecoveryPointId { get { throw null; } } + public System.DateTimeOffset? LastRecoveryPointReceived { get { throw null; } } + public System.DateTimeOffset? LastReplicationUpdateOn { get { throw null; } } + public int? MigrationProgressPercentage { get { throw null; } } + public System.Collections.Generic.IList NicsToInclude { get { throw null; } } + public string OSName { get { throw null; } } + public string OSType { get { throw null; } } + public bool? PerformAutoResync { get { throw null; } set { } } + public System.Collections.Generic.IReadOnlyList ProtectedDisks { get { throw null; } } + public System.Collections.Generic.IReadOnlyList ProtectedNics { get { throw null; } } + public int? ResumeProgressPercentage { get { throw null; } } + public long? ResumeRetryCount { get { throw null; } } + public int? ResyncProgressPercentage { get { throw null; } } + public bool? ResyncRequired { get { throw null; } } + public long? ResyncRetryCount { get { throw null; } } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.VMwareToAzureMigrateResyncState? ResyncState { get { throw null; } } + public string RunAsAccountId { get { throw null; } set { } } + public string SourceApplianceName { get { throw null; } } + public int? SourceCpuCores { get { throw null; } } + public string SourceDraName { get { throw null; } set { } } + public double? SourceMemoryInMegaBytes { get { throw null; } } + public string SourceVmName { get { throw null; } } + public Azure.Core.ResourceIdentifier StorageContainerId { get { throw null; } set { } } + public string TargetApplianceName { get { throw null; } } + public Azure.Core.ResourceIdentifier TargetArcClusterCustomLocationId { get { throw null; } set { } } + public string TargetAzStackHciClusterName { get { throw null; } } + public int? TargetCpuCores { get { throw null; } set { } } + public string TargetDraName { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier TargetHciClusterId { get { throw null; } set { } } + public string TargetLocation { get { throw null; } } + public int? TargetMemoryInMegaBytes { get { throw null; } set { } } + public string TargetNetworkId { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier TargetResourceGroupId { get { throw null; } set { } } + public string TargetVmBiosId { get { throw null; } } + public string TargetVmName { get { throw null; } set { } } + public string TestNetworkId { get { throw null; } set { } } + } + public partial class VMwareToAzStackHciProtectedNicProperties + { + internal VMwareToAzStackHciProtectedNicProperties() { } + public bool? IsPrimaryNic { get { throw null; } } + public string Label { get { throw null; } } + public string MacAddress { get { throw null; } } + public string NetworkName { get { throw null; } } + public string NicId { get { throw null; } } + public Azure.ResourceManager.RecoveryServicesDataReplication.Models.VmNicSelection? SelectionTypeForFailover { get { throw null; } } + public string TargetNetworkId { get { throw null; } } + public string TestNetworkId { get { throw null; } } + } + public partial class VMwareToAzStackHciReplicationExtensionModelCustomProperties : Azure.ResourceManager.RecoveryServicesDataReplication.Models.ReplicationExtensionModelCustomProperties + { + public VMwareToAzStackHciReplicationExtensionModelCustomProperties(Azure.Core.ResourceIdentifier vmwareFabricArmId, Azure.Core.ResourceIdentifier azStackHciFabricArmId) { } + public System.Uri AsrServiceUri { get { throw null; } } + public Azure.Core.ResourceIdentifier AzStackHciFabricArmId { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier AzStackHciSiteId { get { throw null; } } + public System.Uri GatewayServiceUri { get { throw null; } } + public System.Uri RcmServiceUri { get { throw null; } } + public string ResourceGroup { get { throw null; } } + public string ResourceLocation { get { throw null; } } + public string SourceGatewayServiceId { get { throw null; } } + public string SourceStorageContainerName { get { throw null; } } + public Azure.Core.ResourceIdentifier StorageAccountId { get { throw null; } set { } } + public string StorageAccountSasSecretName { get { throw null; } set { } } + public string SubscriptionId { get { throw null; } } + public string TargetGatewayServiceId { get { throw null; } } + public string TargetStorageContainerName { get { throw null; } } + public Azure.Core.ResourceIdentifier VmwareFabricArmId { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier VmwareSiteId { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct VMwareToAzureMigrateResyncState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public VMwareToAzureMigrateResyncState(string value) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.VMwareToAzureMigrateResyncState None { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.VMwareToAzureMigrateResyncState PreparedForResynchronization { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.VMwareToAzureMigrateResyncState StartedResynchronization { get { throw null; } } + public bool Equals(Azure.ResourceManager.RecoveryServicesDataReplication.Models.VMwareToAzureMigrateResyncState 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.RecoveryServicesDataReplication.Models.VMwareToAzureMigrateResyncState left, Azure.ResourceManager.RecoveryServicesDataReplication.Models.VMwareToAzureMigrateResyncState right) { throw null; } + public static implicit operator Azure.ResourceManager.RecoveryServicesDataReplication.Models.VMwareToAzureMigrateResyncState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.RecoveryServicesDataReplication.Models.VMwareToAzureMigrateResyncState left, Azure.ResourceManager.RecoveryServicesDataReplication.Models.VMwareToAzureMigrateResyncState right) { throw null; } + public override string ToString() { throw null; } + } + public abstract partial class WorkflowModelCustomProperties + { + protected WorkflowModelCustomProperties() { } + public System.Collections.Generic.IReadOnlyDictionary AffectedObjectDetails { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct WorkflowObjectType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public WorkflowObjectType(string value) { throw null; } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.WorkflowObjectType AvsDiskPool { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.WorkflowObjectType Dra { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.WorkflowObjectType Fabric { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.WorkflowObjectType Policy { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.WorkflowObjectType ProtectedItem { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.WorkflowObjectType RecoveryPlan { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.WorkflowObjectType ReplicationExtension { get { throw null; } } + public static Azure.ResourceManager.RecoveryServicesDataReplication.Models.WorkflowObjectType Vault { get { throw null; } } + public bool Equals(Azure.ResourceManager.RecoveryServicesDataReplication.Models.WorkflowObjectType 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.RecoveryServicesDataReplication.Models.WorkflowObjectType left, Azure.ResourceManager.RecoveryServicesDataReplication.Models.WorkflowObjectType right) { throw null; } + public static implicit operator Azure.ResourceManager.RecoveryServicesDataReplication.Models.WorkflowObjectType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.RecoveryServicesDataReplication.Models.WorkflowObjectType left, Azure.ResourceManager.RecoveryServicesDataReplication.Models.WorkflowObjectType right) { throw null; } + public override string ToString() { throw null; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/assets.json b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/assets.json new file mode 100644 index 000000000000..e72f176676f3 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/assets.json @@ -0,0 +1,6 @@ +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "net", + "TagPrefix": "net//Azure.ResourceManager.RecoveryServicesDataReplication", + "Tag": "" +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Azure.ResourceManager.RecoveryServicesDataReplication.Samples.csproj b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Azure.ResourceManager.RecoveryServicesDataReplication.Samples.csproj new file mode 100644 index 000000000000..c240fb83a566 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Azure.ResourceManager.RecoveryServicesDataReplication.Samples.csproj @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationDraCollection.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationDraCollection.cs new file mode 100644 index 000000000000..89f55c41adb8 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationDraCollection.cs @@ -0,0 +1,161 @@ +// 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.RecoveryServicesDataReplication; +using Azure.ResourceManager.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Samples +{ + public partial class Sample_DataReplicationDraCollection + { + // Dra_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_DraGet() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Dra_Get.json + // this example is just showing the usage of "Dra_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 DataReplicationFabricResource created on azure + // for more information of creating DataReplicationFabricResource, please refer to the document of DataReplicationFabricResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string fabricName = "wPR"; + ResourceIdentifier dataReplicationFabricResourceId = DataReplicationFabricResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fabricName); + DataReplicationFabricResource dataReplicationFabric = client.GetDataReplicationFabricResource(dataReplicationFabricResourceId); + + // get the collection of this DataReplicationDraResource + DataReplicationDraCollection collection = dataReplicationFabric.GetDataReplicationDras(); + + // invoke the operation + string fabricAgentName = "M"; + DataReplicationDraResource result = await collection.GetAsync(fabricAgentName); + + // 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 + DataReplicationDraData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Dra_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_DraGet() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Dra_Get.json + // this example is just showing the usage of "Dra_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 DataReplicationFabricResource created on azure + // for more information of creating DataReplicationFabricResource, please refer to the document of DataReplicationFabricResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string fabricName = "wPR"; + ResourceIdentifier dataReplicationFabricResourceId = DataReplicationFabricResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fabricName); + DataReplicationFabricResource dataReplicationFabric = client.GetDataReplicationFabricResource(dataReplicationFabricResourceId); + + // get the collection of this DataReplicationDraResource + DataReplicationDraCollection collection = dataReplicationFabric.GetDataReplicationDras(); + + // invoke the operation + string fabricAgentName = "M"; + bool result = await collection.ExistsAsync(fabricAgentName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Dra_Create + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_DraCreate() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Dra_Create.json + // this example is just showing the usage of "Dra_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 DataReplicationFabricResource created on azure + // for more information of creating DataReplicationFabricResource, please refer to the document of DataReplicationFabricResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string fabricName = "wPR"; + ResourceIdentifier dataReplicationFabricResourceId = DataReplicationFabricResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fabricName); + DataReplicationFabricResource dataReplicationFabric = client.GetDataReplicationFabricResource(dataReplicationFabricResourceId); + + // get the collection of this DataReplicationDraResource + DataReplicationDraCollection collection = dataReplicationFabric.GetDataReplicationDras(); + + // invoke the operation + string fabricAgentName = "M"; + DataReplicationDraData data = new DataReplicationDraData(new DataReplicationDraProperties("envzcoijbqhtrpncbjbhk", "y", new DataReplicationIdentity(Guid.Parse("joclkkdovixwapephhxaqtefubhhmq"), "cwktzrwajuvfyyymfstpey", "khsiaqfbpuhp", "dkjobanyqgzenivyxhvavottpc", "bubwwbowfhdmujrt"), new DataReplicationIdentity(Guid.Parse("joclkkdovixwapephhxaqtefubhhmq"), "cwktzrwajuvfyyymfstpey", "khsiaqfbpuhp", "dkjobanyqgzenivyxhvavottpc", "bubwwbowfhdmujrt"), new GeneralDraModelCustomProperties())); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, fabricAgentName, data); + DataReplicationDraResource 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 + DataReplicationDraData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Dra_List + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_DraList() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Dra_List.json + // this example is just showing the usage of "Dra_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DataReplicationFabricResource created on azure + // for more information of creating DataReplicationFabricResource, please refer to the document of DataReplicationFabricResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string fabricName = "wPR"; + ResourceIdentifier dataReplicationFabricResourceId = DataReplicationFabricResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fabricName); + DataReplicationFabricResource dataReplicationFabric = client.GetDataReplicationFabricResource(dataReplicationFabricResourceId); + + // get the collection of this DataReplicationDraResource + DataReplicationDraCollection collection = dataReplicationFabric.GetDataReplicationDras(); + + // invoke the operation and iterate over the result + await foreach (DataReplicationDraResource 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 + DataReplicationDraData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationDraResource.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationDraResource.cs new file mode 100644 index 000000000000..3ca6dba8bb8e --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationDraResource.cs @@ -0,0 +1,115 @@ +// 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.RecoveryServicesDataReplication; +using Azure.ResourceManager.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Samples +{ + public partial class Sample_DataReplicationDraResource + { + // Dra_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_DraGet() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Dra_Get.json + // this example is just showing the usage of "Dra_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 DataReplicationDraResource created on azure + // for more information of creating DataReplicationDraResource, please refer to the document of DataReplicationDraResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string fabricName = "wPR"; + string fabricAgentName = "M"; + ResourceIdentifier dataReplicationDraResourceId = DataReplicationDraResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fabricName, fabricAgentName); + DataReplicationDraResource dataReplicationDra = client.GetDataReplicationDraResource(dataReplicationDraResourceId); + + // invoke the operation + DataReplicationDraResource result = await dataReplicationDra.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 + DataReplicationDraData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Dra_Create + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_DraCreate() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Dra_Create.json + // this example is just showing the usage of "Dra_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 DataReplicationDraResource created on azure + // for more information of creating DataReplicationDraResource, please refer to the document of DataReplicationDraResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string fabricName = "wPR"; + string fabricAgentName = "M"; + ResourceIdentifier dataReplicationDraResourceId = DataReplicationDraResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fabricName, fabricAgentName); + DataReplicationDraResource dataReplicationDra = client.GetDataReplicationDraResource(dataReplicationDraResourceId); + + // invoke the operation + DataReplicationDraData data = new DataReplicationDraData(new DataReplicationDraProperties("envzcoijbqhtrpncbjbhk", "y", new DataReplicationIdentity(Guid.Parse("joclkkdovixwapephhxaqtefubhhmq"), "cwktzrwajuvfyyymfstpey", "khsiaqfbpuhp", "dkjobanyqgzenivyxhvavottpc", "bubwwbowfhdmujrt"), new DataReplicationIdentity(Guid.Parse("joclkkdovixwapephhxaqtefubhhmq"), "cwktzrwajuvfyyymfstpey", "khsiaqfbpuhp", "dkjobanyqgzenivyxhvavottpc", "bubwwbowfhdmujrt"), new GeneralDraModelCustomProperties())); + ArmOperation lro = await dataReplicationDra.UpdateAsync(WaitUntil.Completed, data); + DataReplicationDraResource 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 + DataReplicationDraData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Dra_Delete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DraDelete() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Dra_Delete.json + // this example is just showing the usage of "Dra_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 DataReplicationDraResource created on azure + // for more information of creating DataReplicationDraResource, please refer to the document of DataReplicationDraResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string fabricName = "wPR"; + string fabricAgentName = "M"; + ResourceIdentifier dataReplicationDraResourceId = DataReplicationDraResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fabricName, fabricAgentName); + DataReplicationDraResource dataReplicationDra = client.GetDataReplicationDraResource(dataReplicationDraResourceId); + + // invoke the operation + await dataReplicationDra.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationEmailConfigurationCollection.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationEmailConfigurationCollection.cs new file mode 100644 index 000000000000..164bda8248af --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationEmailConfigurationCollection.cs @@ -0,0 +1,168 @@ +// 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.RecoveryServicesDataReplication; +using Azure.ResourceManager.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Samples +{ + public partial class Sample_DataReplicationEmailConfigurationCollection + { + // EmailConfiguration_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_EmailConfigurationGet() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/EmailConfiguration_Get.json + // this example is just showing the usage of "EmailConfiguration_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 DataReplicationVaultResource created on azure + // for more information of creating DataReplicationVaultResource, please refer to the document of DataReplicationVaultResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + ResourceIdentifier dataReplicationVaultResourceId = DataReplicationVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName); + DataReplicationVaultResource dataReplicationVault = client.GetDataReplicationVaultResource(dataReplicationVaultResourceId); + + // get the collection of this DataReplicationEmailConfigurationResource + DataReplicationEmailConfigurationCollection collection = dataReplicationVault.GetDataReplicationEmailConfigurations(); + + // invoke the operation + string emailConfigurationName = "0"; + DataReplicationEmailConfigurationResource result = await collection.GetAsync(emailConfigurationName); + + // 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 + DataReplicationEmailConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // EmailConfiguration_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_EmailConfigurationGet() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/EmailConfiguration_Get.json + // this example is just showing the usage of "EmailConfiguration_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 DataReplicationVaultResource created on azure + // for more information of creating DataReplicationVaultResource, please refer to the document of DataReplicationVaultResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + ResourceIdentifier dataReplicationVaultResourceId = DataReplicationVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName); + DataReplicationVaultResource dataReplicationVault = client.GetDataReplicationVaultResource(dataReplicationVaultResourceId); + + // get the collection of this DataReplicationEmailConfigurationResource + DataReplicationEmailConfigurationCollection collection = dataReplicationVault.GetDataReplicationEmailConfigurations(); + + // invoke the operation + string emailConfigurationName = "0"; + bool result = await collection.ExistsAsync(emailConfigurationName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // EmailConfiguration_Create + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_EmailConfigurationCreate() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/EmailConfiguration_Create.json + // this example is just showing the usage of "EmailConfiguration_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 DataReplicationVaultResource created on azure + // for more information of creating DataReplicationVaultResource, please refer to the document of DataReplicationVaultResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + ResourceIdentifier dataReplicationVaultResourceId = DataReplicationVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName); + DataReplicationVaultResource dataReplicationVault = client.GetDataReplicationVaultResource(dataReplicationVaultResourceId); + + // get the collection of this DataReplicationEmailConfigurationResource + DataReplicationEmailConfigurationCollection collection = dataReplicationVault.GetDataReplicationEmailConfigurations(); + + // invoke the operation + string emailConfigurationName = "0"; + DataReplicationEmailConfigurationData data = new DataReplicationEmailConfigurationData(new DataReplicationEmailConfigurationProperties(true) + { + CustomEmailAddresses = +{ +"ketvbducyailcny" +}, + Locale = "vpnjxjvdqtebnucyxiyrjiko", + }); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, emailConfigurationName, data); + DataReplicationEmailConfigurationResource 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 + DataReplicationEmailConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // EmailConfiguration_List + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_EmailConfigurationList() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/EmailConfiguration_List.json + // this example is just showing the usage of "EmailConfiguration_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DataReplicationVaultResource created on azure + // for more information of creating DataReplicationVaultResource, please refer to the document of DataReplicationVaultResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + ResourceIdentifier dataReplicationVaultResourceId = DataReplicationVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName); + DataReplicationVaultResource dataReplicationVault = client.GetDataReplicationVaultResource(dataReplicationVaultResourceId); + + // get the collection of this DataReplicationEmailConfigurationResource + DataReplicationEmailConfigurationCollection collection = dataReplicationVault.GetDataReplicationEmailConfigurations(); + + // invoke the operation and iterate over the result + await foreach (DataReplicationEmailConfigurationResource 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 + DataReplicationEmailConfigurationData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationEmailConfigurationResource.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationEmailConfigurationResource.cs new file mode 100644 index 000000000000..0bdacff35dc0 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationEmailConfigurationResource.cs @@ -0,0 +1,94 @@ +// 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.RecoveryServicesDataReplication; +using Azure.ResourceManager.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Samples +{ + public partial class Sample_DataReplicationEmailConfigurationResource + { + // EmailConfiguration_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_EmailConfigurationGet() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/EmailConfiguration_Get.json + // this example is just showing the usage of "EmailConfiguration_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 DataReplicationEmailConfigurationResource created on azure + // for more information of creating DataReplicationEmailConfigurationResource, please refer to the document of DataReplicationEmailConfigurationResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + string emailConfigurationName = "0"; + ResourceIdentifier dataReplicationEmailConfigurationResourceId = DataReplicationEmailConfigurationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName, emailConfigurationName); + DataReplicationEmailConfigurationResource dataReplicationEmailConfiguration = client.GetDataReplicationEmailConfigurationResource(dataReplicationEmailConfigurationResourceId); + + // invoke the operation + DataReplicationEmailConfigurationResource result = await dataReplicationEmailConfiguration.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 + DataReplicationEmailConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // EmailConfiguration_Create + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_EmailConfigurationCreate() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/EmailConfiguration_Create.json + // this example is just showing the usage of "EmailConfiguration_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 DataReplicationEmailConfigurationResource created on azure + // for more information of creating DataReplicationEmailConfigurationResource, please refer to the document of DataReplicationEmailConfigurationResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + string emailConfigurationName = "0"; + ResourceIdentifier dataReplicationEmailConfigurationResourceId = DataReplicationEmailConfigurationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName, emailConfigurationName); + DataReplicationEmailConfigurationResource dataReplicationEmailConfiguration = client.GetDataReplicationEmailConfigurationResource(dataReplicationEmailConfigurationResourceId); + + // invoke the operation + DataReplicationEmailConfigurationData data = new DataReplicationEmailConfigurationData(new DataReplicationEmailConfigurationProperties(true) + { + CustomEmailAddresses = +{ +"ketvbducyailcny" +}, + Locale = "vpnjxjvdqtebnucyxiyrjiko", + }); + ArmOperation lro = await dataReplicationEmailConfiguration.UpdateAsync(WaitUntil.Completed, data); + DataReplicationEmailConfigurationResource 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 + DataReplicationEmailConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationEventCollection.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationEventCollection.cs new file mode 100644 index 000000000000..a42f2008f13b --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationEventCollection.cs @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.RecoveryServicesDataReplication; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Samples +{ + public partial class Sample_DataReplicationEventCollection + { + // Event_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_EventGet() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Event_Get.json + // this example is just showing the usage of "Event_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 DataReplicationVaultResource created on azure + // for more information of creating DataReplicationVaultResource, please refer to the document of DataReplicationVaultResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + ResourceIdentifier dataReplicationVaultResourceId = DataReplicationVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName); + DataReplicationVaultResource dataReplicationVault = client.GetDataReplicationVaultResource(dataReplicationVaultResourceId); + + // get the collection of this DataReplicationEventResource + DataReplicationEventCollection collection = dataReplicationVault.GetDataReplicationEvents(); + + // invoke the operation + string eventName = "231CIG"; + DataReplicationEventResource result = await collection.GetAsync(eventName); + + // 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 + DataReplicationEventData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Event_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_EventGet() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Event_Get.json + // this example is just showing the usage of "Event_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 DataReplicationVaultResource created on azure + // for more information of creating DataReplicationVaultResource, please refer to the document of DataReplicationVaultResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + ResourceIdentifier dataReplicationVaultResourceId = DataReplicationVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName); + DataReplicationVaultResource dataReplicationVault = client.GetDataReplicationVaultResource(dataReplicationVaultResourceId); + + // get the collection of this DataReplicationEventResource + DataReplicationEventCollection collection = dataReplicationVault.GetDataReplicationEvents(); + + // invoke the operation + string eventName = "231CIG"; + bool result = await collection.ExistsAsync(eventName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Event_List + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_EventList() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Event_List.json + // this example is just showing the usage of "Event_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DataReplicationVaultResource created on azure + // for more information of creating DataReplicationVaultResource, please refer to the document of DataReplicationVaultResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + ResourceIdentifier dataReplicationVaultResourceId = DataReplicationVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName); + DataReplicationVaultResource dataReplicationVault = client.GetDataReplicationVaultResource(dataReplicationVaultResourceId); + + // get the collection of this DataReplicationEventResource + DataReplicationEventCollection collection = dataReplicationVault.GetDataReplicationEvents(); + + // invoke the operation and iterate over the result + string filter = "wbglupjzvkirtgnnyasxom"; + string continuationToken = "cxtufi"; + await foreach (DataReplicationEventResource item in collection.GetAllAsync(filter: filter, continuationToken: continuationToken)) + { + // 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 + DataReplicationEventData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationEventResource.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationEventResource.cs new file mode 100644 index 000000000000..025c55e39321 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationEventResource.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.RecoveryServicesDataReplication; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Samples +{ + public partial class Sample_DataReplicationEventResource + { + // Event_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_EventGet() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Event_Get.json + // this example is just showing the usage of "Event_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 DataReplicationEventResource created on azure + // for more information of creating DataReplicationEventResource, please refer to the document of DataReplicationEventResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + string eventName = "231CIG"; + ResourceIdentifier dataReplicationEventResourceId = DataReplicationEventResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName, eventName); + DataReplicationEventResource dataReplicationEvent = client.GetDataReplicationEventResource(dataReplicationEventResourceId); + + // invoke the operation + DataReplicationEventResource result = await dataReplicationEvent.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 + DataReplicationEventData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationFabricCollection.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationFabricCollection.cs new file mode 100644 index 000000000000..3718a03ff387 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationFabricCollection.cs @@ -0,0 +1,165 @@ +// 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.RecoveryServicesDataReplication; +using Azure.ResourceManager.RecoveryServicesDataReplication.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Samples +{ + public partial class Sample_DataReplicationFabricCollection + { + // Fabric_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_FabricGet() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Fabric_Get.json + // this example is just showing the usage of "Fabric_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 = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DataReplicationFabricResource + DataReplicationFabricCollection collection = resourceGroupResource.GetDataReplicationFabrics(); + + // invoke the operation + string fabricName = "wPR"; + DataReplicationFabricResource result = await collection.GetAsync(fabricName); + + // 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 + DataReplicationFabricData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Fabric_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_FabricGet() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Fabric_Get.json + // this example is just showing the usage of "Fabric_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 = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DataReplicationFabricResource + DataReplicationFabricCollection collection = resourceGroupResource.GetDataReplicationFabrics(); + + // invoke the operation + string fabricName = "wPR"; + bool result = await collection.ExistsAsync(fabricName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Fabric_Create + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_FabricCreate() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Fabric_Create.json + // this example is just showing the usage of "Fabric_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 ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DataReplicationFabricResource + DataReplicationFabricCollection collection = resourceGroupResource.GetDataReplicationFabrics(); + + // invoke the operation + string fabricName = "wPR"; + DataReplicationFabricData data = new DataReplicationFabricData(new AzureLocation("tqygutlpob"), new DataReplicationFabricProperties(new GeneralFabricModelCustomProperties())) + { + Tags = +{ +["key3917"] = "vgralu", +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, fabricName, data); + DataReplicationFabricResource 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 + DataReplicationFabricData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Fabric_List + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_FabricList() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Fabric_List.json + // this example is just showing the usage of "Fabric_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DataReplicationFabricResource + DataReplicationFabricCollection collection = resourceGroupResource.GetDataReplicationFabrics(); + + // invoke the operation and iterate over the result + string continuationToken = "mjzsxwwmtvd"; + await foreach (DataReplicationFabricResource item in collection.GetAllAsync(continuationToken: continuationToken)) + { + // 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 + DataReplicationFabricData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationFabricResource.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationFabricResource.cs new file mode 100644 index 000000000000..aaca95b23b19 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationFabricResource.cs @@ -0,0 +1,153 @@ +// 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.RecoveryServicesDataReplication; +using Azure.ResourceManager.RecoveryServicesDataReplication.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Samples +{ + public partial class Sample_DataReplicationFabricResource + { + // Fabric_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_FabricGet() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Fabric_Get.json + // this example is just showing the usage of "Fabric_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 DataReplicationFabricResource created on azure + // for more information of creating DataReplicationFabricResource, please refer to the document of DataReplicationFabricResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string fabricName = "wPR"; + ResourceIdentifier dataReplicationFabricResourceId = DataReplicationFabricResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fabricName); + DataReplicationFabricResource dataReplicationFabric = client.GetDataReplicationFabricResource(dataReplicationFabricResourceId); + + // invoke the operation + DataReplicationFabricResource result = await dataReplicationFabric.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 + DataReplicationFabricData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Fabric_Update + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_FabricUpdate() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Fabric_Update.json + // this example is just showing the usage of "Fabric_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 DataReplicationFabricResource created on azure + // for more information of creating DataReplicationFabricResource, please refer to the document of DataReplicationFabricResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string fabricName = "wPR"; + ResourceIdentifier dataReplicationFabricResourceId = DataReplicationFabricResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fabricName); + DataReplicationFabricResource dataReplicationFabric = client.GetDataReplicationFabricResource(dataReplicationFabricResourceId); + + // invoke the operation + DataReplicationFabricPatch patch = new DataReplicationFabricPatch() + { + Tags = +{ +["key6664"] = "def", +}, + Properties = new DataReplicationFabricProperties(new GeneralFabricModelCustomProperties()), + }; + ArmOperation lro = await dataReplicationFabric.UpdateAsync(WaitUntil.Completed, patch); + DataReplicationFabricResource 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 + DataReplicationFabricData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Fabric_Delete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_FabricDelete() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Fabric_Delete.json + // this example is just showing the usage of "Fabric_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 DataReplicationFabricResource created on azure + // for more information of creating DataReplicationFabricResource, please refer to the document of DataReplicationFabricResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string fabricName = "wPR"; + ResourceIdentifier dataReplicationFabricResourceId = DataReplicationFabricResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fabricName); + DataReplicationFabricResource dataReplicationFabric = client.GetDataReplicationFabricResource(dataReplicationFabricResourceId); + + // invoke the operation + await dataReplicationFabric.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Fabric_ListBySubscription + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetDataReplicationFabrics_FabricListBySubscription() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Fabric_ListBySubscription.json + // this example is just showing the usage of "Fabric_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 = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + string continuationToken = "rmgqrpzucsizbyjscxzockbiyg"; + await foreach (DataReplicationFabricResource item in subscriptionResource.GetDataReplicationFabricsAsync(continuationToken: continuationToken)) + { + // 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 + DataReplicationFabricData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationPolicyCollection.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationPolicyCollection.cs new file mode 100644 index 000000000000..105f687df4ec --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationPolicyCollection.cs @@ -0,0 +1,161 @@ +// 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.RecoveryServicesDataReplication; +using Azure.ResourceManager.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Samples +{ + public partial class Sample_DataReplicationPolicyCollection + { + // Policy_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_PolicyGet() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Policy_Get.json + // this example is just showing the usage of "Policy_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 DataReplicationVaultResource created on azure + // for more information of creating DataReplicationVaultResource, please refer to the document of DataReplicationVaultResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + ResourceIdentifier dataReplicationVaultResourceId = DataReplicationVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName); + DataReplicationVaultResource dataReplicationVault = client.GetDataReplicationVaultResource(dataReplicationVaultResourceId); + + // get the collection of this DataReplicationPolicyResource + DataReplicationPolicyCollection collection = dataReplicationVault.GetDataReplicationPolicies(); + + // invoke the operation + string policyName = "wdqsacasc"; + DataReplicationPolicyResource result = await collection.GetAsync(policyName); + + // 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 + DataReplicationPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Policy_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_PolicyGet() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Policy_Get.json + // this example is just showing the usage of "Policy_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 DataReplicationVaultResource created on azure + // for more information of creating DataReplicationVaultResource, please refer to the document of DataReplicationVaultResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + ResourceIdentifier dataReplicationVaultResourceId = DataReplicationVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName); + DataReplicationVaultResource dataReplicationVault = client.GetDataReplicationVaultResource(dataReplicationVaultResourceId); + + // get the collection of this DataReplicationPolicyResource + DataReplicationPolicyCollection collection = dataReplicationVault.GetDataReplicationPolicies(); + + // invoke the operation + string policyName = "wdqsacasc"; + bool result = await collection.ExistsAsync(policyName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Policy_Create + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_PolicyCreate() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Policy_Create.json + // this example is just showing the usage of "Policy_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 DataReplicationVaultResource created on azure + // for more information of creating DataReplicationVaultResource, please refer to the document of DataReplicationVaultResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + ResourceIdentifier dataReplicationVaultResourceId = DataReplicationVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName); + DataReplicationVaultResource dataReplicationVault = client.GetDataReplicationVaultResource(dataReplicationVaultResourceId); + + // get the collection of this DataReplicationPolicyResource + DataReplicationPolicyCollection collection = dataReplicationVault.GetDataReplicationPolicies(); + + // invoke the operation + string policyName = "fafqwc"; + DataReplicationPolicyData data = new DataReplicationPolicyData(new DataReplicationPolicyProperties(new GeneralPolicyModelCustomProperties())); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, policyName, data); + DataReplicationPolicyResource 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 + DataReplicationPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Policy_List + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_PolicyList() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Policy_List.json + // this example is just showing the usage of "Policy_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DataReplicationVaultResource created on azure + // for more information of creating DataReplicationVaultResource, please refer to the document of DataReplicationVaultResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + ResourceIdentifier dataReplicationVaultResourceId = DataReplicationVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName); + DataReplicationVaultResource dataReplicationVault = client.GetDataReplicationVaultResource(dataReplicationVaultResourceId); + + // get the collection of this DataReplicationPolicyResource + DataReplicationPolicyCollection collection = dataReplicationVault.GetDataReplicationPolicies(); + + // invoke the operation and iterate over the result + await foreach (DataReplicationPolicyResource 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 + DataReplicationPolicyData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationPolicyResource.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationPolicyResource.cs new file mode 100644 index 000000000000..a06917e3b028 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationPolicyResource.cs @@ -0,0 +1,115 @@ +// 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.RecoveryServicesDataReplication; +using Azure.ResourceManager.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Samples +{ + public partial class Sample_DataReplicationPolicyResource + { + // Policy_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_PolicyGet() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Policy_Get.json + // this example is just showing the usage of "Policy_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 DataReplicationPolicyResource created on azure + // for more information of creating DataReplicationPolicyResource, please refer to the document of DataReplicationPolicyResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + string policyName = "wdqsacasc"; + ResourceIdentifier dataReplicationPolicyResourceId = DataReplicationPolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName, policyName); + DataReplicationPolicyResource dataReplicationPolicy = client.GetDataReplicationPolicyResource(dataReplicationPolicyResourceId); + + // invoke the operation + DataReplicationPolicyResource result = await dataReplicationPolicy.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 + DataReplicationPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Policy_Create + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_PolicyCreate() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Policy_Create.json + // this example is just showing the usage of "Policy_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 DataReplicationPolicyResource created on azure + // for more information of creating DataReplicationPolicyResource, please refer to the document of DataReplicationPolicyResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + string policyName = "fafqwc"; + ResourceIdentifier dataReplicationPolicyResourceId = DataReplicationPolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName, policyName); + DataReplicationPolicyResource dataReplicationPolicy = client.GetDataReplicationPolicyResource(dataReplicationPolicyResourceId); + + // invoke the operation + DataReplicationPolicyData data = new DataReplicationPolicyData(new DataReplicationPolicyProperties(new GeneralPolicyModelCustomProperties())); + ArmOperation lro = await dataReplicationPolicy.UpdateAsync(WaitUntil.Completed, data); + DataReplicationPolicyResource 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 + DataReplicationPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Policy_Delete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_PolicyDelete() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Policy_Delete.json + // this example is just showing the usage of "Policy_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 DataReplicationPolicyResource created on azure + // for more information of creating DataReplicationPolicyResource, please refer to the document of DataReplicationPolicyResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + string policyName = "wqfscsdv"; + ResourceIdentifier dataReplicationPolicyResourceId = DataReplicationPolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName, policyName); + DataReplicationPolicyResource dataReplicationPolicy = client.GetDataReplicationPolicyResource(dataReplicationPolicyResourceId); + + // invoke the operation + await dataReplicationPolicy.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationProtectedItemCollection.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationProtectedItemCollection.cs new file mode 100644 index 000000000000..c9caa7c1bba2 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationProtectedItemCollection.cs @@ -0,0 +1,161 @@ +// 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.RecoveryServicesDataReplication; +using Azure.ResourceManager.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Samples +{ + public partial class Sample_DataReplicationProtectedItemCollection + { + // ProtectedItem_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ProtectedItemGet() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ProtectedItem_Get.json + // this example is just showing the usage of "ProtectedItem_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 DataReplicationVaultResource created on azure + // for more information of creating DataReplicationVaultResource, please refer to the document of DataReplicationVaultResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + ResourceIdentifier dataReplicationVaultResourceId = DataReplicationVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName); + DataReplicationVaultResource dataReplicationVault = client.GetDataReplicationVaultResource(dataReplicationVaultResourceId); + + // get the collection of this DataReplicationProtectedItemResource + DataReplicationProtectedItemCollection collection = dataReplicationVault.GetDataReplicationProtectedItems(); + + // invoke the operation + string protectedItemName = "d"; + DataReplicationProtectedItemResource result = await collection.GetAsync(protectedItemName); + + // 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 + DataReplicationProtectedItemData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ProtectedItem_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ProtectedItemGet() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ProtectedItem_Get.json + // this example is just showing the usage of "ProtectedItem_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 DataReplicationVaultResource created on azure + // for more information of creating DataReplicationVaultResource, please refer to the document of DataReplicationVaultResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + ResourceIdentifier dataReplicationVaultResourceId = DataReplicationVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName); + DataReplicationVaultResource dataReplicationVault = client.GetDataReplicationVaultResource(dataReplicationVaultResourceId); + + // get the collection of this DataReplicationProtectedItemResource + DataReplicationProtectedItemCollection collection = dataReplicationVault.GetDataReplicationProtectedItems(); + + // invoke the operation + string protectedItemName = "d"; + bool result = await collection.ExistsAsync(protectedItemName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ProtectedItem_Create + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ProtectedItemCreate() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ProtectedItem_Create.json + // this example is just showing the usage of "ProtectedItem_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 DataReplicationVaultResource created on azure + // for more information of creating DataReplicationVaultResource, please refer to the document of DataReplicationVaultResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + ResourceIdentifier dataReplicationVaultResourceId = DataReplicationVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName); + DataReplicationVaultResource dataReplicationVault = client.GetDataReplicationVaultResource(dataReplicationVaultResourceId); + + // get the collection of this DataReplicationProtectedItemResource + DataReplicationProtectedItemCollection collection = dataReplicationVault.GetDataReplicationProtectedItems(); + + // invoke the operation + string protectedItemName = "d"; + DataReplicationProtectedItemData data = new DataReplicationProtectedItemData(new DataReplicationProtectedItemProperties("tjoeiynplt", "jwxdo", new GeneralProtectedItemModelCustomProperties())); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, protectedItemName, data); + DataReplicationProtectedItemResource 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 + DataReplicationProtectedItemData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ProtectedItem_List + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ProtectedItemList() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ProtectedItem_List.json + // this example is just showing the usage of "ProtectedItem_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DataReplicationVaultResource created on azure + // for more information of creating DataReplicationVaultResource, please refer to the document of DataReplicationVaultResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + ResourceIdentifier dataReplicationVaultResourceId = DataReplicationVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName); + DataReplicationVaultResource dataReplicationVault = client.GetDataReplicationVaultResource(dataReplicationVaultResourceId); + + // get the collection of this DataReplicationProtectedItemResource + DataReplicationProtectedItemCollection collection = dataReplicationVault.GetDataReplicationProtectedItems(); + + // invoke the operation and iterate over the result + await foreach (DataReplicationProtectedItemResource 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 + DataReplicationProtectedItemData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationProtectedItemResource.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationProtectedItemResource.cs new file mode 100644 index 000000000000..38ccd0c55d5a --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationProtectedItemResource.cs @@ -0,0 +1,146 @@ +// 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.RecoveryServicesDataReplication; +using Azure.ResourceManager.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Samples +{ + public partial class Sample_DataReplicationProtectedItemResource + { + // ProtectedItem_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ProtectedItemGet() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ProtectedItem_Get.json + // this example is just showing the usage of "ProtectedItem_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 DataReplicationProtectedItemResource created on azure + // for more information of creating DataReplicationProtectedItemResource, please refer to the document of DataReplicationProtectedItemResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + string protectedItemName = "d"; + ResourceIdentifier dataReplicationProtectedItemResourceId = DataReplicationProtectedItemResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName, protectedItemName); + DataReplicationProtectedItemResource dataReplicationProtectedItem = client.GetDataReplicationProtectedItemResource(dataReplicationProtectedItemResourceId); + + // invoke the operation + DataReplicationProtectedItemResource result = await dataReplicationProtectedItem.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 + DataReplicationProtectedItemData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ProtectedItem_Create + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ProtectedItemCreate() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ProtectedItem_Create.json + // this example is just showing the usage of "ProtectedItem_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 DataReplicationProtectedItemResource created on azure + // for more information of creating DataReplicationProtectedItemResource, please refer to the document of DataReplicationProtectedItemResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + string protectedItemName = "d"; + ResourceIdentifier dataReplicationProtectedItemResourceId = DataReplicationProtectedItemResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName, protectedItemName); + DataReplicationProtectedItemResource dataReplicationProtectedItem = client.GetDataReplicationProtectedItemResource(dataReplicationProtectedItemResourceId); + + // invoke the operation + DataReplicationProtectedItemData data = new DataReplicationProtectedItemData(new DataReplicationProtectedItemProperties("tjoeiynplt", "jwxdo", new GeneralProtectedItemModelCustomProperties())); + ArmOperation lro = await dataReplicationProtectedItem.UpdateAsync(WaitUntil.Completed, data); + DataReplicationProtectedItemResource 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 + DataReplicationProtectedItemData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ProtectedItem_Delete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_ProtectedItemDelete() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ProtectedItem_Delete.json + // this example is just showing the usage of "ProtectedItem_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 DataReplicationProtectedItemResource created on azure + // for more information of creating DataReplicationProtectedItemResource, please refer to the document of DataReplicationProtectedItemResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + string protectedItemName = "d"; + ResourceIdentifier dataReplicationProtectedItemResourceId = DataReplicationProtectedItemResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName, protectedItemName); + DataReplicationProtectedItemResource dataReplicationProtectedItem = client.GetDataReplicationProtectedItemResource(dataReplicationProtectedItemResourceId); + + // invoke the operation + bool? forceDelete = true; + await dataReplicationProtectedItem.DeleteAsync(WaitUntil.Completed, forceDelete: forceDelete); + + Console.WriteLine($"Succeeded"); + } + + // ProtectedItem_PlannedFailover + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task PlannedFailover_ProtectedItemPlannedFailover() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ProtectedItem_PlannedFailover.json + // this example is just showing the usage of "ProtectedItem_PlannedFailover" 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 DataReplicationProtectedItemResource created on azure + // for more information of creating DataReplicationProtectedItemResource, please refer to the document of DataReplicationProtectedItemResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + string protectedItemName = "d"; + ResourceIdentifier dataReplicationProtectedItemResourceId = DataReplicationProtectedItemResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName, protectedItemName); + DataReplicationProtectedItemResource dataReplicationProtectedItem = client.GetDataReplicationProtectedItemResource(dataReplicationProtectedItemResourceId); + + // invoke the operation + PlannedFailoverModel body = new PlannedFailoverModel(new PlannedFailoverModelProperties(new GeneralPlannedFailoverModelCustomProperties())); + ArmOperation lro = await dataReplicationProtectedItem.PlannedFailoverAsync(WaitUntil.Completed, body: body); + PlannedFailoverModel result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationRecoveryPointCollection.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationRecoveryPointCollection.cs new file mode 100644 index 000000000000..74ca7d8389ac --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationRecoveryPointCollection.cs @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.RecoveryServicesDataReplication; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Samples +{ + public partial class Sample_DataReplicationRecoveryPointCollection + { + // RecoveryPoints_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_RecoveryPointsGet() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/RecoveryPoints_Get.json + // this example is just showing the usage of "RecoveryPoints_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 DataReplicationProtectedItemResource created on azure + // for more information of creating DataReplicationProtectedItemResource, please refer to the document of DataReplicationProtectedItemResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + string protectedItemName = "d"; + ResourceIdentifier dataReplicationProtectedItemResourceId = DataReplicationProtectedItemResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName, protectedItemName); + DataReplicationProtectedItemResource dataReplicationProtectedItem = client.GetDataReplicationProtectedItemResource(dataReplicationProtectedItemResourceId); + + // get the collection of this DataReplicationRecoveryPointResource + DataReplicationRecoveryPointCollection collection = dataReplicationProtectedItem.GetDataReplicationRecoveryPoints(); + + // invoke the operation + string recoveryPointName = "1X"; + DataReplicationRecoveryPointResource result = await collection.GetAsync(recoveryPointName); + + // 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 + DataReplicationRecoveryPointData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // RecoveryPoints_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_RecoveryPointsGet() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/RecoveryPoints_Get.json + // this example is just showing the usage of "RecoveryPoints_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 DataReplicationProtectedItemResource created on azure + // for more information of creating DataReplicationProtectedItemResource, please refer to the document of DataReplicationProtectedItemResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + string protectedItemName = "d"; + ResourceIdentifier dataReplicationProtectedItemResourceId = DataReplicationProtectedItemResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName, protectedItemName); + DataReplicationProtectedItemResource dataReplicationProtectedItem = client.GetDataReplicationProtectedItemResource(dataReplicationProtectedItemResourceId); + + // get the collection of this DataReplicationRecoveryPointResource + DataReplicationRecoveryPointCollection collection = dataReplicationProtectedItem.GetDataReplicationRecoveryPoints(); + + // invoke the operation + string recoveryPointName = "1X"; + bool result = await collection.ExistsAsync(recoveryPointName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // RecoveryPoints_List + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_RecoveryPointsList() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/RecoveryPoints_List.json + // this example is just showing the usage of "RecoveryPoints_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DataReplicationProtectedItemResource created on azure + // for more information of creating DataReplicationProtectedItemResource, please refer to the document of DataReplicationProtectedItemResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + string protectedItemName = "d"; + ResourceIdentifier dataReplicationProtectedItemResourceId = DataReplicationProtectedItemResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName, protectedItemName); + DataReplicationProtectedItemResource dataReplicationProtectedItem = client.GetDataReplicationProtectedItemResource(dataReplicationProtectedItemResourceId); + + // get the collection of this DataReplicationRecoveryPointResource + DataReplicationRecoveryPointCollection collection = dataReplicationProtectedItem.GetDataReplicationRecoveryPoints(); + + // invoke the operation and iterate over the result + await foreach (DataReplicationRecoveryPointResource 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 + DataReplicationRecoveryPointData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationRecoveryPointResource.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationRecoveryPointResource.cs new file mode 100644 index 000000000000..284376d962be --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationRecoveryPointResource.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.RecoveryServicesDataReplication; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Samples +{ + public partial class Sample_DataReplicationRecoveryPointResource + { + // RecoveryPoints_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_RecoveryPointsGet() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/RecoveryPoints_Get.json + // this example is just showing the usage of "RecoveryPoints_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 DataReplicationRecoveryPointResource created on azure + // for more information of creating DataReplicationRecoveryPointResource, please refer to the document of DataReplicationRecoveryPointResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + string protectedItemName = "d"; + string recoveryPointName = "1X"; + ResourceIdentifier dataReplicationRecoveryPointResourceId = DataReplicationRecoveryPointResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName, protectedItemName, recoveryPointName); + DataReplicationRecoveryPointResource dataReplicationRecoveryPoint = client.GetDataReplicationRecoveryPointResource(dataReplicationRecoveryPointResourceId); + + // invoke the operation + DataReplicationRecoveryPointResource result = await dataReplicationRecoveryPoint.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 + DataReplicationRecoveryPointData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationReplicationExtensionCollection.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationReplicationExtensionCollection.cs new file mode 100644 index 000000000000..cc97eb6b1c94 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationReplicationExtensionCollection.cs @@ -0,0 +1,161 @@ +// 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.RecoveryServicesDataReplication; +using Azure.ResourceManager.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Samples +{ + public partial class Sample_DataReplicationReplicationExtensionCollection + { + // ReplicationExtension_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ReplicationExtensionGet() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ReplicationExtension_Get.json + // this example is just showing the usage of "ReplicationExtension_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 DataReplicationVaultResource created on azure + // for more information of creating DataReplicationVaultResource, please refer to the document of DataReplicationVaultResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + ResourceIdentifier dataReplicationVaultResourceId = DataReplicationVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName); + DataReplicationVaultResource dataReplicationVault = client.GetDataReplicationVaultResource(dataReplicationVaultResourceId); + + // get the collection of this DataReplicationReplicationExtensionResource + DataReplicationReplicationExtensionCollection collection = dataReplicationVault.GetDataReplicationReplicationExtensions(); + + // invoke the operation + string replicationExtensionName = "g16yjJ"; + DataReplicationReplicationExtensionResource result = await collection.GetAsync(replicationExtensionName); + + // 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 + DataReplicationReplicationExtensionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ReplicationExtension_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ReplicationExtensionGet() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ReplicationExtension_Get.json + // this example is just showing the usage of "ReplicationExtension_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 DataReplicationVaultResource created on azure + // for more information of creating DataReplicationVaultResource, please refer to the document of DataReplicationVaultResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + ResourceIdentifier dataReplicationVaultResourceId = DataReplicationVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName); + DataReplicationVaultResource dataReplicationVault = client.GetDataReplicationVaultResource(dataReplicationVaultResourceId); + + // get the collection of this DataReplicationReplicationExtensionResource + DataReplicationReplicationExtensionCollection collection = dataReplicationVault.GetDataReplicationReplicationExtensions(); + + // invoke the operation + string replicationExtensionName = "g16yjJ"; + bool result = await collection.ExistsAsync(replicationExtensionName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ReplicationExtension_Create + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ReplicationExtensionCreate() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ReplicationExtension_Create.json + // this example is just showing the usage of "ReplicationExtension_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 DataReplicationVaultResource created on azure + // for more information of creating DataReplicationVaultResource, please refer to the document of DataReplicationVaultResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + ResourceIdentifier dataReplicationVaultResourceId = DataReplicationVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName); + DataReplicationVaultResource dataReplicationVault = client.GetDataReplicationVaultResource(dataReplicationVaultResourceId); + + // get the collection of this DataReplicationReplicationExtensionResource + DataReplicationReplicationExtensionCollection collection = dataReplicationVault.GetDataReplicationReplicationExtensions(); + + // invoke the operation + string replicationExtensionName = "g16yjJ"; + DataReplicationReplicationExtensionData data = new DataReplicationReplicationExtensionData(new DataReplicationReplicationExtensionProperties(new GeneralReplicationExtensionModelCustomProperties())); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, replicationExtensionName, data); + DataReplicationReplicationExtensionResource 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 + DataReplicationReplicationExtensionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ReplicationExtension_List + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ReplicationExtensionList() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ReplicationExtension_List.json + // this example is just showing the usage of "ReplicationExtension_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DataReplicationVaultResource created on azure + // for more information of creating DataReplicationVaultResource, please refer to the document of DataReplicationVaultResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + ResourceIdentifier dataReplicationVaultResourceId = DataReplicationVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName); + DataReplicationVaultResource dataReplicationVault = client.GetDataReplicationVaultResource(dataReplicationVaultResourceId); + + // get the collection of this DataReplicationReplicationExtensionResource + DataReplicationReplicationExtensionCollection collection = dataReplicationVault.GetDataReplicationReplicationExtensions(); + + // invoke the operation and iterate over the result + await foreach (DataReplicationReplicationExtensionResource 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 + DataReplicationReplicationExtensionData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationReplicationExtensionResource.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationReplicationExtensionResource.cs new file mode 100644 index 000000000000..ffcb250b9b20 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationReplicationExtensionResource.cs @@ -0,0 +1,115 @@ +// 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.RecoveryServicesDataReplication; +using Azure.ResourceManager.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Samples +{ + public partial class Sample_DataReplicationReplicationExtensionResource + { + // ReplicationExtension_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ReplicationExtensionGet() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ReplicationExtension_Get.json + // this example is just showing the usage of "ReplicationExtension_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 DataReplicationReplicationExtensionResource created on azure + // for more information of creating DataReplicationReplicationExtensionResource, please refer to the document of DataReplicationReplicationExtensionResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + string replicationExtensionName = "g16yjJ"; + ResourceIdentifier dataReplicationReplicationExtensionResourceId = DataReplicationReplicationExtensionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName, replicationExtensionName); + DataReplicationReplicationExtensionResource dataReplicationReplicationExtension = client.GetDataReplicationReplicationExtensionResource(dataReplicationReplicationExtensionResourceId); + + // invoke the operation + DataReplicationReplicationExtensionResource result = await dataReplicationReplicationExtension.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 + DataReplicationReplicationExtensionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ReplicationExtension_Create + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ReplicationExtensionCreate() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ReplicationExtension_Create.json + // this example is just showing the usage of "ReplicationExtension_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 DataReplicationReplicationExtensionResource created on azure + // for more information of creating DataReplicationReplicationExtensionResource, please refer to the document of DataReplicationReplicationExtensionResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + string replicationExtensionName = "g16yjJ"; + ResourceIdentifier dataReplicationReplicationExtensionResourceId = DataReplicationReplicationExtensionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName, replicationExtensionName); + DataReplicationReplicationExtensionResource dataReplicationReplicationExtension = client.GetDataReplicationReplicationExtensionResource(dataReplicationReplicationExtensionResourceId); + + // invoke the operation + DataReplicationReplicationExtensionData data = new DataReplicationReplicationExtensionData(new DataReplicationReplicationExtensionProperties(new GeneralReplicationExtensionModelCustomProperties())); + ArmOperation lro = await dataReplicationReplicationExtension.UpdateAsync(WaitUntil.Completed, data); + DataReplicationReplicationExtensionResource 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 + DataReplicationReplicationExtensionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ReplicationExtension_Delete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_ReplicationExtensionDelete() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ReplicationExtension_Delete.json + // this example is just showing the usage of "ReplicationExtension_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 DataReplicationReplicationExtensionResource created on azure + // for more information of creating DataReplicationReplicationExtensionResource, please refer to the document of DataReplicationReplicationExtensionResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + string replicationExtensionName = "g16yjJ"; + ResourceIdentifier dataReplicationReplicationExtensionResourceId = DataReplicationReplicationExtensionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName, replicationExtensionName); + DataReplicationReplicationExtensionResource dataReplicationReplicationExtension = client.GetDataReplicationReplicationExtensionResource(dataReplicationReplicationExtensionResourceId); + + // invoke the operation + await dataReplicationReplicationExtension.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationVaultCollection.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationVaultCollection.cs new file mode 100644 index 000000000000..5083fcd49f69 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationVaultCollection.cs @@ -0,0 +1,169 @@ +// 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.RecoveryServicesDataReplication; +using Azure.ResourceManager.RecoveryServicesDataReplication.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Samples +{ + public partial class Sample_DataReplicationVaultCollection + { + // Vault_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_VaultGet() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Vault_Get.json + // this example is just showing the usage of "Vault_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 = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DataReplicationVaultResource + DataReplicationVaultCollection collection = resourceGroupResource.GetDataReplicationVaults(); + + // invoke the operation + string vaultName = "4"; + DataReplicationVaultResource result = await collection.GetAsync(vaultName); + + // 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 + DataReplicationVaultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Vault_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_VaultGet() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Vault_Get.json + // this example is just showing the usage of "Vault_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 = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DataReplicationVaultResource + DataReplicationVaultCollection collection = resourceGroupResource.GetDataReplicationVaults(); + + // invoke the operation + string vaultName = "4"; + bool result = await collection.ExistsAsync(vaultName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Vault_Create + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_VaultCreate() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Vault_Create.json + // this example is just showing the usage of "Vault_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 ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DataReplicationVaultResource + DataReplicationVaultCollection collection = resourceGroupResource.GetDataReplicationVaults(); + + // invoke the operation + string vaultName = "4"; + DataReplicationVaultData data = new DataReplicationVaultData(new AzureLocation("eck")) + { + Properties = new DataReplicationVaultProperties() + { + VaultType = DataReplicationReplicationVaultType.DisasterRecovery, + }, + Tags = +{ +["key5359"] = "ljfilxolxzuxrauopwtyxghrp", +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, vaultName, data); + DataReplicationVaultResource 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 + DataReplicationVaultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Vault_List + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_VaultList() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Vault_List.json + // this example is just showing the usage of "Vault_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DataReplicationVaultResource + DataReplicationVaultCollection collection = resourceGroupResource.GetDataReplicationVaults(); + + // invoke the operation and iterate over the result + string continuationToken = "mwculdaqndp"; + await foreach (DataReplicationVaultResource item in collection.GetAllAsync(continuationToken: continuationToken)) + { + // 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 + DataReplicationVaultData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationVaultResource.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationVaultResource.cs new file mode 100644 index 000000000000..23a47b81e4d9 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationVaultResource.cs @@ -0,0 +1,156 @@ +// 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.RecoveryServicesDataReplication; +using Azure.ResourceManager.RecoveryServicesDataReplication.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Samples +{ + public partial class Sample_DataReplicationVaultResource + { + // Vault_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_VaultGet() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Vault_Get.json + // this example is just showing the usage of "Vault_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 DataReplicationVaultResource created on azure + // for more information of creating DataReplicationVaultResource, please refer to the document of DataReplicationVaultResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + ResourceIdentifier dataReplicationVaultResourceId = DataReplicationVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName); + DataReplicationVaultResource dataReplicationVault = client.GetDataReplicationVaultResource(dataReplicationVaultResourceId); + + // invoke the operation + DataReplicationVaultResource result = await dataReplicationVault.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 + DataReplicationVaultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Vault_Update + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_VaultUpdate() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Vault_Update.json + // this example is just showing the usage of "Vault_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 DataReplicationVaultResource created on azure + // for more information of creating DataReplicationVaultResource, please refer to the document of DataReplicationVaultResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + ResourceIdentifier dataReplicationVaultResourceId = DataReplicationVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName); + DataReplicationVaultResource dataReplicationVault = client.GetDataReplicationVaultResource(dataReplicationVaultResourceId); + + // invoke the operation + DataReplicationVaultPatch patch = new DataReplicationVaultPatch() + { + Tags = +{ +["key8872"] = "pvtc", +}, + Properties = new DataReplicationVaultProperties() + { + VaultType = DataReplicationReplicationVaultType.DisasterRecovery, + }, + }; + ArmOperation lro = await dataReplicationVault.UpdateAsync(WaitUntil.Completed, patch); + DataReplicationVaultResource 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 + DataReplicationVaultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Vault_Delete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_VaultDelete() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Vault_Delete.json + // this example is just showing the usage of "Vault_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 DataReplicationVaultResource created on azure + // for more information of creating DataReplicationVaultResource, please refer to the document of DataReplicationVaultResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + ResourceIdentifier dataReplicationVaultResourceId = DataReplicationVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName); + DataReplicationVaultResource dataReplicationVault = client.GetDataReplicationVaultResource(dataReplicationVaultResourceId); + + // invoke the operation + await dataReplicationVault.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Vault_ListBySubscription + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetDataReplicationVaults_VaultListBySubscription() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Vault_ListBySubscription.json + // this example is just showing the usage of "Vault_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 = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + string continuationToken = "dqsjhseyugyexxrlrln"; + await foreach (DataReplicationVaultResource item in subscriptionResource.GetDataReplicationVaultsAsync(continuationToken: continuationToken)) + { + // 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 + DataReplicationVaultData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationWorkflowCollection.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationWorkflowCollection.cs new file mode 100644 index 000000000000..3f94aa048f0b --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationWorkflowCollection.cs @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.RecoveryServicesDataReplication; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Samples +{ + public partial class Sample_DataReplicationWorkflowCollection + { + // Workflow_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_WorkflowGet() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Workflow_Get.json + // this example is just showing the usage of "Workflow_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 DataReplicationVaultResource created on azure + // for more information of creating DataReplicationVaultResource, please refer to the document of DataReplicationVaultResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + ResourceIdentifier dataReplicationVaultResourceId = DataReplicationVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName); + DataReplicationVaultResource dataReplicationVault = client.GetDataReplicationVaultResource(dataReplicationVaultResourceId); + + // get the collection of this DataReplicationWorkflowResource + DataReplicationWorkflowCollection collection = dataReplicationVault.GetDataReplicationWorkflows(); + + // invoke the operation + string jobName = "ZGH4y"; + DataReplicationWorkflowResource result = await collection.GetAsync(jobName); + + // 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 + DataReplicationWorkflowData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Workflow_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_WorkflowGet() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Workflow_Get.json + // this example is just showing the usage of "Workflow_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 DataReplicationVaultResource created on azure + // for more information of creating DataReplicationVaultResource, please refer to the document of DataReplicationVaultResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + ResourceIdentifier dataReplicationVaultResourceId = DataReplicationVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName); + DataReplicationVaultResource dataReplicationVault = client.GetDataReplicationVaultResource(dataReplicationVaultResourceId); + + // get the collection of this DataReplicationWorkflowResource + DataReplicationWorkflowCollection collection = dataReplicationVault.GetDataReplicationWorkflows(); + + // invoke the operation + string jobName = "ZGH4y"; + bool result = await collection.ExistsAsync(jobName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Workflow_List + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_WorkflowList() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Workflow_List.json + // this example is just showing the usage of "Workflow_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DataReplicationVaultResource created on azure + // for more information of creating DataReplicationVaultResource, please refer to the document of DataReplicationVaultResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + ResourceIdentifier dataReplicationVaultResourceId = DataReplicationVaultResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName); + DataReplicationVaultResource dataReplicationVault = client.GetDataReplicationVaultResource(dataReplicationVaultResourceId); + + // get the collection of this DataReplicationWorkflowResource + DataReplicationWorkflowCollection collection = dataReplicationVault.GetDataReplicationWorkflows(); + + // invoke the operation and iterate over the result + string filter = "mnebpgmjcitjleipnttx"; + string continuationToken = "rdavrzbethhslmkqgajontnxsue"; + await foreach (DataReplicationWorkflowResource item in collection.GetAllAsync(filter: filter, continuationToken: continuationToken)) + { + // 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 + DataReplicationWorkflowData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationWorkflowResource.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationWorkflowResource.cs new file mode 100644 index 000000000000..8c9fdc6befb1 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_DataReplicationWorkflowResource.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.RecoveryServicesDataReplication; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Samples +{ + public partial class Sample_DataReplicationWorkflowResource + { + // Workflow_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_WorkflowGet() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Workflow_Get.json + // this example is just showing the usage of "Workflow_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 DataReplicationWorkflowResource created on azure + // for more information of creating DataReplicationWorkflowResource, please refer to the document of DataReplicationWorkflowResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + string vaultName = "4"; + string jobName = "ZGH4y"; + ResourceIdentifier dataReplicationWorkflowResourceId = DataReplicationWorkflowResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vaultName, jobName); + DataReplicationWorkflowResource dataReplicationWorkflow = client.GetDataReplicationWorkflowResource(dataReplicationWorkflowResourceId); + + // invoke the operation + DataReplicationWorkflowResource result = await dataReplicationWorkflow.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 + DataReplicationWorkflowData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_ResourceGroupResourceExtensions.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_ResourceGroupResourceExtensions.cs new file mode 100644 index 000000000000..804800374bd7 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_ResourceGroupResourceExtensions.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.RecoveryServicesDataReplication; +using Azure.ResourceManager.RecoveryServicesDataReplication.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Samples +{ + public partial class Sample_ResourceGroupResourceExtensions + { + // DeploymentPreflight + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task DeploymentPreflight_DeploymentPreflight() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/DeploymentPreflight.json + // this example is just showing the usage of "DeploymentPreflight" 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 = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + string resourceGroupName = "rgrecoveryservicesdatareplication"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // invoke the operation + string deploymentId = "kjoiahxljomjcmvabaobumg"; + DeploymentPreflightModel body = new DeploymentPreflightModel() + { + Resources = +{ +new DeploymentPreflightResource() +{ +Name = "xtgugoflfc", +DeploymentPreflightResourceType = new ResourceType("nsnaptduolqcxsikrewvgjbxqpt"), +Location = new AzureLocation("cbsgtxkjdzwbyp"), +ApiVersion = "otihymhvzblycdoxo", +} +}, + }; + DeploymentPreflightModel result = await resourceGroupResource.DeploymentPreflightAsync(deploymentId, body: body); + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs new file mode 100644 index 000000000000..a4f2d4294cc5 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.RecoveryServicesDataReplication; +using Azure.ResourceManager.RecoveryServicesDataReplication.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Samples +{ + public partial class Sample_SubscriptionResourceExtensions + { + // CheckNameAvailability + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CheckDataReplicationNameAvailability_CheckNameAvailability() + { + // Generated from example definition: specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/CheckNameAvailability.json + // this example is just showing the usage of "CheckNameAvailability" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "930CEC23-4430-4513-B855-DBA237E2F3BF"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation + AzureLocation location = new AzureLocation("trfqtbtmusswpibw"); + DataReplicationNameAvailabilityContent content = new DataReplicationNameAvailabilityContent() + { + Name = "updkdcixs", + ResourceType = new ResourceType("gngmcancdauwhdixjjvqnfkvqc"), + }; + DataReplicationNameAvailabilityResult result = await subscriptionResource.CheckDataReplicationNameAvailabilityAsync(location, content: content); + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/autorest.tests.md b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/autorest.tests.md new file mode 100644 index 000000000000..15376defe308 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/samples/autorest.tests.md @@ -0,0 +1,13 @@ +# Generated code configuration + +Run `dotnet build /t:GenerateTests` to generate code. + +# Azure.ResourceManager.RecoveryServicesDataReplication.Tests + +> see https://aka.ms/autorest +``` yaml +require: ../src/autorest.md +include-x-ms-examples-original-file: true +testgen: + sample: true +``` \ No newline at end of file diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Azure.ResourceManager.RecoveryServicesDataReplication.csproj b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Azure.ResourceManager.RecoveryServicesDataReplication.csproj new file mode 100644 index 000000000000..940b8edcae0b --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Azure.ResourceManager.RecoveryServicesDataReplication.csproj @@ -0,0 +1,8 @@ + + + 1.0.0-beta.1 + Azure.ResourceManager.RecoveryServicesDataReplication + Azure Resource Manager client SDK for Azure resource provider RecoveryServicesDataReplication. + azure;management;arm;resource manager;recoveryservicesdatareplication + + diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/ArmRecoveryServicesDataReplicationModelFactory.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/ArmRecoveryServicesDataReplicationModelFactory.cs new file mode 100644 index 000000000000..73b7598df67a --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/ArmRecoveryServicesDataReplicationModelFactory.cs @@ -0,0 +1,816 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.RecoveryServicesDataReplication; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// Model factory for models. + public static partial class ArmRecoveryServicesDataReplicationModelFactory + { + /// Initializes a new instance of DataReplicationDraData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Dra model properties. + /// A new instance for mocking. + public static DataReplicationDraData DataReplicationDraData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DataReplicationDraProperties properties = null) + { + return new DataReplicationDraData(id, name, resourceType, systemData, properties); + } + + /// Initializes a new instance of DataReplicationDraProperties. + /// Gets or sets the Dra correlation Id. + /// Gets or sets the machine Id where Dra is running. + /// Gets or sets the machine name where Dra is running. + /// Identity model. + /// Identity model. + /// Gets or sets a value indicating whether Dra is responsive. + /// Gets or sets the time when last heartbeat was sent by the Dra. + /// Gets or sets the Dra version. + /// Gets or sets the provisioning state of the Dra. + /// Gets or sets the list of health errors. + /// + /// Dra model custom properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// A new instance for mocking. + public static DataReplicationDraProperties DataReplicationDraProperties(string correlationId = null, string machineId = null, string machineName = null, DataReplicationIdentity authenticationIdentity = null, DataReplicationIdentity resourceAccessIdentity = null, bool? isResponsive = null, DateTimeOffset? lastHeartbeatOn = null, string versionNumber = null, DataReplicationProvisioningState? provisioningState = null, IEnumerable healthErrors = null, DraModelCustomProperties customProperties = null) + { + healthErrors ??= new List(); + + return new DataReplicationDraProperties(correlationId, machineId, machineName, authenticationIdentity, resourceAccessIdentity, isResponsive, lastHeartbeatOn, versionNumber, provisioningState, healthErrors?.ToList(), customProperties); + } + + /// Initializes a new instance of DataReplicationHealthErrorInfo. + /// Gets or sets the type of affected resource type. + /// + /// Gets or sets the list of affected resource correlation Ids. This can be used to + /// uniquely identify the count of items affected by a specific category and severity + /// as well as count of item affected by an specific issue. + /// + /// Gets or sets a list of child health errors associated with this error. + /// Gets or sets the error code. + /// Gets or sets the health category. + /// Gets or sets the error category. + /// Gets or sets the error severity. + /// Gets or sets the error source. + /// Gets or sets the error creation time. + /// Gets or sets a value indicating whether the error is customer resolvable. + /// Gets or sets the error summary. + /// Gets or sets the error message. + /// Gets or sets possible causes of the error. + /// Gets or sets recommended action to resolve the error. + /// A new instance for mocking. + public static DataReplicationHealthErrorInfo DataReplicationHealthErrorInfo(string affectedResourceType = null, IEnumerable affectedResourceCorrelationIds = null, IEnumerable childErrors = null, string code = null, string healthCategory = null, string category = null, string severity = null, string source = null, DateTimeOffset? createdOn = null, bool? isCustomerResolvable = null, string summary = null, string message = null, string causes = null, string recommendation = null) + { + affectedResourceCorrelationIds ??= new List(); + childErrors ??= new List(); + + return new DataReplicationHealthErrorInfo(affectedResourceType, affectedResourceCorrelationIds?.ToList(), childErrors?.ToList(), code, healthCategory, category, severity, source, createdOn, isCustomerResolvable, summary, message, causes, recommendation); + } + + /// Initializes a new instance of DataReplicationInnerHealthErrorInfo. + /// Gets or sets the error code. + /// Gets or sets the health category. + /// Gets or sets the error category. + /// Gets or sets the error severity. + /// Gets or sets the error source. + /// Gets or sets the error creation time. + /// Gets or sets a value indicating whether the error is customer resolvable. + /// Gets or sets the error summary. + /// Gets or sets the error message. + /// Gets or sets possible causes of the error. + /// Gets or sets recommended action to resolve the error. + /// A new instance for mocking. + public static DataReplicationInnerHealthErrorInfo DataReplicationInnerHealthErrorInfo(string code = null, string healthCategory = null, string category = null, string severity = null, string source = null, DateTimeOffset? createdOn = null, bool? isCustomerResolvable = null, string summary = null, string message = null, string causes = null, string recommendation = null) + { + return new DataReplicationInnerHealthErrorInfo(code, healthCategory, category, severity, source, createdOn, isCustomerResolvable, summary, message, causes, recommendation); + } + + /// Initializes a new instance of DataReplicationEmailConfigurationData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Email configuration model properties. + /// A new instance for mocking. + public static DataReplicationEmailConfigurationData DataReplicationEmailConfigurationData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DataReplicationEmailConfigurationProperties properties = null) + { + return new DataReplicationEmailConfigurationData(id, name, resourceType, systemData, properties); + } + + /// Initializes a new instance of DataReplicationEventData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Event model properties. + /// A new instance for mocking. + public static DataReplicationEventData DataReplicationEventData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DataReplicationEventProperties properties = null) + { + return new DataReplicationEventData(id, name, resourceType, systemData, properties); + } + + /// Initializes a new instance of DataReplicationEventProperties. + /// Gets or sets the resource type. + /// Gets or sets the resource name. + /// Gets or sets the event type. + /// Gets or sets the event name. + /// Gets or sets the time at which the event occurred at source. + /// Gets or sets the event severity. + /// Gets or sets the event description. + /// Gets or sets the event correlation Id. + /// Gets or sets the errors associated with this event. + /// + /// Event model custom properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + /// A new instance for mocking. + public static DataReplicationEventProperties DataReplicationEventProperties(ResourceType? resourceType = null, string resourceName = null, string eventType = null, string eventName = null, DateTimeOffset? occurredOn = null, string severity = null, string description = null, string correlationId = null, IEnumerable healthErrors = null, EventModelCustomProperties customProperties = null) + { + healthErrors ??= new List(); + + return new DataReplicationEventProperties(resourceType, resourceName, eventType, eventName, occurredOn, severity, description, correlationId, healthErrors?.ToList(), customProperties); + } + + /// Initializes a new instance of DataReplicationFabricData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// Fabric model properties. + /// A new instance for mocking. + public static DataReplicationFabricData DataReplicationFabricData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, DataReplicationFabricProperties properties = null) + { + tags ??= new Dictionary(); + + return new DataReplicationFabricData(id, name, resourceType, systemData, tags, location, properties); + } + + /// Initializes a new instance of DataReplicationFabricProperties. + /// Gets or sets the provisioning state of the fabric. + /// Gets or sets the service endpoint. + /// Gets or sets the service resource Id. + /// Gets or sets the fabric health. + /// Gets or sets the list of health errors. + /// + /// Fabric model custom properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , and . + /// + /// A new instance for mocking. + public static DataReplicationFabricProperties DataReplicationFabricProperties(DataReplicationProvisioningState? provisioningState = null, string serviceEndpoint = null, ResourceIdentifier serviceResourceId = null, DataReplicationHealthStatus? health = null, IEnumerable healthErrors = null, FabricModelCustomProperties customProperties = null) + { + healthErrors ??= new List(); + + return new DataReplicationFabricProperties(provisioningState, serviceEndpoint, serviceResourceId, health, healthErrors?.ToList(), customProperties); + } + + /// Initializes a new instance of DataReplicationPolicyData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Policy model properties. + /// A new instance for mocking. + public static DataReplicationPolicyData DataReplicationPolicyData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DataReplicationPolicyProperties properties = null) + { + return new DataReplicationPolicyData(id, name, resourceType, systemData, properties); + } + + /// Initializes a new instance of DataReplicationPolicyProperties. + /// Gets or sets the provisioning state of the policy. + /// + /// Policy model custom properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + /// A new instance for mocking. + public static DataReplicationPolicyProperties DataReplicationPolicyProperties(DataReplicationProvisioningState? provisioningState = null, PolicyModelCustomProperties customProperties = null) + { + return new DataReplicationPolicyProperties(provisioningState, customProperties); + } + + /// Initializes a new instance of DataReplicationProtectedItemData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Protected item model properties. + /// A new instance for mocking. + public static DataReplicationProtectedItemData DataReplicationProtectedItemData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DataReplicationProtectedItemProperties properties = null) + { + return new DataReplicationProtectedItemData(id, name, resourceType, systemData, properties); + } + + /// Initializes a new instance of DataReplicationProtectedItemProperties. + /// Gets or sets the policy name. + /// Gets or sets the replication extension name. + /// Gets or sets the protected item correlation Id. + /// Gets or sets the provisioning state of the Dra. + /// Gets or sets the protection state. + /// Gets or sets the protection state description. + /// Gets or sets the test failover state. + /// Gets or sets the Test failover state description. + /// Gets or sets the resynchronization state. + /// Gets or sets the fabric object Id. + /// Gets or sets the fabric object name. + /// Gets or sets the source fabric provider Id. + /// Gets or sets the target fabric provider Id. + /// Gets or sets the fabric Id. + /// Gets or sets the target fabric Id. + /// Gets or sets the DRA Id. + /// Gets or sets the target DRA Id. + /// Gets or sets a value indicating whether resynchronization is required or not. + /// Gets or sets the Last successful planned failover time. + /// Gets or sets the Last successful unplanned failover time. + /// Gets or sets the Last successful test failover time. + /// Protected item job properties. + /// Gets or sets the allowed scenarios on the protected item. + /// Protected item job properties. + /// Protected item job properties. + /// Protected item job properties. + /// Gets or sets protected item replication health. + /// Gets or sets the list of health errors. + /// + /// Protected item model custom properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + /// A new instance for mocking. + public static DataReplicationProtectedItemProperties DataReplicationProtectedItemProperties(string policyName = null, string replicationExtensionName = null, string correlationId = null, DataReplicationProvisioningState? provisioningState = null, DataReplicationProtectionState? protectionState = null, string protectionStateDescription = null, DataReplicationTestFailoverState? testFailoverState = null, string testFailoverStateDescription = null, DataReplicationResynchronizationState? resynchronizationState = null, string fabricObjectId = null, string fabricObjectName = null, string sourceFabricProviderId = null, string targetFabricProviderId = null, string fabricId = null, string targetFabricId = null, string draId = null, string targetDraId = null, bool? isResyncRequired = null, DateTimeOffset? lastSuccessfulPlannedFailoverOn = null, DateTimeOffset? lastSuccessfulUnplannedFailoverOn = null, DateTimeOffset? lastSuccessfulTestFailoverOn = null, ProtectedItemJobProperties currentJob = null, IEnumerable allowedJobs = null, ProtectedItemJobProperties lastFailedEnableProtectionJob = null, ProtectedItemJobProperties lastFailedPlannedFailoverJob = null, ProtectedItemJobProperties lastTestFailoverJob = null, DataReplicationHealthStatus? replicationHealth = null, IEnumerable healthErrors = null, ProtectedItemModelCustomProperties customProperties = null) + { + allowedJobs ??= new List(); + healthErrors ??= new List(); + + return new DataReplicationProtectedItemProperties(policyName, replicationExtensionName, correlationId, provisioningState, protectionState, protectionStateDescription, testFailoverState, testFailoverStateDescription, resynchronizationState, fabricObjectId, fabricObjectName, sourceFabricProviderId, targetFabricProviderId, fabricId, targetFabricId, draId, targetDraId, isResyncRequired, lastSuccessfulPlannedFailoverOn, lastSuccessfulUnplannedFailoverOn, lastSuccessfulTestFailoverOn, currentJob, allowedJobs?.ToList(), lastFailedEnableProtectionJob, lastFailedPlannedFailoverJob, lastTestFailoverJob, replicationHealth, healthErrors?.ToList(), customProperties); + } + + /// Initializes a new instance of ProtectedItemJobProperties. + /// Gets or sets protection scenario name. + /// Gets or sets workflow Id. + /// Gets or sets workflow name. + /// Gets or sets the workflow friendly display name. + /// Gets or sets workflow state. + /// Gets or sets start time of the workflow. + /// Gets or sets end time of the workflow. + /// A new instance for mocking. + public static ProtectedItemJobProperties ProtectedItemJobProperties(string scenarioName = null, string id = null, string name = null, string displayName = null, string state = null, DateTimeOffset? startOn = null, DateTimeOffset? endOn = null) + { + return new ProtectedItemJobProperties(scenarioName, id, name, displayName, state, startOn, endOn); + } + + /// Initializes a new instance of DataReplicationRecoveryPointData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Recovery point model properties. + /// A new instance for mocking. + public static DataReplicationRecoveryPointData DataReplicationRecoveryPointData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DataReplicationRecoveryPointProperties properties = null) + { + return new DataReplicationRecoveryPointData(id, name, resourceType, systemData, properties); + } + + /// Initializes a new instance of DataReplicationRecoveryPointProperties. + /// Gets or sets the recovery point time. + /// Gets or sets the recovery point type. + /// + /// Recovery point model custom properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + /// is null. + /// A new instance for mocking. + public static DataReplicationRecoveryPointProperties DataReplicationRecoveryPointProperties(DateTimeOffset recoveryPointOn = default, DataReplicationRecoveryPointType recoveryPointType = default, RecoveryPointModelCustomProperties customProperties = null) + { + if (customProperties == null) + { + throw new ArgumentNullException(nameof(customProperties)); + } + + return new DataReplicationRecoveryPointProperties(recoveryPointOn, recoveryPointType, customProperties); + } + + /// Initializes a new instance of DataReplicationReplicationExtensionData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Replication extension model properties. + /// A new instance for mocking. + public static DataReplicationReplicationExtensionData DataReplicationReplicationExtensionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DataReplicationReplicationExtensionProperties properties = null) + { + return new DataReplicationReplicationExtensionData(id, name, resourceType, systemData, properties); + } + + /// Initializes a new instance of DataReplicationReplicationExtensionProperties. + /// Gets or sets the provisioning state of the replication extension. + /// + /// Replication extension model custom properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + /// A new instance for mocking. + public static DataReplicationReplicationExtensionProperties DataReplicationReplicationExtensionProperties(DataReplicationProvisioningState? provisioningState = null, ReplicationExtensionModelCustomProperties customProperties = null) + { + return new DataReplicationReplicationExtensionProperties(provisioningState, customProperties); + } + + /// Initializes a new instance of DataReplicationNameAvailabilityResult. + /// Gets or sets a value indicating whether resource name is available or not. + /// Gets or sets the reason for resource name unavailability. + /// Gets or sets the message for resource name unavailability. + /// A new instance for mocking. + public static DataReplicationNameAvailabilityResult DataReplicationNameAvailabilityResult(bool? isNameAvailable = null, string reason = null, string message = null) + { + return new DataReplicationNameAvailabilityResult(isNameAvailable, reason, message); + } + + /// Initializes a new instance of DataReplicationVaultData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// Vault properties. + /// A new instance for mocking. + public static DataReplicationVaultData DataReplicationVaultData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, DataReplicationVaultProperties properties = null) + { + tags ??= new Dictionary(); + + return new DataReplicationVaultData(id, name, resourceType, systemData, tags, location, properties); + } + + /// Initializes a new instance of DataReplicationVaultProperties. + /// Gets or sets the provisioning state of the vault. + /// Gets or sets the service resource Id. + /// Gets or sets the type of vault. + /// A new instance for mocking. + public static DataReplicationVaultProperties DataReplicationVaultProperties(DataReplicationProvisioningState? provisioningState = null, ResourceIdentifier serviceResourceId = null, DataReplicationReplicationVaultType? vaultType = null) + { + return new DataReplicationVaultProperties(provisioningState, serviceResourceId, vaultType); + } + + /// Initializes a new instance of DataReplicationWorkflowData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Workflow model properties. + /// A new instance for mocking. + public static DataReplicationWorkflowData DataReplicationWorkflowData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DataReplicationWorkflowProperties properties = null) + { + return new DataReplicationWorkflowData(id, name, resourceType, systemData, properties); + } + + /// Initializes a new instance of DataReplicationWorkflowProperties. + /// Gets or sets the friendly display name. + /// Gets or sets the workflow state. + /// Gets or sets the start time. + /// Gets or sets the end time. + /// Gets or sets the affected object Id. + /// Gets or sets the affected object name. + /// Gets or sets the affected object internal Id. + /// Gets or sets the affected object internal name. + /// Gets or sets the object type. + /// Gets or sets the replication provider. + /// Gets or sets the source fabric provider. + /// Gets or sets the target fabric provider. + /// Gets or sets the list of allowed actions on the workflow. + /// Gets or sets the workflow activity id. + /// Gets or sets the list of tasks. + /// Gets or sets the list of errors. + /// + /// Workflow model custom properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + /// A new instance for mocking. + public static DataReplicationWorkflowProperties DataReplicationWorkflowProperties(string displayName = null, DataReplicationWorkflowState? state = null, DateTimeOffset? startOn = null, DateTimeOffset? endOn = null, string objectId = null, string objectName = null, string objectInternalId = null, string objectInternalName = null, WorkflowObjectType? objectType = null, string replicationProviderId = null, string sourceFabricProviderId = null, string targetFabricProviderId = null, IEnumerable allowedActions = null, string activityId = null, IEnumerable tasks = null, IEnumerable errors = null, WorkflowModelCustomProperties customProperties = null) + { + allowedActions ??= new List(); + tasks ??= new List(); + errors ??= new List(); + + return new DataReplicationWorkflowProperties(displayName, state, startOn, endOn, objectId, objectName, objectInternalId, objectInternalName, objectType, replicationProviderId, sourceFabricProviderId, targetFabricProviderId, allowedActions?.ToList(), activityId, tasks?.ToList(), errors?.ToList(), customProperties); + } + + /// Initializes a new instance of DataReplicationTask. + /// Gets or sets the task name. + /// Gets or sets the task state. + /// Gets or sets the start time. + /// Gets or sets the end time. + /// Task model custom properties. + /// Gets or sets the list of children workflow models. + /// A new instance for mocking. + public static DataReplicationTask DataReplicationTask(string taskName = null, DataReplicationTaskState? state = null, DateTimeOffset? startOn = null, DateTimeOffset? endOn = null, string customInstanceType = null, IEnumerable childrenWorkflows = null) + { + childrenWorkflows ??= new List(); + + return new DataReplicationTask(taskName, state, startOn, endOn, customInstanceType != null ? new TaskModelCustomProperties(customInstanceType) : null, childrenWorkflows?.ToList()); + } + + /// Initializes a new instance of DataReplicationErrorInfo. + /// Gets or sets the error code. + /// Gets or sets the error type. + /// Gets or sets the error severity. + /// Gets or sets the creation time of error. + /// Gets or sets the error message. + /// Gets or sets the possible causes of error. + /// Gets or sets the recommended action to resolve error. + /// A new instance for mocking. + public static DataReplicationErrorInfo DataReplicationErrorInfo(string code = null, string errorModelType = null, string severity = null, DateTimeOffset? createdOn = null, string message = null, string causes = null, string recommendation = null) + { + return new DataReplicationErrorInfo(code, errorModelType, severity, createdOn, message, causes, recommendation); + } + + /// Initializes a new instance of WorkflowModelCustomProperties. + /// Gets or sets the instance type. + /// Gets or sets any custom properties of the affected object. + /// A new instance for mocking. + public static WorkflowModelCustomProperties WorkflowModelCustomProperties(string instanceType = null, IReadOnlyDictionary affectedObjectDetails = null) + { + affectedObjectDetails ??= new Dictionary(); + + return new UnknownWorkflowModelCustomProperties(instanceType, affectedObjectDetails); + } + + /// Initializes a new instance of AzStackHciFabricModelCustomProperties. + /// Gets or sets the ARM Id of the AzStackHCI site. + /// Gets or sets the Appliance name. + /// AzStackHCI cluster properties. + /// Gets or sets the fabric resource Id. + /// Gets or sets the fabric container Id. + /// Gets or sets the Migration solution ARM Id. + /// Gets or sets the migration hub Uri. + /// A new instance for mocking. + public static AzStackHciFabricModelCustomProperties AzStackHciFabricModelCustomProperties(ResourceIdentifier azStackHciSiteId = null, IEnumerable applianceName = null, AzStackHciClusterProperties cluster = null, ResourceIdentifier fabricResourceId = null, string fabricContainerId = null, ResourceIdentifier migrationSolutionId = null, Uri migrationHubUri = null) + { + applianceName ??= new List(); + + return new AzStackHciFabricModelCustomProperties("AzStackHCI", azStackHciSiteId, applianceName?.ToList(), cluster, fabricResourceId, fabricContainerId, migrationSolutionId, migrationHubUri); + } + + /// Initializes a new instance of FailoverProtectedItemProperties. + /// Gets or sets the protected item name. + /// Gets or sets the VM name. + /// Gets or sets the test VM name. + /// Gets or sets the recovery point Id. + /// Gets or sets the recovery point time. + /// Gets or sets the network name. + /// Gets or sets the network subnet. + /// A new instance for mocking. + public static FailoverProtectedItemProperties FailoverProtectedItemProperties(string protectedItemName = null, string vmName = null, string testVmName = null, string recoveryPointId = null, DateTimeOffset? recoveryPointOn = null, string networkName = null, string subnet = null) + { + return new FailoverProtectedItemProperties(protectedItemName, vmName, testVmName, recoveryPointId, recoveryPointOn, networkName, subnet); + } + + /// Initializes a new instance of FailoverWorkflowModelCustomProperties. + /// Gets or sets any custom properties of the affected object. + /// Gets or sets the failed over protected item details. + /// A new instance for mocking. + public static FailoverWorkflowModelCustomProperties FailoverWorkflowModelCustomProperties(IReadOnlyDictionary affectedObjectDetails = null, IEnumerable protectedItemDetails = null) + { + affectedObjectDetails ??= new Dictionary(); + protectedItemDetails ??= new List(); + + return new FailoverWorkflowModelCustomProperties("FailoverWorkflowDetails", affectedObjectDetails, protectedItemDetails?.ToList()); + } + + /// Initializes a new instance of HyperVMigrateFabricModelCustomProperties. + /// Gets or sets the ARM Id of the HyperV site. + /// Gets or sets the fabric resource Id. + /// Gets or sets the fabric container Id. + /// Gets or sets the migration solution ARM Id. + /// Gets or sets the migration hub Uri. + /// A new instance for mocking. + public static HyperVMigrateFabricModelCustomProperties HyperVMigrateFabricModelCustomProperties(ResourceIdentifier hyperVSiteId = null, ResourceIdentifier fabricResourceId = null, string fabricContainerId = null, ResourceIdentifier migrationSolutionId = null, Uri migrationHubUri = null) + { + return new HyperVMigrateFabricModelCustomProperties("HyperVMigrate", hyperVSiteId, fabricResourceId, fabricContainerId, migrationSolutionId, migrationHubUri); + } + + /// Initializes a new instance of HyperVToAzStackHciEventModelCustomProperties. + /// Gets or sets the friendly name of the source which has raised this health event. + /// Gets or sets the protected item friendly name. + /// Gets or sets the source appliance name. + /// Gets or sets the source target name. + /// Gets or sets the server type. + /// A new instance for mocking. + public static HyperVToAzStackHciEventModelCustomProperties HyperVToAzStackHciEventModelCustomProperties(string eventSourceFriendlyName = null, string protectedItemFriendlyName = null, string sourceApplianceName = null, string targetApplianceName = null, string serverType = null) + { + return new HyperVToAzStackHciEventModelCustomProperties("HyperVToAzStackHCI", eventSourceFriendlyName, protectedItemFriendlyName, sourceApplianceName, targetApplianceName, serverType); + } + + /// Initializes a new instance of HyperVToAzStackHciNicInput. + /// Gets or sets the NIC Id. + /// Gets or sets the network name. + /// Gets or sets the target network Id within AzStackHCI Cluster. + /// Gets or sets the target test network Id within AzStackHCI Cluster. + /// Gets or sets the selection type of the NIC. + /// A new instance for mocking. + public static HyperVToAzStackHciNicInput HyperVToAzStackHciNicInput(string nicId = null, string networkName = null, string targetNetworkId = null, string testNetworkId = null, VmNicSelection selectionTypeForFailover = default) + { + return new HyperVToAzStackHciNicInput(nicId, networkName, targetNetworkId, testNetworkId, selectionTypeForFailover); + } + + /// Initializes a new instance of HyperVToAzStackHciProtectedDiskProperties. + /// Gets or sets the ARM Id of the storage container. + /// Gets or sets the local path of the storage container. + /// Gets or sets the source disk Id. + /// Gets or sets the source disk Name. + /// Gets or sets the seed disk name. + /// Gets or sets the test failover clone disk. + /// Gets or sets the failover clone disk. + /// Gets or sets a value indicating whether the disk is the OS disk. + /// Gets or sets the disk capacity in bytes. + /// + /// Gets or sets a value indicating whether dynamic sizing is enabled on the virtual hard + /// disk. + /// + /// Gets or sets the disk type. + /// A new instance for mocking. + public static HyperVToAzStackHciProtectedDiskProperties HyperVToAzStackHciProtectedDiskProperties(ResourceIdentifier storageContainerId = null, string storageContainerLocalPath = null, string sourceDiskId = null, string sourceDiskName = null, string seedDiskName = null, string testMigrateDiskName = null, string migrateDiskName = null, bool? isOSDisk = null, long? capacityInBytes = null, bool? isDynamic = null, string diskType = null) + { + return new HyperVToAzStackHciProtectedDiskProperties(storageContainerId, storageContainerLocalPath, sourceDiskId, sourceDiskName, seedDiskName, testMigrateDiskName, migrateDiskName, isOSDisk, capacityInBytes, isDynamic, diskType); + } + + /// Initializes a new instance of HyperVToAzStackHciProtectedItemModelCustomProperties. + /// Gets or sets the location of the protected item. + /// Gets or sets the Target HCI Cluster ARM Id. + /// Gets or sets the Target Arc Cluster Custom Location ARM Id. + /// Gets or sets the Target AzStackHCI cluster name. + /// Gets or sets the ARM Id of the discovered machine. + /// Gets or sets the list of disks to replicate. + /// Gets or sets the list of VM NIC to replicate. + /// Gets or sets the source VM display name. + /// Gets or sets the source VM CPU cores. + /// Gets or sets the source VM ram memory size in megabytes. + /// Gets or sets the target VM display name. + /// Gets or sets the target resource group ARM Id. + /// Gets or sets the target storage container ARM Id. + /// Gets or sets the hypervisor generation of the virtual machine. + /// Gets or sets the target network Id within AzStackHCI Cluster. + /// Gets or sets the target test network Id within AzStackHCI Cluster. + /// Gets or sets the target CPU cores. + /// Gets or sets a value indicating whether memory is dynamical. + /// Protected item dynamic memory config. + /// Gets or sets the target memory in mega-bytes. + /// Gets or sets the Run As account Id. + /// Gets or sets the source DRA name. + /// Gets or sets the target DRA name. + /// Gets or sets the source appliance name. + /// Gets or sets the target appliance name. + /// Gets or sets the type of the OS. + /// Gets or sets the name of the OS. + /// Gets or sets the firmware type. + /// Gets or sets the target location. + /// Gets or sets the location of Azure Arc HCI custom location resource. + /// Gets or sets the recovery point Id to which the VM was failed over. + /// Gets or sets the last recovery point received time. + /// Gets or sets the last recovery point Id. + /// + /// Gets or sets the initial replication progress percentage. This is calculated based on + /// total bytes processed for all disks in the source VM. + /// + /// + /// Gets or sets the resync progress percentage. This is calculated based on total bytes + /// processed for all disks in the source VM. + /// + /// Gets or sets the list of protected disks. + /// Gets or sets the VM NIC details. + /// Gets or sets the BIOS Id of the target AzStackHCI VM. + /// Gets or sets the latest timestamp that replication status is updated. + /// A new instance for mocking. + public static HyperVToAzStackHciProtectedItemModelCustomProperties HyperVToAzStackHciProtectedItemModelCustomProperties(ProtectedItemActiveLocation? activeLocation = null, ResourceIdentifier targetHciClusterId = null, ResourceIdentifier targetArcClusterCustomLocationId = null, string targetAzStackHciClusterName = null, ResourceIdentifier fabricDiscoveryMachineId = null, IEnumerable disksToInclude = null, IEnumerable nicsToInclude = null, string sourceVmName = null, int? sourceCpuCores = null, double? sourceMemoryInMegaBytes = null, string targetVmName = null, ResourceIdentifier targetResourceGroupId = null, ResourceIdentifier storageContainerId = null, string hyperVGeneration = null, string targetNetworkId = null, string testNetworkId = null, int? targetCpuCores = null, bool? isDynamicRam = null, ProtectedItemDynamicMemoryConfig dynamicMemoryConfig = null, int? targetMemoryInMegaBytes = null, string runAsAccountId = null, string sourceDraName = null, string targetDraName = null, string sourceApplianceName = null, string targetApplianceName = null, string osType = null, string osName = null, string firmwareType = null, string targetLocation = null, string customLocationRegion = null, string failoverRecoveryPointId = null, DateTimeOffset? lastRecoveryPointReceived = null, string lastRecoveryPointId = null, int? initialReplicationProgressPercentage = null, int? resyncProgressPercentage = null, IEnumerable protectedDisks = null, IEnumerable protectedNics = null, string targetVmBiosId = null, DateTimeOffset? lastReplicationUpdateOn = null) + { + disksToInclude ??= new List(); + nicsToInclude ??= new List(); + protectedDisks ??= new List(); + protectedNics ??= new List(); + + return new HyperVToAzStackHciProtectedItemModelCustomProperties("HyperVToAzStackHCI", activeLocation, targetHciClusterId, targetArcClusterCustomLocationId, targetAzStackHciClusterName, fabricDiscoveryMachineId, disksToInclude?.ToList(), nicsToInclude?.ToList(), sourceVmName, sourceCpuCores, sourceMemoryInMegaBytes, targetVmName, targetResourceGroupId, storageContainerId, hyperVGeneration, targetNetworkId, testNetworkId, targetCpuCores, isDynamicRam, dynamicMemoryConfig, targetMemoryInMegaBytes, runAsAccountId, sourceDraName, targetDraName, sourceApplianceName, targetApplianceName, osType, osName, firmwareType, targetLocation, customLocationRegion, failoverRecoveryPointId, lastRecoveryPointReceived, lastRecoveryPointId, initialReplicationProgressPercentage, resyncProgressPercentage, protectedDisks?.ToList(), protectedNics?.ToList(), targetVmBiosId, lastReplicationUpdateOn); + } + + /// Initializes a new instance of HyperVToAzStackHciProtectedNicProperties. + /// Gets or sets the NIC Id. + /// Gets or sets the NIC mac address. + /// Gets or sets the network name. + /// Gets or sets the target network Id within AzStackHCI Cluster. + /// Gets or sets the target test network Id within AzStackHCI Cluster. + /// Gets or sets the selection type of the NIC. + /// A new instance for mocking. + public static HyperVToAzStackHciProtectedNicProperties HyperVToAzStackHciProtectedNicProperties(string nicId = null, string macAddress = null, string networkName = null, string targetNetworkId = null, string testNetworkId = null, VmNicSelection? selectionTypeForFailover = null) + { + return new HyperVToAzStackHciProtectedNicProperties(nicId, macAddress, networkName, targetNetworkId, testNetworkId, selectionTypeForFailover); + } + + /// Initializes a new instance of HyperVToAzStackHciRecoveryPointModelCustomProperties. + /// Gets or sets the list of the disk Ids. + /// A new instance for mocking. + public static HyperVToAzStackHciRecoveryPointModelCustomProperties HyperVToAzStackHciRecoveryPointModelCustomProperties(IEnumerable diskIds = null) + { + diskIds ??= new List(); + + return new HyperVToAzStackHciRecoveryPointModelCustomProperties("HyperVToAzStackHCI", diskIds?.ToList()); + } + + /// Initializes a new instance of HyperVToAzStackHciReplicationExtensionModelCustomProperties. + /// Gets or sets the ARM Id of the source HyperV fabric. + /// Gets or sets the ARM Id of the HyperV site. + /// Gets or sets the ARM Id of the target AzStackHCI fabric. + /// Gets or sets the ARM Id of the AzStackHCI site. + /// Gets or sets the storage account Id. + /// Gets or sets the Sas Secret of storage account. + /// Gets or sets the Uri of ASR. + /// Gets or sets the Uri of Rcm. + /// Gets or sets the Uri of Gateway. + /// Gets or sets the gateway service Id of source. + /// Gets or sets the gateway service Id of target. + /// Gets or sets the source storage container name. + /// Gets or sets the target storage container name. + /// Gets or sets the resource location. + /// Gets or sets the subscription. + /// Gets or sets the resource group. + /// A new instance for mocking. + public static HyperVToAzStackHciReplicationExtensionModelCustomProperties HyperVToAzStackHciReplicationExtensionModelCustomProperties(ResourceIdentifier hyperVFabricArmId = null, ResourceIdentifier hyperVSiteId = null, ResourceIdentifier azStackHciFabricArmId = null, ResourceIdentifier azStackHciSiteId = null, string storageAccountId = null, string storageAccountSasSecretName = null, Uri asrServiceUri = null, Uri rcmServiceUri = null, Uri gatewayServiceUri = null, string sourceGatewayServiceId = null, string targetGatewayServiceId = null, string sourceStorageContainerName = null, string targetStorageContainerName = null, string resourceLocation = null, string subscriptionId = null, string resourceGroup = null) + { + return new HyperVToAzStackHciReplicationExtensionModelCustomProperties("HyperVToAzStackHCI", hyperVFabricArmId, hyperVSiteId, azStackHciFabricArmId, azStackHciSiteId, storageAccountId, storageAccountSasSecretName, asrServiceUri, rcmServiceUri, gatewayServiceUri, sourceGatewayServiceId, targetGatewayServiceId, sourceStorageContainerName, targetStorageContainerName, resourceLocation, subscriptionId, resourceGroup); + } + + /// Initializes a new instance of TestFailoverCleanupWorkflowModelCustomProperties. + /// Gets or sets any custom properties of the affected object. + /// Gets or sets the test failover cleanup comments. + /// A new instance for mocking. + public static TestFailoverCleanupWorkflowModelCustomProperties TestFailoverCleanupWorkflowModelCustomProperties(IReadOnlyDictionary affectedObjectDetails = null, string comments = null) + { + affectedObjectDetails ??= new Dictionary(); + + return new TestFailoverCleanupWorkflowModelCustomProperties("TestFailoverCleanupWorkflowDetails", affectedObjectDetails, comments); + } + + /// Initializes a new instance of TestFailoverWorkflowModelCustomProperties. + /// Gets or sets any custom properties of the affected object. + /// Gets or sets the test VM details. + /// A new instance for mocking. + public static TestFailoverWorkflowModelCustomProperties TestFailoverWorkflowModelCustomProperties(IReadOnlyDictionary affectedObjectDetails = null, IEnumerable protectedItemDetails = null) + { + affectedObjectDetails ??= new Dictionary(); + protectedItemDetails ??= new List(); + + return new TestFailoverWorkflowModelCustomProperties("TestFailoverWorkflowDetails", affectedObjectDetails, protectedItemDetails?.ToList()); + } + + /// Initializes a new instance of VMwareToAzStackHciNicInput. + /// Gets or sets the NIC Id. + /// Gets or sets the NIC label. + /// Gets or sets the network name. + /// Gets or sets the target network Id within AzStackHCI Cluster. + /// Gets or sets the target test network Id within AzStackHCI Cluster. + /// Gets or sets the selection type of the NIC. + /// A new instance for mocking. + public static VMwareToAzStackHciNicInput VMwareToAzStackHciNicInput(string nicId = null, string label = null, string networkName = null, string targetNetworkId = null, string testNetworkId = null, VmNicSelection selectionTypeForFailover = default) + { + return new VMwareToAzStackHciNicInput(nicId, label, networkName, targetNetworkId, testNetworkId, selectionTypeForFailover); + } + + /// Initializes a new instance of VMwareToAzStackHciProtectedDiskProperties. + /// Gets or sets the ARM Id of the storage container. + /// Gets or sets the local path of the storage container. + /// Gets or sets the source disk Id. + /// Gets or sets the source disk Name. + /// Gets or sets the seed disk name. + /// Gets or sets the test failover clone disk. + /// Gets or sets the failover clone disk. + /// Gets or sets a value indicating whether the disk is the OS disk. + /// Gets or sets the disk capacity in bytes. + /// + /// Gets or sets a value indicating whether dynamic sizing is enabled on the virtual hard + /// disk. + /// + /// Gets or sets the disk type. + /// A new instance for mocking. + public static VMwareToAzStackHciProtectedDiskProperties VMwareToAzStackHciProtectedDiskProperties(ResourceIdentifier storageContainerId = null, string storageContainerLocalPath = null, string sourceDiskId = null, string sourceDiskName = null, string seedDiskName = null, string testMigrateDiskName = null, string migrateDiskName = null, bool? isOSDisk = null, long? capacityInBytes = null, bool? isDynamic = null, string diskType = null) + { + return new VMwareToAzStackHciProtectedDiskProperties(storageContainerId, storageContainerLocalPath, sourceDiskId, sourceDiskName, seedDiskName, testMigrateDiskName, migrateDiskName, isOSDisk, capacityInBytes, isDynamic, diskType); + } + + /// Initializes a new instance of VMwareToAzStackHciProtectedItemModelCustomProperties. + /// Gets or sets the location of the protected item. + /// Gets or sets the Target HCI Cluster ARM Id. + /// Gets or sets the Target Arc Cluster Custom Location ARM Id. + /// Gets or sets the Target AzStackHCI cluster name. + /// Gets or sets the target storage container ARM Id. + /// Gets or sets the target resource group ARM Id. + /// Gets or sets the target location. + /// Gets or sets the location of Azure Arc HCI custom location resource. + /// Gets or sets the list of disks to replicate. + /// Gets or sets the list of VM NIC to replicate. + /// Gets or sets the list of protected disks. + /// Gets or sets the VM NIC details. + /// Gets or sets the BIOS Id of the target AzStackHCI VM. + /// Gets or sets the target VM display name. + /// Gets or sets the hypervisor generation of the virtual machine possible values are 1,2. + /// Gets or sets the target network Id within AzStackHCI Cluster. + /// Gets or sets the target test network Id within AzStackHCI Cluster. + /// Gets or sets the target CPU cores. + /// Gets or sets a value indicating whether memory is dynamical. + /// Protected item dynamic memory config. + /// Gets or sets the target memory in mega-bytes. + /// Gets or sets the type of the OS. + /// Gets or sets the name of the OS. + /// Gets or sets the firmware type. + /// Gets or sets the ARM Id of the discovered machine. + /// Gets or sets the source VM display name. + /// Gets or sets the source VM CPU cores. + /// Gets or sets the source VM ram memory size in megabytes. + /// Gets or sets the run as account Id. + /// Gets or sets the source DRA name. + /// Gets or sets the target DRA name. + /// Gets or sets the source appliance name. + /// Gets or sets the target appliance name. + /// Gets or sets the recovery point Id to which the VM was failed over. + /// Gets or sets the last recovery point received time. + /// Gets or sets the last recovery point Id. + /// + /// Gets or sets the initial replication progress percentage. This is calculated based on + /// total bytes processed for all disks in the source VM. + /// + /// Gets or sets the migration progress percentage. + /// Gets or sets the resume progress percentage. + /// + /// Gets or sets the resync progress percentage. This is calculated based on total bytes + /// processed for all disks in the source VM. + /// + /// Gets or sets the resync retry count. + /// Gets or sets a value indicating whether resync is required. + /// Gets or sets the resync state. + /// Gets or sets a value indicating whether auto resync is to be done. + /// Gets or sets the resume retry count. + /// Gets or sets the latest timestamp that replication status is updated. + /// A new instance for mocking. + public static VMwareToAzStackHciProtectedItemModelCustomProperties VMwareToAzStackHciProtectedItemModelCustomProperties(ProtectedItemActiveLocation? activeLocation = null, ResourceIdentifier targetHciClusterId = null, ResourceIdentifier targetArcClusterCustomLocationId = null, string targetAzStackHciClusterName = null, ResourceIdentifier storageContainerId = null, ResourceIdentifier targetResourceGroupId = null, string targetLocation = null, string customLocationRegion = null, IEnumerable disksToInclude = null, IEnumerable nicsToInclude = null, IEnumerable protectedDisks = null, IEnumerable protectedNics = null, string targetVmBiosId = null, string targetVmName = null, string hyperVGeneration = null, string targetNetworkId = null, string testNetworkId = null, int? targetCpuCores = null, bool? isDynamicRam = null, ProtectedItemDynamicMemoryConfig dynamicMemoryConfig = null, int? targetMemoryInMegaBytes = null, string osType = null, string osName = null, string firmwareType = null, ResourceIdentifier fabricDiscoveryMachineId = null, string sourceVmName = null, int? sourceCpuCores = null, double? sourceMemoryInMegaBytes = null, string runAsAccountId = null, string sourceDraName = null, string targetDraName = null, string sourceApplianceName = null, string targetApplianceName = null, string failoverRecoveryPointId = null, DateTimeOffset? lastRecoveryPointReceived = null, string lastRecoveryPointId = null, int? initialReplicationProgressPercentage = null, int? migrationProgressPercentage = null, int? resumeProgressPercentage = null, int? resyncProgressPercentage = null, long? resyncRetryCount = null, bool? resyncRequired = null, VMwareToAzureMigrateResyncState? resyncState = null, bool? performAutoResync = null, long? resumeRetryCount = null, DateTimeOffset? lastReplicationUpdateOn = null) + { + disksToInclude ??= new List(); + nicsToInclude ??= new List(); + protectedDisks ??= new List(); + protectedNics ??= new List(); + + return new VMwareToAzStackHciProtectedItemModelCustomProperties("VMwareToAzStackHCI", activeLocation, targetHciClusterId, targetArcClusterCustomLocationId, targetAzStackHciClusterName, storageContainerId, targetResourceGroupId, targetLocation, customLocationRegion, disksToInclude?.ToList(), nicsToInclude?.ToList(), protectedDisks?.ToList(), protectedNics?.ToList(), targetVmBiosId, targetVmName, hyperVGeneration, targetNetworkId, testNetworkId, targetCpuCores, isDynamicRam, dynamicMemoryConfig, targetMemoryInMegaBytes, osType, osName, firmwareType, fabricDiscoveryMachineId, sourceVmName, sourceCpuCores, sourceMemoryInMegaBytes, runAsAccountId, sourceDraName, targetDraName, sourceApplianceName, targetApplianceName, failoverRecoveryPointId, lastRecoveryPointReceived, lastRecoveryPointId, initialReplicationProgressPercentage, migrationProgressPercentage, resumeProgressPercentage, resyncProgressPercentage, resyncRetryCount, resyncRequired, resyncState, performAutoResync, resumeRetryCount, lastReplicationUpdateOn); + } + + /// Initializes a new instance of VMwareToAzStackHciProtectedNicProperties. + /// Gets or sets the NIC Id. + /// Gets or sets the NIC mac address. + /// Gets or sets the NIC label. + /// Gets or sets a value indicating whether this is the primary NIC. + /// Gets or sets the network name. + /// Gets or sets the target network Id within AzStackHCI Cluster. + /// Gets or sets the target test network Id within AzStackHCI Cluster. + /// Gets or sets the selection type of the NIC. + /// A new instance for mocking. + public static VMwareToAzStackHciProtectedNicProperties VMwareToAzStackHciProtectedNicProperties(string nicId = null, string macAddress = null, string label = null, bool? isPrimaryNic = null, string networkName = null, string targetNetworkId = null, string testNetworkId = null, VmNicSelection? selectionTypeForFailover = null) + { + return new VMwareToAzStackHciProtectedNicProperties(nicId, macAddress, label, isPrimaryNic, networkName, targetNetworkId, testNetworkId, selectionTypeForFailover); + } + + /// Initializes a new instance of VMwareToAzStackHciReplicationExtensionModelCustomProperties. + /// Gets or sets the ARM Id of the source VMware fabric. + /// Gets or sets the ARM Id of the VMware site. + /// Gets or sets the ARM Id of the target AzStackHCI fabric. + /// Gets or sets the ARM Id of the AzStackHCI site. + /// Gets or sets the storage account Id. + /// Gets or sets the Sas Secret of storage account. + /// Gets or sets the Uri of ASR. + /// Gets or sets the Uri of Rcm. + /// Gets or sets the Uri of Gateway. + /// Gets or sets the gateway service Id of source. + /// Gets or sets the gateway service Id of target. + /// Gets or sets the source storage container name. + /// Gets or sets the target storage container name. + /// Gets or sets the resource location. + /// Gets or sets the subscription. + /// Gets or sets the resource group. + /// A new instance for mocking. + public static VMwareToAzStackHciReplicationExtensionModelCustomProperties VMwareToAzStackHciReplicationExtensionModelCustomProperties(ResourceIdentifier vmwareFabricArmId = null, ResourceIdentifier vmwareSiteId = null, ResourceIdentifier azStackHciFabricArmId = null, ResourceIdentifier azStackHciSiteId = null, ResourceIdentifier storageAccountId = null, string storageAccountSasSecretName = null, Uri asrServiceUri = null, Uri rcmServiceUri = null, Uri gatewayServiceUri = null, string sourceGatewayServiceId = null, string targetGatewayServiceId = null, string sourceStorageContainerName = null, string targetStorageContainerName = null, string resourceLocation = null, string subscriptionId = null, string resourceGroup = null) + { + return new VMwareToAzStackHciReplicationExtensionModelCustomProperties("VMwareToAzStackHCI", vmwareFabricArmId, vmwareSiteId, azStackHciFabricArmId, azStackHciSiteId, storageAccountId, storageAccountSasSecretName, asrServiceUri, rcmServiceUri, gatewayServiceUri, sourceGatewayServiceId, targetGatewayServiceId, sourceStorageContainerName, targetStorageContainerName, resourceLocation, subscriptionId, resourceGroup); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationDraCollection.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationDraCollection.cs new file mode 100644 index 000000000000..d621f8e7b62f --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationDraCollection.cs @@ -0,0 +1,341 @@ +// 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.RecoveryServicesDataReplication +{ + /// + /// 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 GetDataReplicationDras method from an instance of . + /// + public partial class DataReplicationDraCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _dataReplicationDraDraClientDiagnostics; + private readonly DraRestOperations _dataReplicationDraDraRestClient; + + /// Initializes a new instance of the class for mocking. + protected DataReplicationDraCollection() + { + } + + /// 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 DataReplicationDraCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dataReplicationDraDraClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesDataReplication", DataReplicationDraResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DataReplicationDraResource.ResourceType, out string dataReplicationDraDraApiVersion); + _dataReplicationDraDraRestClient = new DraRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dataReplicationDraDraApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != DataReplicationFabricResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DataReplicationFabricResource.ResourceType), nameof(id)); + } + + /// + /// Creates the fabric agent. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName} + /// + /// + /// Operation Id + /// Dra_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 fabric agent (Dra) name. + /// Dra model. + /// 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 fabricAgentName, DataReplicationDraData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fabricAgentName, nameof(fabricAgentName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dataReplicationDraDraClientDiagnostics.CreateScope("DataReplicationDraCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _dataReplicationDraDraRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, fabricAgentName, data, cancellationToken).ConfigureAwait(false); + var operation = new RecoveryServicesDataReplicationArmOperation(new DataReplicationDraOperationSource(Client), _dataReplicationDraDraClientDiagnostics, Pipeline, _dataReplicationDraDraRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, fabricAgentName, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates the fabric agent. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName} + /// + /// + /// Operation Id + /// Dra_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 fabric agent (Dra) name. + /// Dra model. + /// 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 fabricAgentName, DataReplicationDraData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fabricAgentName, nameof(fabricAgentName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dataReplicationDraDraClientDiagnostics.CreateScope("DataReplicationDraCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _dataReplicationDraDraRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, fabricAgentName, data, cancellationToken); + var operation = new RecoveryServicesDataReplicationArmOperation(new DataReplicationDraOperationSource(Client), _dataReplicationDraDraClientDiagnostics, Pipeline, _dataReplicationDraDraRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, fabricAgentName, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the fabric agent. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName} + /// + /// + /// Operation Id + /// Dra_Get + /// + /// + /// + /// The fabric agent (Dra) name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string fabricAgentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fabricAgentName, nameof(fabricAgentName)); + + using var scope = _dataReplicationDraDraClientDiagnostics.CreateScope("DataReplicationDraCollection.Get"); + scope.Start(); + try + { + var response = await _dataReplicationDraDraRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, fabricAgentName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataReplicationDraResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the fabric agent. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName} + /// + /// + /// Operation Id + /// Dra_Get + /// + /// + /// + /// The fabric agent (Dra) name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string fabricAgentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fabricAgentName, nameof(fabricAgentName)); + + using var scope = _dataReplicationDraDraClientDiagnostics.CreateScope("DataReplicationDraCollection.Get"); + scope.Start(); + try + { + var response = _dataReplicationDraDraRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, fabricAgentName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataReplicationDraResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the list of fabric agents in the given fabric. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents + /// + /// + /// Operation Id + /// Dra_List + /// + /// + /// + /// 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) => _dataReplicationDraDraRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataReplicationDraDraRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataReplicationDraResource(Client, DataReplicationDraData.DeserializeDataReplicationDraData(e)), _dataReplicationDraDraClientDiagnostics, Pipeline, "DataReplicationDraCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the list of fabric agents in the given fabric. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents + /// + /// + /// Operation Id + /// Dra_List + /// + /// + /// + /// 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) => _dataReplicationDraDraRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataReplicationDraDraRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataReplicationDraResource(Client, DataReplicationDraData.DeserializeDataReplicationDraData(e)), _dataReplicationDraDraClientDiagnostics, Pipeline, "DataReplicationDraCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName} + /// + /// + /// Operation Id + /// Dra_Get + /// + /// + /// + /// The fabric agent (Dra) name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string fabricAgentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fabricAgentName, nameof(fabricAgentName)); + + using var scope = _dataReplicationDraDraClientDiagnostics.CreateScope("DataReplicationDraCollection.Exists"); + scope.Start(); + try + { + var response = await _dataReplicationDraDraRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, fabricAgentName, 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.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName} + /// + /// + /// Operation Id + /// Dra_Get + /// + /// + /// + /// The fabric agent (Dra) name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string fabricAgentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fabricAgentName, nameof(fabricAgentName)); + + using var scope = _dataReplicationDraDraClientDiagnostics.CreateScope("DataReplicationDraCollection.Exists"); + scope.Start(); + try + { + var response = _dataReplicationDraDraRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, fabricAgentName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, 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/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationDraData.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationDraData.cs new file mode 100644 index 000000000000..ab8854bc1a9b --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationDraData.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication +{ + /// + /// A class representing the DataReplicationDra data model. + /// Dra model. + /// + public partial class DataReplicationDraData : ResourceData + { + /// Initializes a new instance of DataReplicationDraData. + /// Dra model properties. + /// is null. + public DataReplicationDraData(DataReplicationDraProperties properties) + { + Argument.AssertNotNull(properties, nameof(properties)); + + Properties = properties; + } + + /// Initializes a new instance of DataReplicationDraData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Dra model properties. + internal DataReplicationDraData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataReplicationDraProperties properties) : base(id, name, resourceType, systemData) + { + Properties = properties; + } + + /// Dra model properties. + public DataReplicationDraProperties Properties { get; set; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationDraResource.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationDraResource.cs new file mode 100644 index 000000000000..cdffaa9b5db9 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationDraResource.cs @@ -0,0 +1,297 @@ +// 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.RecoveryServicesDataReplication +{ + /// + /// A Class representing a DataReplicationDra 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 GetDataReplicationDraResource method. + /// Otherwise you can get one from its parent resource using the GetDataReplicationDra method. + /// + public partial class DataReplicationDraResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string fabricName, string fabricAgentName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _dataReplicationDraDraClientDiagnostics; + private readonly DraRestOperations _dataReplicationDraDraRestClient; + private readonly DataReplicationDraData _data; + + /// Initializes a new instance of the class for mocking. + protected DataReplicationDraResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DataReplicationDraResource(ArmClient client, DataReplicationDraData 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 DataReplicationDraResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dataReplicationDraDraClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesDataReplication", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string dataReplicationDraDraApiVersion); + _dataReplicationDraDraRestClient = new DraRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dataReplicationDraDraApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.DataReplication/replicationFabrics/fabricAgents"; + + /// 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 DataReplicationDraData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the details of the fabric agent. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName} + /// + /// + /// Operation Id + /// Dra_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _dataReplicationDraDraClientDiagnostics.CreateScope("DataReplicationDraResource.Get"); + scope.Start(); + try + { + var response = await _dataReplicationDraDraRestClient.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 DataReplicationDraResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the fabric agent. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName} + /// + /// + /// Operation Id + /// Dra_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _dataReplicationDraDraClientDiagnostics.CreateScope("DataReplicationDraResource.Get"); + scope.Start(); + try + { + var response = _dataReplicationDraDraRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataReplicationDraResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the fabric agent. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName} + /// + /// + /// Operation Id + /// Dra_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 cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _dataReplicationDraDraClientDiagnostics.CreateScope("DataReplicationDraResource.Delete"); + scope.Start(); + try + { + var response = await _dataReplicationDraDraRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new RecoveryServicesDataReplicationArmOperation(_dataReplicationDraDraClientDiagnostics, Pipeline, _dataReplicationDraDraRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the fabric agent. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName} + /// + /// + /// Operation Id + /// Dra_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 cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _dataReplicationDraDraClientDiagnostics.CreateScope("DataReplicationDraResource.Delete"); + scope.Start(); + try + { + var response = _dataReplicationDraDraRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new RecoveryServicesDataReplicationArmOperation(_dataReplicationDraDraClientDiagnostics, Pipeline, _dataReplicationDraDraRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates the fabric agent. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName} + /// + /// + /// Operation Id + /// Dra_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. + /// Dra model. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, DataReplicationDraData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dataReplicationDraDraClientDiagnostics.CreateScope("DataReplicationDraResource.Update"); + scope.Start(); + try + { + var response = await _dataReplicationDraDraRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new RecoveryServicesDataReplicationArmOperation(new DataReplicationDraOperationSource(Client), _dataReplicationDraDraClientDiagnostics, Pipeline, _dataReplicationDraDraRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates the fabric agent. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName} + /// + /// + /// Operation Id + /// Dra_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. + /// Dra model. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, DataReplicationDraData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dataReplicationDraDraClientDiagnostics.CreateScope("DataReplicationDraResource.Update"); + scope.Start(); + try + { + var response = _dataReplicationDraDraRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new RecoveryServicesDataReplicationArmOperation(new DataReplicationDraOperationSource(Client), _dataReplicationDraDraClientDiagnostics, Pipeline, _dataReplicationDraDraRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationEmailConfigurationCollection.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationEmailConfigurationCollection.cs new file mode 100644 index 000000000000..1d046413f34d --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationEmailConfigurationCollection.cs @@ -0,0 +1,341 @@ +// 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.RecoveryServicesDataReplication +{ + /// + /// 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 GetDataReplicationEmailConfigurations method from an instance of . + /// + public partial class DataReplicationEmailConfigurationCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _dataReplicationEmailConfigurationEmailConfigurationClientDiagnostics; + private readonly EmailConfigurationRestOperations _dataReplicationEmailConfigurationEmailConfigurationRestClient; + + /// Initializes a new instance of the class for mocking. + protected DataReplicationEmailConfigurationCollection() + { + } + + /// 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 DataReplicationEmailConfigurationCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dataReplicationEmailConfigurationEmailConfigurationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesDataReplication", DataReplicationEmailConfigurationResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DataReplicationEmailConfigurationResource.ResourceType, out string dataReplicationEmailConfigurationEmailConfigurationApiVersion); + _dataReplicationEmailConfigurationEmailConfigurationRestClient = new EmailConfigurationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dataReplicationEmailConfigurationEmailConfigurationApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != DataReplicationVaultResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DataReplicationVaultResource.ResourceType), nameof(id)); + } + + /// + /// Creates an alert configuration setting for the given vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/alertSettings/{emailConfigurationName} + /// + /// + /// Operation Id + /// EmailConfiguration_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 email configuration name. + /// EmailConfiguration model. + /// 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 emailConfigurationName, DataReplicationEmailConfigurationData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(emailConfigurationName, nameof(emailConfigurationName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dataReplicationEmailConfigurationEmailConfigurationClientDiagnostics.CreateScope("DataReplicationEmailConfigurationCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _dataReplicationEmailConfigurationEmailConfigurationRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, emailConfigurationName, data, cancellationToken).ConfigureAwait(false); + var operation = new RecoveryServicesDataReplicationArmOperation(Response.FromValue(new DataReplicationEmailConfigurationResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates an alert configuration setting for the given vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/alertSettings/{emailConfigurationName} + /// + /// + /// Operation Id + /// EmailConfiguration_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 email configuration name. + /// EmailConfiguration model. + /// 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 emailConfigurationName, DataReplicationEmailConfigurationData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(emailConfigurationName, nameof(emailConfigurationName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dataReplicationEmailConfigurationEmailConfigurationClientDiagnostics.CreateScope("DataReplicationEmailConfigurationCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _dataReplicationEmailConfigurationEmailConfigurationRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, emailConfigurationName, data, cancellationToken); + var operation = new RecoveryServicesDataReplicationArmOperation(Response.FromValue(new DataReplicationEmailConfigurationResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the alert configuration setting. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/alertSettings/{emailConfigurationName} + /// + /// + /// Operation Id + /// EmailConfiguration_Get + /// + /// + /// + /// The email configuration name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string emailConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(emailConfigurationName, nameof(emailConfigurationName)); + + using var scope = _dataReplicationEmailConfigurationEmailConfigurationClientDiagnostics.CreateScope("DataReplicationEmailConfigurationCollection.Get"); + scope.Start(); + try + { + var response = await _dataReplicationEmailConfigurationEmailConfigurationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, emailConfigurationName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataReplicationEmailConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the alert configuration setting. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/alertSettings/{emailConfigurationName} + /// + /// + /// Operation Id + /// EmailConfiguration_Get + /// + /// + /// + /// The email configuration name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string emailConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(emailConfigurationName, nameof(emailConfigurationName)); + + using var scope = _dataReplicationEmailConfigurationEmailConfigurationClientDiagnostics.CreateScope("DataReplicationEmailConfigurationCollection.Get"); + scope.Start(); + try + { + var response = _dataReplicationEmailConfigurationEmailConfigurationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, emailConfigurationName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataReplicationEmailConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the list of alert configuration settings for the given vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/alertSettings + /// + /// + /// Operation Id + /// EmailConfiguration_List + /// + /// + /// + /// 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) => _dataReplicationEmailConfigurationEmailConfigurationRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataReplicationEmailConfigurationEmailConfigurationRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataReplicationEmailConfigurationResource(Client, DataReplicationEmailConfigurationData.DeserializeDataReplicationEmailConfigurationData(e)), _dataReplicationEmailConfigurationEmailConfigurationClientDiagnostics, Pipeline, "DataReplicationEmailConfigurationCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the list of alert configuration settings for the given vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/alertSettings + /// + /// + /// Operation Id + /// EmailConfiguration_List + /// + /// + /// + /// 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) => _dataReplicationEmailConfigurationEmailConfigurationRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataReplicationEmailConfigurationEmailConfigurationRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataReplicationEmailConfigurationResource(Client, DataReplicationEmailConfigurationData.DeserializeDataReplicationEmailConfigurationData(e)), _dataReplicationEmailConfigurationEmailConfigurationClientDiagnostics, Pipeline, "DataReplicationEmailConfigurationCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/alertSettings/{emailConfigurationName} + /// + /// + /// Operation Id + /// EmailConfiguration_Get + /// + /// + /// + /// The email configuration name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string emailConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(emailConfigurationName, nameof(emailConfigurationName)); + + using var scope = _dataReplicationEmailConfigurationEmailConfigurationClientDiagnostics.CreateScope("DataReplicationEmailConfigurationCollection.Exists"); + scope.Start(); + try + { + var response = await _dataReplicationEmailConfigurationEmailConfigurationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, emailConfigurationName, 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.DataReplication/replicationVaults/{vaultName}/alertSettings/{emailConfigurationName} + /// + /// + /// Operation Id + /// EmailConfiguration_Get + /// + /// + /// + /// The email configuration name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string emailConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(emailConfigurationName, nameof(emailConfigurationName)); + + using var scope = _dataReplicationEmailConfigurationEmailConfigurationClientDiagnostics.CreateScope("DataReplicationEmailConfigurationCollection.Exists"); + scope.Start(); + try + { + var response = _dataReplicationEmailConfigurationEmailConfigurationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, emailConfigurationName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, 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/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationEmailConfigurationData.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationEmailConfigurationData.cs new file mode 100644 index 000000000000..3cbc9044cff8 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationEmailConfigurationData.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication +{ + /// + /// A class representing the DataReplicationEmailConfiguration data model. + /// Email configuration model. + /// + public partial class DataReplicationEmailConfigurationData : ResourceData + { + /// Initializes a new instance of DataReplicationEmailConfigurationData. + /// Email configuration model properties. + /// is null. + public DataReplicationEmailConfigurationData(DataReplicationEmailConfigurationProperties properties) + { + Argument.AssertNotNull(properties, nameof(properties)); + + Properties = properties; + } + + /// Initializes a new instance of DataReplicationEmailConfigurationData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Email configuration model properties. + internal DataReplicationEmailConfigurationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataReplicationEmailConfigurationProperties properties) : base(id, name, resourceType, systemData) + { + Properties = properties; + } + + /// Email configuration model properties. + public DataReplicationEmailConfigurationProperties Properties { get; set; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationEmailConfigurationResource.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationEmailConfigurationResource.cs new file mode 100644 index 000000000000..b5915579adf3 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationEmailConfigurationResource.cs @@ -0,0 +1,229 @@ +// 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.RecoveryServicesDataReplication +{ + /// + /// A Class representing a DataReplicationEmailConfiguration 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 GetDataReplicationEmailConfigurationResource method. + /// Otherwise you can get one from its parent resource using the GetDataReplicationEmailConfiguration method. + /// + public partial class DataReplicationEmailConfigurationResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string emailConfigurationName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/alertSettings/{emailConfigurationName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _dataReplicationEmailConfigurationEmailConfigurationClientDiagnostics; + private readonly EmailConfigurationRestOperations _dataReplicationEmailConfigurationEmailConfigurationRestClient; + private readonly DataReplicationEmailConfigurationData _data; + + /// Initializes a new instance of the class for mocking. + protected DataReplicationEmailConfigurationResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DataReplicationEmailConfigurationResource(ArmClient client, DataReplicationEmailConfigurationData 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 DataReplicationEmailConfigurationResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dataReplicationEmailConfigurationEmailConfigurationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesDataReplication", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string dataReplicationEmailConfigurationEmailConfigurationApiVersion); + _dataReplicationEmailConfigurationEmailConfigurationRestClient = new EmailConfigurationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dataReplicationEmailConfigurationEmailConfigurationApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.DataReplication/replicationVaults/alertSettings"; + + /// 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 DataReplicationEmailConfigurationData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the details of the alert configuration setting. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/alertSettings/{emailConfigurationName} + /// + /// + /// Operation Id + /// EmailConfiguration_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _dataReplicationEmailConfigurationEmailConfigurationClientDiagnostics.CreateScope("DataReplicationEmailConfigurationResource.Get"); + scope.Start(); + try + { + var response = await _dataReplicationEmailConfigurationEmailConfigurationRestClient.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 DataReplicationEmailConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the alert configuration setting. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/alertSettings/{emailConfigurationName} + /// + /// + /// Operation Id + /// EmailConfiguration_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _dataReplicationEmailConfigurationEmailConfigurationClientDiagnostics.CreateScope("DataReplicationEmailConfigurationResource.Get"); + scope.Start(); + try + { + var response = _dataReplicationEmailConfigurationEmailConfigurationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataReplicationEmailConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates an alert configuration setting for the given vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/alertSettings/{emailConfigurationName} + /// + /// + /// Operation Id + /// EmailConfiguration_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. + /// EmailConfiguration model. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, DataReplicationEmailConfigurationData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dataReplicationEmailConfigurationEmailConfigurationClientDiagnostics.CreateScope("DataReplicationEmailConfigurationResource.Update"); + scope.Start(); + try + { + var response = await _dataReplicationEmailConfigurationEmailConfigurationRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new RecoveryServicesDataReplicationArmOperation(Response.FromValue(new DataReplicationEmailConfigurationResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates an alert configuration setting for the given vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/alertSettings/{emailConfigurationName} + /// + /// + /// Operation Id + /// EmailConfiguration_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. + /// EmailConfiguration model. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, DataReplicationEmailConfigurationData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dataReplicationEmailConfigurationEmailConfigurationClientDiagnostics.CreateScope("DataReplicationEmailConfigurationResource.Update"); + scope.Start(); + try + { + var response = _dataReplicationEmailConfigurationEmailConfigurationRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new RecoveryServicesDataReplicationArmOperation(Response.FromValue(new DataReplicationEmailConfigurationResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationEventCollection.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationEventCollection.cs new file mode 100644 index 000000000000..28b0d71a2e92 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationEventCollection.cs @@ -0,0 +1,263 @@ +// 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.RecoveryServicesDataReplication +{ + /// + /// 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 GetDataReplicationEvents method from an instance of . + /// + public partial class DataReplicationEventCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _dataReplicationEventEventClientDiagnostics; + private readonly EventRestOperations _dataReplicationEventEventRestClient; + + /// Initializes a new instance of the class for mocking. + protected DataReplicationEventCollection() + { + } + + /// 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 DataReplicationEventCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dataReplicationEventEventClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesDataReplication", DataReplicationEventResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DataReplicationEventResource.ResourceType, out string dataReplicationEventEventApiVersion); + _dataReplicationEventEventRestClient = new EventRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dataReplicationEventEventApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != DataReplicationVaultResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DataReplicationVaultResource.ResourceType), nameof(id)); + } + + /// + /// Gets the details of the event. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/events/{eventName} + /// + /// + /// Operation Id + /// Event_Get + /// + /// + /// + /// The event name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string eventName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventName, nameof(eventName)); + + using var scope = _dataReplicationEventEventClientDiagnostics.CreateScope("DataReplicationEventCollection.Get"); + scope.Start(); + try + { + var response = await _dataReplicationEventEventRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, eventName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataReplicationEventResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the event. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/events/{eventName} + /// + /// + /// Operation Id + /// Event_Get + /// + /// + /// + /// The event name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string eventName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventName, nameof(eventName)); + + using var scope = _dataReplicationEventEventClientDiagnostics.CreateScope("DataReplicationEventCollection.Get"); + scope.Start(); + try + { + var response = _dataReplicationEventEventRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, eventName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataReplicationEventResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the list of events in the given vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/events + /// + /// + /// Operation Id + /// Event_List + /// + /// + /// + /// Filter string. + /// Continuation token. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, string continuationToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _dataReplicationEventEventRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, continuationToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataReplicationEventEventRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, continuationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataReplicationEventResource(Client, DataReplicationEventData.DeserializeDataReplicationEventData(e)), _dataReplicationEventEventClientDiagnostics, Pipeline, "DataReplicationEventCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the list of events in the given vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/events + /// + /// + /// Operation Id + /// Event_List + /// + /// + /// + /// Filter string. + /// Continuation token. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, string continuationToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _dataReplicationEventEventRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, continuationToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataReplicationEventEventRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, continuationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataReplicationEventResource(Client, DataReplicationEventData.DeserializeDataReplicationEventData(e)), _dataReplicationEventEventClientDiagnostics, Pipeline, "DataReplicationEventCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/events/{eventName} + /// + /// + /// Operation Id + /// Event_Get + /// + /// + /// + /// The event name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string eventName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventName, nameof(eventName)); + + using var scope = _dataReplicationEventEventClientDiagnostics.CreateScope("DataReplicationEventCollection.Exists"); + scope.Start(); + try + { + var response = await _dataReplicationEventEventRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, eventName, 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.DataReplication/replicationVaults/{vaultName}/events/{eventName} + /// + /// + /// Operation Id + /// Event_Get + /// + /// + /// + /// The event name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string eventName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventName, nameof(eventName)); + + using var scope = _dataReplicationEventEventClientDiagnostics.CreateScope("DataReplicationEventCollection.Exists"); + scope.Start(); + try + { + var response = _dataReplicationEventEventRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, eventName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, 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/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationEventData.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationEventData.cs new file mode 100644 index 000000000000..b7de19456f27 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationEventData.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication +{ + /// + /// A class representing the DataReplicationEvent data model. + /// Event model. + /// + public partial class DataReplicationEventData : ResourceData + { + /// Initializes a new instance of DataReplicationEventData. + /// Event model properties. + /// is null. + internal DataReplicationEventData(DataReplicationEventProperties properties) + { + Argument.AssertNotNull(properties, nameof(properties)); + + Properties = properties; + } + + /// Initializes a new instance of DataReplicationEventData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Event model properties. + internal DataReplicationEventData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataReplicationEventProperties properties) : base(id, name, resourceType, systemData) + { + Properties = properties; + } + + /// Event model properties. + public DataReplicationEventProperties Properties { get; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationEventResource.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationEventResource.cs new file mode 100644 index 000000000000..6f3b7533dd10 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationEventResource.cs @@ -0,0 +1,153 @@ +// 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.RecoveryServicesDataReplication +{ + /// + /// A Class representing a DataReplicationEvent 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 GetDataReplicationEventResource method. + /// Otherwise you can get one from its parent resource using the GetDataReplicationEvent method. + /// + public partial class DataReplicationEventResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string eventName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/events/{eventName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _dataReplicationEventEventClientDiagnostics; + private readonly EventRestOperations _dataReplicationEventEventRestClient; + private readonly DataReplicationEventData _data; + + /// Initializes a new instance of the class for mocking. + protected DataReplicationEventResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DataReplicationEventResource(ArmClient client, DataReplicationEventData 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 DataReplicationEventResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dataReplicationEventEventClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesDataReplication", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string dataReplicationEventEventApiVersion); + _dataReplicationEventEventRestClient = new EventRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dataReplicationEventEventApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.DataReplication/replicationVaults/events"; + + /// 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 DataReplicationEventData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the details of the event. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/events/{eventName} + /// + /// + /// Operation Id + /// Event_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _dataReplicationEventEventClientDiagnostics.CreateScope("DataReplicationEventResource.Get"); + scope.Start(); + try + { + var response = await _dataReplicationEventEventRestClient.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 DataReplicationEventResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the event. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/events/{eventName} + /// + /// + /// Operation Id + /// Event_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _dataReplicationEventEventClientDiagnostics.CreateScope("DataReplicationEventResource.Get"); + scope.Start(); + try + { + var response = _dataReplicationEventEventRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataReplicationEventResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationFabricCollection.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationFabricCollection.cs new file mode 100644 index 000000000000..99082bcff10e --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationFabricCollection.cs @@ -0,0 +1,344 @@ +// 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.RecoveryServicesDataReplication +{ + /// + /// 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 GetDataReplicationFabrics method from an instance of . + /// + public partial class DataReplicationFabricCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _dataReplicationFabricFabricClientDiagnostics; + private readonly FabricRestOperations _dataReplicationFabricFabricRestClient; + + /// Initializes a new instance of the class for mocking. + protected DataReplicationFabricCollection() + { + } + + /// 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 DataReplicationFabricCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dataReplicationFabricFabricClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesDataReplication", DataReplicationFabricResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DataReplicationFabricResource.ResourceType, out string dataReplicationFabricFabricApiVersion); + _dataReplicationFabricFabricRestClient = new FabricRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dataReplicationFabricFabricApiVersion); +#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 the fabric. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName} + /// + /// + /// Operation Id + /// Fabric_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 fabric name. + /// Fabric properties. + /// 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 fabricName, DataReplicationFabricData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fabricName, nameof(fabricName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dataReplicationFabricFabricClientDiagnostics.CreateScope("DataReplicationFabricCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _dataReplicationFabricFabricRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, fabricName, data, cancellationToken).ConfigureAwait(false); + var operation = new RecoveryServicesDataReplicationArmOperation(new DataReplicationFabricOperationSource(Client), _dataReplicationFabricFabricClientDiagnostics, Pipeline, _dataReplicationFabricFabricRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, fabricName, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates the fabric. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName} + /// + /// + /// Operation Id + /// Fabric_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 fabric name. + /// Fabric properties. + /// 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 fabricName, DataReplicationFabricData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fabricName, nameof(fabricName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dataReplicationFabricFabricClientDiagnostics.CreateScope("DataReplicationFabricCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _dataReplicationFabricFabricRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, fabricName, data, cancellationToken); + var operation = new RecoveryServicesDataReplicationArmOperation(new DataReplicationFabricOperationSource(Client), _dataReplicationFabricFabricClientDiagnostics, Pipeline, _dataReplicationFabricFabricRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, fabricName, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the fabric. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName} + /// + /// + /// Operation Id + /// Fabric_Get + /// + /// + /// + /// The fabric name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string fabricName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fabricName, nameof(fabricName)); + + using var scope = _dataReplicationFabricFabricClientDiagnostics.CreateScope("DataReplicationFabricCollection.Get"); + scope.Start(); + try + { + var response = await _dataReplicationFabricFabricRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, fabricName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataReplicationFabricResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the fabric. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName} + /// + /// + /// Operation Id + /// Fabric_Get + /// + /// + /// + /// The fabric name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string fabricName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fabricName, nameof(fabricName)); + + using var scope = _dataReplicationFabricFabricClientDiagnostics.CreateScope("DataReplicationFabricCollection.Get"); + scope.Start(); + try + { + var response = _dataReplicationFabricFabricRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, fabricName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataReplicationFabricResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the list of fabrics in the given subscription and resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics + /// + /// + /// Operation Id + /// Fabric_List + /// + /// + /// + /// Continuation token from the previous call. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string continuationToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _dataReplicationFabricFabricRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, continuationToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataReplicationFabricFabricRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, continuationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataReplicationFabricResource(Client, DataReplicationFabricData.DeserializeDataReplicationFabricData(e)), _dataReplicationFabricFabricClientDiagnostics, Pipeline, "DataReplicationFabricCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the list of fabrics in the given subscription and resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics + /// + /// + /// Operation Id + /// Fabric_List + /// + /// + /// + /// Continuation token from the previous call. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string continuationToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _dataReplicationFabricFabricRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, continuationToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataReplicationFabricFabricRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, continuationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataReplicationFabricResource(Client, DataReplicationFabricData.DeserializeDataReplicationFabricData(e)), _dataReplicationFabricFabricClientDiagnostics, Pipeline, "DataReplicationFabricCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName} + /// + /// + /// Operation Id + /// Fabric_Get + /// + /// + /// + /// The fabric name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string fabricName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fabricName, nameof(fabricName)); + + using var scope = _dataReplicationFabricFabricClientDiagnostics.CreateScope("DataReplicationFabricCollection.Exists"); + scope.Start(); + try + { + var response = await _dataReplicationFabricFabricRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, fabricName, 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.DataReplication/replicationFabrics/{fabricName} + /// + /// + /// Operation Id + /// Fabric_Get + /// + /// + /// + /// The fabric name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string fabricName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fabricName, nameof(fabricName)); + + using var scope = _dataReplicationFabricFabricClientDiagnostics.CreateScope("DataReplicationFabricCollection.Exists"); + scope.Start(); + try + { + var response = _dataReplicationFabricFabricRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, fabricName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, 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/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationFabricData.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationFabricData.cs new file mode 100644 index 000000000000..c158a7170f5a --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationFabricData.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication +{ + /// + /// A class representing the DataReplicationFabric data model. + /// Fabric model. + /// + public partial class DataReplicationFabricData : TrackedResourceData + { + /// Initializes a new instance of DataReplicationFabricData. + /// The location. + /// Fabric model properties. + /// is null. + public DataReplicationFabricData(AzureLocation location, DataReplicationFabricProperties properties) : base(location) + { + Argument.AssertNotNull(properties, nameof(properties)); + + Properties = properties; + } + + /// Initializes a new instance of DataReplicationFabricData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// Fabric model properties. + internal DataReplicationFabricData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, DataReplicationFabricProperties properties) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + } + + /// Fabric model properties. + public DataReplicationFabricProperties Properties { get; set; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationFabricResource.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationFabricResource.cs new file mode 100644 index 000000000000..0115d392e7d5 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationFabricResource.cs @@ -0,0 +1,663 @@ +// 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.RecoveryServicesDataReplication.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication +{ + /// + /// A Class representing a DataReplicationFabric 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 GetDataReplicationFabricResource method. + /// Otherwise you can get one from its parent resource using the GetDataReplicationFabric method. + /// + public partial class DataReplicationFabricResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string fabricName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _dataReplicationFabricFabricClientDiagnostics; + private readonly FabricRestOperations _dataReplicationFabricFabricRestClient; + private readonly DataReplicationFabricData _data; + + /// Initializes a new instance of the class for mocking. + protected DataReplicationFabricResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DataReplicationFabricResource(ArmClient client, DataReplicationFabricData 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 DataReplicationFabricResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dataReplicationFabricFabricClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesDataReplication", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string dataReplicationFabricFabricApiVersion); + _dataReplicationFabricFabricRestClient = new FabricRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dataReplicationFabricFabricApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.DataReplication/replicationFabrics"; + + /// 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 DataReplicationFabricData 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 DataReplicationDraResources in the DataReplicationFabric. + /// An object representing collection of DataReplicationDraResources and their operations over a DataReplicationDraResource. + public virtual DataReplicationDraCollection GetDataReplicationDras() + { + return GetCachedClient(Client => new DataReplicationDraCollection(Client, Id)); + } + + /// + /// Gets the details of the fabric agent. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName} + /// + /// + /// Operation Id + /// Dra_Get + /// + /// + /// + /// The fabric agent (Dra) name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetDataReplicationDraAsync(string fabricAgentName, CancellationToken cancellationToken = default) + { + return await GetDataReplicationDras().GetAsync(fabricAgentName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the fabric agent. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName} + /// + /// + /// Operation Id + /// Dra_Get + /// + /// + /// + /// The fabric agent (Dra) name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetDataReplicationDra(string fabricAgentName, CancellationToken cancellationToken = default) + { + return GetDataReplicationDras().Get(fabricAgentName, cancellationToken); + } + + /// + /// Gets the details of the fabric. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName} + /// + /// + /// Operation Id + /// Fabric_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _dataReplicationFabricFabricClientDiagnostics.CreateScope("DataReplicationFabricResource.Get"); + scope.Start(); + try + { + var response = await _dataReplicationFabricFabricRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataReplicationFabricResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the fabric. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName} + /// + /// + /// Operation Id + /// Fabric_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _dataReplicationFabricFabricClientDiagnostics.CreateScope("DataReplicationFabricResource.Get"); + scope.Start(); + try + { + var response = _dataReplicationFabricFabricRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataReplicationFabricResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes the fabric. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName} + /// + /// + /// Operation Id + /// Fabric_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 cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _dataReplicationFabricFabricClientDiagnostics.CreateScope("DataReplicationFabricResource.Delete"); + scope.Start(); + try + { + var response = await _dataReplicationFabricFabricRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new RecoveryServicesDataReplicationArmOperation(_dataReplicationFabricFabricClientDiagnostics, Pipeline, _dataReplicationFabricFabricRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes the fabric. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName} + /// + /// + /// Operation Id + /// Fabric_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 cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _dataReplicationFabricFabricClientDiagnostics.CreateScope("DataReplicationFabricResource.Delete"); + scope.Start(); + try + { + var response = _dataReplicationFabricFabricRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new RecoveryServicesDataReplicationArmOperation(_dataReplicationFabricFabricClientDiagnostics, Pipeline, _dataReplicationFabricFabricRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Performs update on the fabric. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName} + /// + /// + /// Operation Id + /// Fabric_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. + /// Fabric properties. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, DataReplicationFabricPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _dataReplicationFabricFabricClientDiagnostics.CreateScope("DataReplicationFabricResource.Update"); + scope.Start(); + try + { + var response = await _dataReplicationFabricFabricRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new RecoveryServicesDataReplicationArmOperation(new DataReplicationFabricOperationSource(Client), _dataReplicationFabricFabricClientDiagnostics, Pipeline, _dataReplicationFabricFabricRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Performs update on the fabric. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName} + /// + /// + /// Operation Id + /// Fabric_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. + /// Fabric properties. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, DataReplicationFabricPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _dataReplicationFabricFabricClientDiagnostics.CreateScope("DataReplicationFabricResource.Update"); + scope.Start(); + try + { + var response = _dataReplicationFabricFabricRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); + var operation = new RecoveryServicesDataReplicationArmOperation(new DataReplicationFabricOperationSource(Client), _dataReplicationFabricFabricClientDiagnostics, Pipeline, _dataReplicationFabricFabricRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName} + /// + /// + /// Operation Id + /// Fabric_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 = _dataReplicationFabricFabricClientDiagnostics.CreateScope("DataReplicationFabricResource.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 _dataReplicationFabricFabricRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DataReplicationFabricResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DataReplicationFabricPatch(); + 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.DataReplication/replicationFabrics/{fabricName} + /// + /// + /// Operation Id + /// Fabric_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 = _dataReplicationFabricFabricClientDiagnostics.CreateScope("DataReplicationFabricResource.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 = _dataReplicationFabricFabricRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new DataReplicationFabricResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DataReplicationFabricPatch(); + 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.DataReplication/replicationFabrics/{fabricName} + /// + /// + /// Operation Id + /// Fabric_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 = _dataReplicationFabricFabricClientDiagnostics.CreateScope("DataReplicationFabricResource.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 _dataReplicationFabricFabricRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DataReplicationFabricResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DataReplicationFabricPatch(); + 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.DataReplication/replicationFabrics/{fabricName} + /// + /// + /// Operation Id + /// Fabric_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 = _dataReplicationFabricFabricClientDiagnostics.CreateScope("DataReplicationFabricResource.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 = _dataReplicationFabricFabricRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new DataReplicationFabricResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DataReplicationFabricPatch(); + 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.DataReplication/replicationFabrics/{fabricName} + /// + /// + /// Operation Id + /// Fabric_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 = _dataReplicationFabricFabricClientDiagnostics.CreateScope("DataReplicationFabricResource.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 _dataReplicationFabricFabricRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DataReplicationFabricResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DataReplicationFabricPatch(); + 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.DataReplication/replicationFabrics/{fabricName} + /// + /// + /// Operation Id + /// Fabric_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 = _dataReplicationFabricFabricClientDiagnostics.CreateScope("DataReplicationFabricResource.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 = _dataReplicationFabricFabricRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new DataReplicationFabricResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DataReplicationFabricPatch(); + 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/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationPolicyCollection.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationPolicyCollection.cs new file mode 100644 index 000000000000..5e47fc007025 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationPolicyCollection.cs @@ -0,0 +1,341 @@ +// 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.RecoveryServicesDataReplication +{ + /// + /// 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 GetDataReplicationPolicies method from an instance of . + /// + public partial class DataReplicationPolicyCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _dataReplicationPolicyPolicyClientDiagnostics; + private readonly PolicyRestOperations _dataReplicationPolicyPolicyRestClient; + + /// Initializes a new instance of the class for mocking. + protected DataReplicationPolicyCollection() + { + } + + /// 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 DataReplicationPolicyCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dataReplicationPolicyPolicyClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesDataReplication", DataReplicationPolicyResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DataReplicationPolicyResource.ResourceType, out string dataReplicationPolicyPolicyApiVersion); + _dataReplicationPolicyPolicyRestClient = new PolicyRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dataReplicationPolicyPolicyApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != DataReplicationVaultResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DataReplicationVaultResource.ResourceType), nameof(id)); + } + + /// + /// Creates the policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName} + /// + /// + /// Operation Id + /// Policy_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 policy name. + /// Policy model. + /// 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 policyName, DataReplicationPolicyData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyName, nameof(policyName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dataReplicationPolicyPolicyClientDiagnostics.CreateScope("DataReplicationPolicyCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _dataReplicationPolicyPolicyRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, policyName, data, cancellationToken).ConfigureAwait(false); + var operation = new RecoveryServicesDataReplicationArmOperation(new DataReplicationPolicyOperationSource(Client), _dataReplicationPolicyPolicyClientDiagnostics, Pipeline, _dataReplicationPolicyPolicyRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, policyName, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates the policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName} + /// + /// + /// Operation Id + /// Policy_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 policy name. + /// Policy model. + /// 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 policyName, DataReplicationPolicyData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyName, nameof(policyName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dataReplicationPolicyPolicyClientDiagnostics.CreateScope("DataReplicationPolicyCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _dataReplicationPolicyPolicyRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, policyName, data, cancellationToken); + var operation = new RecoveryServicesDataReplicationArmOperation(new DataReplicationPolicyOperationSource(Client), _dataReplicationPolicyPolicyClientDiagnostics, Pipeline, _dataReplicationPolicyPolicyRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, policyName, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName} + /// + /// + /// Operation Id + /// Policy_Get + /// + /// + /// + /// The policy name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string policyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyName, nameof(policyName)); + + using var scope = _dataReplicationPolicyPolicyClientDiagnostics.CreateScope("DataReplicationPolicyCollection.Get"); + scope.Start(); + try + { + var response = await _dataReplicationPolicyPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, policyName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataReplicationPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName} + /// + /// + /// Operation Id + /// Policy_Get + /// + /// + /// + /// The policy name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string policyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyName, nameof(policyName)); + + using var scope = _dataReplicationPolicyPolicyClientDiagnostics.CreateScope("DataReplicationPolicyCollection.Get"); + scope.Start(); + try + { + var response = _dataReplicationPolicyPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, policyName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataReplicationPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the list of policies in the given vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies + /// + /// + /// Operation Id + /// Policy_List + /// + /// + /// + /// 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) => _dataReplicationPolicyPolicyRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataReplicationPolicyPolicyRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataReplicationPolicyResource(Client, DataReplicationPolicyData.DeserializeDataReplicationPolicyData(e)), _dataReplicationPolicyPolicyClientDiagnostics, Pipeline, "DataReplicationPolicyCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the list of policies in the given vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies + /// + /// + /// Operation Id + /// Policy_List + /// + /// + /// + /// 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) => _dataReplicationPolicyPolicyRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataReplicationPolicyPolicyRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataReplicationPolicyResource(Client, DataReplicationPolicyData.DeserializeDataReplicationPolicyData(e)), _dataReplicationPolicyPolicyClientDiagnostics, Pipeline, "DataReplicationPolicyCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName} + /// + /// + /// Operation Id + /// Policy_Get + /// + /// + /// + /// The policy name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string policyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyName, nameof(policyName)); + + using var scope = _dataReplicationPolicyPolicyClientDiagnostics.CreateScope("DataReplicationPolicyCollection.Exists"); + scope.Start(); + try + { + var response = await _dataReplicationPolicyPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, policyName, 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.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName} + /// + /// + /// Operation Id + /// Policy_Get + /// + /// + /// + /// The policy name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string policyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(policyName, nameof(policyName)); + + using var scope = _dataReplicationPolicyPolicyClientDiagnostics.CreateScope("DataReplicationPolicyCollection.Exists"); + scope.Start(); + try + { + var response = _dataReplicationPolicyPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, policyName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, 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/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationPolicyData.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationPolicyData.cs new file mode 100644 index 000000000000..3922136d4cfc --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationPolicyData.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication +{ + /// + /// A class representing the DataReplicationPolicy data model. + /// Policy model. + /// + public partial class DataReplicationPolicyData : ResourceData + { + /// Initializes a new instance of DataReplicationPolicyData. + /// Policy model properties. + /// is null. + public DataReplicationPolicyData(DataReplicationPolicyProperties properties) + { + Argument.AssertNotNull(properties, nameof(properties)); + + Properties = properties; + } + + /// Initializes a new instance of DataReplicationPolicyData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Policy model properties. + internal DataReplicationPolicyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataReplicationPolicyProperties properties) : base(id, name, resourceType, systemData) + { + Properties = properties; + } + + /// Policy model properties. + public DataReplicationPolicyProperties Properties { get; set; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationPolicyResource.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationPolicyResource.cs new file mode 100644 index 000000000000..07f748aa3935 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationPolicyResource.cs @@ -0,0 +1,297 @@ +// 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.RecoveryServicesDataReplication +{ + /// + /// A Class representing a DataReplicationPolicy 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 GetDataReplicationPolicyResource method. + /// Otherwise you can get one from its parent resource using the GetDataReplicationPolicy method. + /// + public partial class DataReplicationPolicyResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string policyName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _dataReplicationPolicyPolicyClientDiagnostics; + private readonly PolicyRestOperations _dataReplicationPolicyPolicyRestClient; + private readonly DataReplicationPolicyData _data; + + /// Initializes a new instance of the class for mocking. + protected DataReplicationPolicyResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DataReplicationPolicyResource(ArmClient client, DataReplicationPolicyData 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 DataReplicationPolicyResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dataReplicationPolicyPolicyClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesDataReplication", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string dataReplicationPolicyPolicyApiVersion); + _dataReplicationPolicyPolicyRestClient = new PolicyRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dataReplicationPolicyPolicyApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.DataReplication/replicationVaults/replicationPolicies"; + + /// 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 DataReplicationPolicyData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the details of the policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName} + /// + /// + /// Operation Id + /// Policy_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _dataReplicationPolicyPolicyClientDiagnostics.CreateScope("DataReplicationPolicyResource.Get"); + scope.Start(); + try + { + var response = await _dataReplicationPolicyPolicyRestClient.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 DataReplicationPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName} + /// + /// + /// Operation Id + /// Policy_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _dataReplicationPolicyPolicyClientDiagnostics.CreateScope("DataReplicationPolicyResource.Get"); + scope.Start(); + try + { + var response = _dataReplicationPolicyPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataReplicationPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes the policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName} + /// + /// + /// Operation Id + /// Policy_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 cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _dataReplicationPolicyPolicyClientDiagnostics.CreateScope("DataReplicationPolicyResource.Delete"); + scope.Start(); + try + { + var response = await _dataReplicationPolicyPolicyRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new RecoveryServicesDataReplicationArmOperation(_dataReplicationPolicyPolicyClientDiagnostics, Pipeline, _dataReplicationPolicyPolicyRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes the policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName} + /// + /// + /// Operation Id + /// Policy_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 cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _dataReplicationPolicyPolicyClientDiagnostics.CreateScope("DataReplicationPolicyResource.Delete"); + scope.Start(); + try + { + var response = _dataReplicationPolicyPolicyRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new RecoveryServicesDataReplicationArmOperation(_dataReplicationPolicyPolicyClientDiagnostics, Pipeline, _dataReplicationPolicyPolicyRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates the policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName} + /// + /// + /// Operation Id + /// Policy_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. + /// Policy model. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, DataReplicationPolicyData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dataReplicationPolicyPolicyClientDiagnostics.CreateScope("DataReplicationPolicyResource.Update"); + scope.Start(); + try + { + var response = await _dataReplicationPolicyPolicyRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new RecoveryServicesDataReplicationArmOperation(new DataReplicationPolicyOperationSource(Client), _dataReplicationPolicyPolicyClientDiagnostics, Pipeline, _dataReplicationPolicyPolicyRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates the policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName} + /// + /// + /// Operation Id + /// Policy_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. + /// Policy model. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, DataReplicationPolicyData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dataReplicationPolicyPolicyClientDiagnostics.CreateScope("DataReplicationPolicyResource.Update"); + scope.Start(); + try + { + var response = _dataReplicationPolicyPolicyRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new RecoveryServicesDataReplicationArmOperation(new DataReplicationPolicyOperationSource(Client), _dataReplicationPolicyPolicyClientDiagnostics, Pipeline, _dataReplicationPolicyPolicyRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationProtectedItemCollection.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationProtectedItemCollection.cs new file mode 100644 index 000000000000..01e4cc73d544 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationProtectedItemCollection.cs @@ -0,0 +1,341 @@ +// 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.RecoveryServicesDataReplication +{ + /// + /// 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 GetDataReplicationProtectedItems method from an instance of . + /// + public partial class DataReplicationProtectedItemCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _dataReplicationProtectedItemProtectedItemClientDiagnostics; + private readonly ProtectedItemRestOperations _dataReplicationProtectedItemProtectedItemRestClient; + + /// Initializes a new instance of the class for mocking. + protected DataReplicationProtectedItemCollection() + { + } + + /// 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 DataReplicationProtectedItemCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dataReplicationProtectedItemProtectedItemClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesDataReplication", DataReplicationProtectedItemResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DataReplicationProtectedItemResource.ResourceType, out string dataReplicationProtectedItemProtectedItemApiVersion); + _dataReplicationProtectedItemProtectedItemRestClient = new ProtectedItemRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dataReplicationProtectedItemProtectedItemApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != DataReplicationVaultResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DataReplicationVaultResource.ResourceType), nameof(id)); + } + + /// + /// Creates the protected item. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName} + /// + /// + /// Operation Id + /// ProtectedItem_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 protected item name. + /// Protected item model. + /// 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 protectedItemName, DataReplicationProtectedItemData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(protectedItemName, nameof(protectedItemName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dataReplicationProtectedItemProtectedItemClientDiagnostics.CreateScope("DataReplicationProtectedItemCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _dataReplicationProtectedItemProtectedItemRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, protectedItemName, data, cancellationToken).ConfigureAwait(false); + var operation = new RecoveryServicesDataReplicationArmOperation(new DataReplicationProtectedItemOperationSource(Client), _dataReplicationProtectedItemProtectedItemClientDiagnostics, Pipeline, _dataReplicationProtectedItemProtectedItemRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, protectedItemName, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates the protected item. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName} + /// + /// + /// Operation Id + /// ProtectedItem_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 protected item name. + /// Protected item model. + /// 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 protectedItemName, DataReplicationProtectedItemData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(protectedItemName, nameof(protectedItemName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dataReplicationProtectedItemProtectedItemClientDiagnostics.CreateScope("DataReplicationProtectedItemCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _dataReplicationProtectedItemProtectedItemRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, protectedItemName, data, cancellationToken); + var operation = new RecoveryServicesDataReplicationArmOperation(new DataReplicationProtectedItemOperationSource(Client), _dataReplicationProtectedItemProtectedItemClientDiagnostics, Pipeline, _dataReplicationProtectedItemProtectedItemRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, protectedItemName, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the protected item. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName} + /// + /// + /// Operation Id + /// ProtectedItem_Get + /// + /// + /// + /// The protected item name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string protectedItemName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(protectedItemName, nameof(protectedItemName)); + + using var scope = _dataReplicationProtectedItemProtectedItemClientDiagnostics.CreateScope("DataReplicationProtectedItemCollection.Get"); + scope.Start(); + try + { + var response = await _dataReplicationProtectedItemProtectedItemRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, protectedItemName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataReplicationProtectedItemResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the protected item. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName} + /// + /// + /// Operation Id + /// ProtectedItem_Get + /// + /// + /// + /// The protected item name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string protectedItemName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(protectedItemName, nameof(protectedItemName)); + + using var scope = _dataReplicationProtectedItemProtectedItemClientDiagnostics.CreateScope("DataReplicationProtectedItemCollection.Get"); + scope.Start(); + try + { + var response = _dataReplicationProtectedItemProtectedItemRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, protectedItemName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataReplicationProtectedItemResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the list of protected items in the given vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems + /// + /// + /// Operation Id + /// ProtectedItem_List + /// + /// + /// + /// 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) => _dataReplicationProtectedItemProtectedItemRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataReplicationProtectedItemProtectedItemRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataReplicationProtectedItemResource(Client, DataReplicationProtectedItemData.DeserializeDataReplicationProtectedItemData(e)), _dataReplicationProtectedItemProtectedItemClientDiagnostics, Pipeline, "DataReplicationProtectedItemCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the list of protected items in the given vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems + /// + /// + /// Operation Id + /// ProtectedItem_List + /// + /// + /// + /// 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) => _dataReplicationProtectedItemProtectedItemRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataReplicationProtectedItemProtectedItemRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataReplicationProtectedItemResource(Client, DataReplicationProtectedItemData.DeserializeDataReplicationProtectedItemData(e)), _dataReplicationProtectedItemProtectedItemClientDiagnostics, Pipeline, "DataReplicationProtectedItemCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName} + /// + /// + /// Operation Id + /// ProtectedItem_Get + /// + /// + /// + /// The protected item name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string protectedItemName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(protectedItemName, nameof(protectedItemName)); + + using var scope = _dataReplicationProtectedItemProtectedItemClientDiagnostics.CreateScope("DataReplicationProtectedItemCollection.Exists"); + scope.Start(); + try + { + var response = await _dataReplicationProtectedItemProtectedItemRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, protectedItemName, 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.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName} + /// + /// + /// Operation Id + /// ProtectedItem_Get + /// + /// + /// + /// The protected item name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string protectedItemName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(protectedItemName, nameof(protectedItemName)); + + using var scope = _dataReplicationProtectedItemProtectedItemClientDiagnostics.CreateScope("DataReplicationProtectedItemCollection.Exists"); + scope.Start(); + try + { + var response = _dataReplicationProtectedItemProtectedItemRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, protectedItemName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, 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/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationProtectedItemData.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationProtectedItemData.cs new file mode 100644 index 000000000000..bd318092861a --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationProtectedItemData.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication +{ + /// + /// A class representing the DataReplicationProtectedItem data model. + /// Protected item model. + /// + public partial class DataReplicationProtectedItemData : ResourceData + { + /// Initializes a new instance of DataReplicationProtectedItemData. + /// Protected item model properties. + /// is null. + public DataReplicationProtectedItemData(DataReplicationProtectedItemProperties properties) + { + Argument.AssertNotNull(properties, nameof(properties)); + + Properties = properties; + } + + /// Initializes a new instance of DataReplicationProtectedItemData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Protected item model properties. + internal DataReplicationProtectedItemData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataReplicationProtectedItemProperties properties) : base(id, name, resourceType, systemData) + { + Properties = properties; + } + + /// Protected item model properties. + public DataReplicationProtectedItemProperties Properties { get; set; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationProtectedItemResource.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationProtectedItemResource.cs new file mode 100644 index 000000000000..29efc9f05ed8 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationProtectedItemResource.cs @@ -0,0 +1,423 @@ +// 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.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication +{ + /// + /// A Class representing a DataReplicationProtectedItem 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 GetDataReplicationProtectedItemResource method. + /// Otherwise you can get one from its parent resource using the GetDataReplicationProtectedItem method. + /// + public partial class DataReplicationProtectedItemResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string protectedItemName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _dataReplicationProtectedItemProtectedItemClientDiagnostics; + private readonly ProtectedItemRestOperations _dataReplicationProtectedItemProtectedItemRestClient; + private readonly DataReplicationProtectedItemData _data; + + /// Initializes a new instance of the class for mocking. + protected DataReplicationProtectedItemResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DataReplicationProtectedItemResource(ArmClient client, DataReplicationProtectedItemData 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 DataReplicationProtectedItemResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dataReplicationProtectedItemProtectedItemClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesDataReplication", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string dataReplicationProtectedItemProtectedItemApiVersion); + _dataReplicationProtectedItemProtectedItemRestClient = new ProtectedItemRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dataReplicationProtectedItemProtectedItemApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.DataReplication/replicationVaults/protectedItems"; + + /// 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 DataReplicationProtectedItemData 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 DataReplicationRecoveryPointResources in the DataReplicationProtectedItem. + /// An object representing collection of DataReplicationRecoveryPointResources and their operations over a DataReplicationRecoveryPointResource. + public virtual DataReplicationRecoveryPointCollection GetDataReplicationRecoveryPoints() + { + return GetCachedClient(Client => new DataReplicationRecoveryPointCollection(Client, Id)); + } + + /// + /// Gets the details of the recovery point of a protected item. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointName} + /// + /// + /// Operation Id + /// RecoveryPoints_Get + /// + /// + /// + /// The recovery point name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetDataReplicationRecoveryPointAsync(string recoveryPointName, CancellationToken cancellationToken = default) + { + return await GetDataReplicationRecoveryPoints().GetAsync(recoveryPointName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the recovery point of a protected item. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointName} + /// + /// + /// Operation Id + /// RecoveryPoints_Get + /// + /// + /// + /// The recovery point name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetDataReplicationRecoveryPoint(string recoveryPointName, CancellationToken cancellationToken = default) + { + return GetDataReplicationRecoveryPoints().Get(recoveryPointName, cancellationToken); + } + + /// + /// Gets the details of the protected item. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName} + /// + /// + /// Operation Id + /// ProtectedItem_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _dataReplicationProtectedItemProtectedItemClientDiagnostics.CreateScope("DataReplicationProtectedItemResource.Get"); + scope.Start(); + try + { + var response = await _dataReplicationProtectedItemProtectedItemRestClient.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 DataReplicationProtectedItemResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the protected item. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName} + /// + /// + /// Operation Id + /// ProtectedItem_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _dataReplicationProtectedItemProtectedItemClientDiagnostics.CreateScope("DataReplicationProtectedItemResource.Get"); + scope.Start(); + try + { + var response = _dataReplicationProtectedItemProtectedItemRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataReplicationProtectedItemResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes the protected item. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName} + /// + /// + /// Operation Id + /// ProtectedItem_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. + /// A flag indicating whether to do force delete or not. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, bool? forceDelete = null, CancellationToken cancellationToken = default) + { + using var scope = _dataReplicationProtectedItemProtectedItemClientDiagnostics.CreateScope("DataReplicationProtectedItemResource.Delete"); + scope.Start(); + try + { + var response = await _dataReplicationProtectedItemProtectedItemRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, forceDelete, cancellationToken).ConfigureAwait(false); + var operation = new RecoveryServicesDataReplicationArmOperation(_dataReplicationProtectedItemProtectedItemClientDiagnostics, Pipeline, _dataReplicationProtectedItemProtectedItemRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, forceDelete).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes the protected item. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName} + /// + /// + /// Operation Id + /// ProtectedItem_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. + /// A flag indicating whether to do force delete or not. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, bool? forceDelete = null, CancellationToken cancellationToken = default) + { + using var scope = _dataReplicationProtectedItemProtectedItemClientDiagnostics.CreateScope("DataReplicationProtectedItemResource.Delete"); + scope.Start(); + try + { + var response = _dataReplicationProtectedItemProtectedItemRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, forceDelete, cancellationToken); + var operation = new RecoveryServicesDataReplicationArmOperation(_dataReplicationProtectedItemProtectedItemClientDiagnostics, Pipeline, _dataReplicationProtectedItemProtectedItemRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, forceDelete).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates the protected item. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName} + /// + /// + /// Operation Id + /// ProtectedItem_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. + /// Protected item model. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, DataReplicationProtectedItemData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dataReplicationProtectedItemProtectedItemClientDiagnostics.CreateScope("DataReplicationProtectedItemResource.Update"); + scope.Start(); + try + { + var response = await _dataReplicationProtectedItemProtectedItemRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new RecoveryServicesDataReplicationArmOperation(new DataReplicationProtectedItemOperationSource(Client), _dataReplicationProtectedItemProtectedItemClientDiagnostics, Pipeline, _dataReplicationProtectedItemProtectedItemRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates the protected item. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName} + /// + /// + /// Operation Id + /// ProtectedItem_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. + /// Protected item model. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, DataReplicationProtectedItemData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dataReplicationProtectedItemProtectedItemClientDiagnostics.CreateScope("DataReplicationProtectedItemResource.Update"); + scope.Start(); + try + { + var response = _dataReplicationProtectedItemProtectedItemRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new RecoveryServicesDataReplicationArmOperation(new DataReplicationProtectedItemOperationSource(Client), _dataReplicationProtectedItemProtectedItemClientDiagnostics, Pipeline, _dataReplicationProtectedItemProtectedItemRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Performs the planned failover on the protected item. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/plannedFailover + /// + /// + /// Operation Id + /// ProtectedItem_PlannedFailover + /// + /// + /// + /// 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. + /// Planned failover model. + /// The cancellation token to use. + public virtual async Task> PlannedFailoverAsync(WaitUntil waitUntil, PlannedFailoverModel body = null, CancellationToken cancellationToken = default) + { + using var scope = _dataReplicationProtectedItemProtectedItemClientDiagnostics.CreateScope("DataReplicationProtectedItemResource.PlannedFailover"); + scope.Start(); + try + { + var response = await _dataReplicationProtectedItemProtectedItemRestClient.PlannedFailoverAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, body, cancellationToken).ConfigureAwait(false); + var operation = new RecoveryServicesDataReplicationArmOperation(new PlannedFailoverModelOperationSource(), _dataReplicationProtectedItemProtectedItemClientDiagnostics, Pipeline, _dataReplicationProtectedItemProtectedItemRestClient.CreatePlannedFailoverRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, body).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Performs the planned failover on the protected item. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/plannedFailover + /// + /// + /// Operation Id + /// ProtectedItem_PlannedFailover + /// + /// + /// + /// 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. + /// Planned failover model. + /// The cancellation token to use. + public virtual ArmOperation PlannedFailover(WaitUntil waitUntil, PlannedFailoverModel body = null, CancellationToken cancellationToken = default) + { + using var scope = _dataReplicationProtectedItemProtectedItemClientDiagnostics.CreateScope("DataReplicationProtectedItemResource.PlannedFailover"); + scope.Start(); + try + { + var response = _dataReplicationProtectedItemProtectedItemRestClient.PlannedFailover(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, body, cancellationToken); + var operation = new RecoveryServicesDataReplicationArmOperation(new PlannedFailoverModelOperationSource(), _dataReplicationProtectedItemProtectedItemClientDiagnostics, Pipeline, _dataReplicationProtectedItemProtectedItemRestClient.CreatePlannedFailoverRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, body).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationRecoveryPointCollection.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationRecoveryPointCollection.cs new file mode 100644 index 000000000000..701a6d5daae2 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationRecoveryPointCollection.cs @@ -0,0 +1,259 @@ +// 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.RecoveryServicesDataReplication +{ + /// + /// 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 GetDataReplicationRecoveryPoints method from an instance of . + /// + public partial class DataReplicationRecoveryPointCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _dataReplicationRecoveryPointRecoveryPointsClientDiagnostics; + private readonly RecoveryPointsRestOperations _dataReplicationRecoveryPointRecoveryPointsRestClient; + + /// Initializes a new instance of the class for mocking. + protected DataReplicationRecoveryPointCollection() + { + } + + /// 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 DataReplicationRecoveryPointCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dataReplicationRecoveryPointRecoveryPointsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesDataReplication", DataReplicationRecoveryPointResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DataReplicationRecoveryPointResource.ResourceType, out string dataReplicationRecoveryPointRecoveryPointsApiVersion); + _dataReplicationRecoveryPointRecoveryPointsRestClient = new RecoveryPointsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dataReplicationRecoveryPointRecoveryPointsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != DataReplicationProtectedItemResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DataReplicationProtectedItemResource.ResourceType), nameof(id)); + } + + /// + /// Gets the details of the recovery point of a protected item. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointName} + /// + /// + /// Operation Id + /// RecoveryPoints_Get + /// + /// + /// + /// The recovery point name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string recoveryPointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(recoveryPointName, nameof(recoveryPointName)); + + using var scope = _dataReplicationRecoveryPointRecoveryPointsClientDiagnostics.CreateScope("DataReplicationRecoveryPointCollection.Get"); + scope.Start(); + try + { + var response = await _dataReplicationRecoveryPointRecoveryPointsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, recoveryPointName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataReplicationRecoveryPointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the recovery point of a protected item. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointName} + /// + /// + /// Operation Id + /// RecoveryPoints_Get + /// + /// + /// + /// The recovery point name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string recoveryPointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(recoveryPointName, nameof(recoveryPointName)); + + using var scope = _dataReplicationRecoveryPointRecoveryPointsClientDiagnostics.CreateScope("DataReplicationRecoveryPointCollection.Get"); + scope.Start(); + try + { + var response = _dataReplicationRecoveryPointRecoveryPointsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, recoveryPointName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataReplicationRecoveryPointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the list of recovery points of the given protected item. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/recoveryPoints + /// + /// + /// Operation Id + /// RecoveryPoints_List + /// + /// + /// + /// 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) => _dataReplicationRecoveryPointRecoveryPointsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataReplicationRecoveryPointRecoveryPointsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataReplicationRecoveryPointResource(Client, DataReplicationRecoveryPointData.DeserializeDataReplicationRecoveryPointData(e)), _dataReplicationRecoveryPointRecoveryPointsClientDiagnostics, Pipeline, "DataReplicationRecoveryPointCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the list of recovery points of the given protected item. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/recoveryPoints + /// + /// + /// Operation Id + /// RecoveryPoints_List + /// + /// + /// + /// 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) => _dataReplicationRecoveryPointRecoveryPointsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataReplicationRecoveryPointRecoveryPointsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataReplicationRecoveryPointResource(Client, DataReplicationRecoveryPointData.DeserializeDataReplicationRecoveryPointData(e)), _dataReplicationRecoveryPointRecoveryPointsClientDiagnostics, Pipeline, "DataReplicationRecoveryPointCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointName} + /// + /// + /// Operation Id + /// RecoveryPoints_Get + /// + /// + /// + /// The recovery point name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string recoveryPointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(recoveryPointName, nameof(recoveryPointName)); + + using var scope = _dataReplicationRecoveryPointRecoveryPointsClientDiagnostics.CreateScope("DataReplicationRecoveryPointCollection.Exists"); + scope.Start(); + try + { + var response = await _dataReplicationRecoveryPointRecoveryPointsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, recoveryPointName, 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.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointName} + /// + /// + /// Operation Id + /// RecoveryPoints_Get + /// + /// + /// + /// The recovery point name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string recoveryPointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(recoveryPointName, nameof(recoveryPointName)); + + using var scope = _dataReplicationRecoveryPointRecoveryPointsClientDiagnostics.CreateScope("DataReplicationRecoveryPointCollection.Exists"); + scope.Start(); + try + { + var response = _dataReplicationRecoveryPointRecoveryPointsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, recoveryPointName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, 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/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationRecoveryPointData.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationRecoveryPointData.cs new file mode 100644 index 000000000000..059d35bb057e --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationRecoveryPointData.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication +{ + /// + /// A class representing the DataReplicationRecoveryPoint data model. + /// Recovery point model. + /// + public partial class DataReplicationRecoveryPointData : ResourceData + { + /// Initializes a new instance of DataReplicationRecoveryPointData. + /// Recovery point model properties. + /// is null. + internal DataReplicationRecoveryPointData(DataReplicationRecoveryPointProperties properties) + { + Argument.AssertNotNull(properties, nameof(properties)); + + Properties = properties; + } + + /// Initializes a new instance of DataReplicationRecoveryPointData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Recovery point model properties. + internal DataReplicationRecoveryPointData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataReplicationRecoveryPointProperties properties) : base(id, name, resourceType, systemData) + { + Properties = properties; + } + + /// Recovery point model properties. + public DataReplicationRecoveryPointProperties Properties { get; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationRecoveryPointResource.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationRecoveryPointResource.cs new file mode 100644 index 000000000000..610d80e69fcb --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationRecoveryPointResource.cs @@ -0,0 +1,153 @@ +// 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.RecoveryServicesDataReplication +{ + /// + /// A Class representing a DataReplicationRecoveryPoint 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 GetDataReplicationRecoveryPointResource method. + /// Otherwise you can get one from its parent resource using the GetDataReplicationRecoveryPoint method. + /// + public partial class DataReplicationRecoveryPointResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string protectedItemName, string recoveryPointName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _dataReplicationRecoveryPointRecoveryPointsClientDiagnostics; + private readonly RecoveryPointsRestOperations _dataReplicationRecoveryPointRecoveryPointsRestClient; + private readonly DataReplicationRecoveryPointData _data; + + /// Initializes a new instance of the class for mocking. + protected DataReplicationRecoveryPointResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DataReplicationRecoveryPointResource(ArmClient client, DataReplicationRecoveryPointData 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 DataReplicationRecoveryPointResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dataReplicationRecoveryPointRecoveryPointsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesDataReplication", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string dataReplicationRecoveryPointRecoveryPointsApiVersion); + _dataReplicationRecoveryPointRecoveryPointsRestClient = new RecoveryPointsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dataReplicationRecoveryPointRecoveryPointsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.DataReplication/replicationVaults/protectedItems/recoveryPoints"; + + /// 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 DataReplicationRecoveryPointData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the details of the recovery point of a protected item. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointName} + /// + /// + /// Operation Id + /// RecoveryPoints_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _dataReplicationRecoveryPointRecoveryPointsClientDiagnostics.CreateScope("DataReplicationRecoveryPointResource.Get"); + scope.Start(); + try + { + var response = await _dataReplicationRecoveryPointRecoveryPointsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataReplicationRecoveryPointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the recovery point of a protected item. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointName} + /// + /// + /// Operation Id + /// RecoveryPoints_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _dataReplicationRecoveryPointRecoveryPointsClientDiagnostics.CreateScope("DataReplicationRecoveryPointResource.Get"); + scope.Start(); + try + { + var response = _dataReplicationRecoveryPointRecoveryPointsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataReplicationRecoveryPointResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationReplicationExtensionCollection.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationReplicationExtensionCollection.cs new file mode 100644 index 000000000000..5f7eda7fb26f --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationReplicationExtensionCollection.cs @@ -0,0 +1,341 @@ +// 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.RecoveryServicesDataReplication +{ + /// + /// 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 GetDataReplicationReplicationExtensions method from an instance of . + /// + public partial class DataReplicationReplicationExtensionCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _dataReplicationReplicationExtensionReplicationExtensionClientDiagnostics; + private readonly ReplicationExtensionRestOperations _dataReplicationReplicationExtensionReplicationExtensionRestClient; + + /// Initializes a new instance of the class for mocking. + protected DataReplicationReplicationExtensionCollection() + { + } + + /// 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 DataReplicationReplicationExtensionCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dataReplicationReplicationExtensionReplicationExtensionClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesDataReplication", DataReplicationReplicationExtensionResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DataReplicationReplicationExtensionResource.ResourceType, out string dataReplicationReplicationExtensionReplicationExtensionApiVersion); + _dataReplicationReplicationExtensionReplicationExtensionRestClient = new ReplicationExtensionRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dataReplicationReplicationExtensionReplicationExtensionApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != DataReplicationVaultResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DataReplicationVaultResource.ResourceType), nameof(id)); + } + + /// + /// Creates the replication extension in the given vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName} + /// + /// + /// Operation Id + /// ReplicationExtension_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 replication extension name. + /// Replication extension model. + /// 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 replicationExtensionName, DataReplicationReplicationExtensionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(replicationExtensionName, nameof(replicationExtensionName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dataReplicationReplicationExtensionReplicationExtensionClientDiagnostics.CreateScope("DataReplicationReplicationExtensionCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _dataReplicationReplicationExtensionReplicationExtensionRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, replicationExtensionName, data, cancellationToken).ConfigureAwait(false); + var operation = new RecoveryServicesDataReplicationArmOperation(new DataReplicationReplicationExtensionOperationSource(Client), _dataReplicationReplicationExtensionReplicationExtensionClientDiagnostics, Pipeline, _dataReplicationReplicationExtensionReplicationExtensionRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, replicationExtensionName, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates the replication extension in the given vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName} + /// + /// + /// Operation Id + /// ReplicationExtension_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 replication extension name. + /// Replication extension model. + /// 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 replicationExtensionName, DataReplicationReplicationExtensionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(replicationExtensionName, nameof(replicationExtensionName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dataReplicationReplicationExtensionReplicationExtensionClientDiagnostics.CreateScope("DataReplicationReplicationExtensionCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _dataReplicationReplicationExtensionReplicationExtensionRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, replicationExtensionName, data, cancellationToken); + var operation = new RecoveryServicesDataReplicationArmOperation(new DataReplicationReplicationExtensionOperationSource(Client), _dataReplicationReplicationExtensionReplicationExtensionClientDiagnostics, Pipeline, _dataReplicationReplicationExtensionReplicationExtensionRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, replicationExtensionName, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the replication extension. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName} + /// + /// + /// Operation Id + /// ReplicationExtension_Get + /// + /// + /// + /// The replication extension name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string replicationExtensionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(replicationExtensionName, nameof(replicationExtensionName)); + + using var scope = _dataReplicationReplicationExtensionReplicationExtensionClientDiagnostics.CreateScope("DataReplicationReplicationExtensionCollection.Get"); + scope.Start(); + try + { + var response = await _dataReplicationReplicationExtensionReplicationExtensionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, replicationExtensionName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataReplicationReplicationExtensionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the replication extension. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName} + /// + /// + /// Operation Id + /// ReplicationExtension_Get + /// + /// + /// + /// The replication extension name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string replicationExtensionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(replicationExtensionName, nameof(replicationExtensionName)); + + using var scope = _dataReplicationReplicationExtensionReplicationExtensionClientDiagnostics.CreateScope("DataReplicationReplicationExtensionCollection.Get"); + scope.Start(); + try + { + var response = _dataReplicationReplicationExtensionReplicationExtensionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, replicationExtensionName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataReplicationReplicationExtensionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the list of replication extensions in the given vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions + /// + /// + /// Operation Id + /// ReplicationExtension_List + /// + /// + /// + /// 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) => _dataReplicationReplicationExtensionReplicationExtensionRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataReplicationReplicationExtensionReplicationExtensionRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataReplicationReplicationExtensionResource(Client, DataReplicationReplicationExtensionData.DeserializeDataReplicationReplicationExtensionData(e)), _dataReplicationReplicationExtensionReplicationExtensionClientDiagnostics, Pipeline, "DataReplicationReplicationExtensionCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the list of replication extensions in the given vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions + /// + /// + /// Operation Id + /// ReplicationExtension_List + /// + /// + /// + /// 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) => _dataReplicationReplicationExtensionReplicationExtensionRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataReplicationReplicationExtensionReplicationExtensionRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataReplicationReplicationExtensionResource(Client, DataReplicationReplicationExtensionData.DeserializeDataReplicationReplicationExtensionData(e)), _dataReplicationReplicationExtensionReplicationExtensionClientDiagnostics, Pipeline, "DataReplicationReplicationExtensionCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName} + /// + /// + /// Operation Id + /// ReplicationExtension_Get + /// + /// + /// + /// The replication extension name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string replicationExtensionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(replicationExtensionName, nameof(replicationExtensionName)); + + using var scope = _dataReplicationReplicationExtensionReplicationExtensionClientDiagnostics.CreateScope("DataReplicationReplicationExtensionCollection.Exists"); + scope.Start(); + try + { + var response = await _dataReplicationReplicationExtensionReplicationExtensionRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, replicationExtensionName, 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.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName} + /// + /// + /// Operation Id + /// ReplicationExtension_Get + /// + /// + /// + /// The replication extension name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string replicationExtensionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(replicationExtensionName, nameof(replicationExtensionName)); + + using var scope = _dataReplicationReplicationExtensionReplicationExtensionClientDiagnostics.CreateScope("DataReplicationReplicationExtensionCollection.Exists"); + scope.Start(); + try + { + var response = _dataReplicationReplicationExtensionReplicationExtensionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, replicationExtensionName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, 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/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationReplicationExtensionData.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationReplicationExtensionData.cs new file mode 100644 index 000000000000..dfae54465361 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationReplicationExtensionData.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication +{ + /// + /// A class representing the DataReplicationReplicationExtension data model. + /// Replication extension model. + /// + public partial class DataReplicationReplicationExtensionData : ResourceData + { + /// Initializes a new instance of DataReplicationReplicationExtensionData. + /// Replication extension model properties. + /// is null. + public DataReplicationReplicationExtensionData(DataReplicationReplicationExtensionProperties properties) + { + Argument.AssertNotNull(properties, nameof(properties)); + + Properties = properties; + } + + /// Initializes a new instance of DataReplicationReplicationExtensionData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Replication extension model properties. + internal DataReplicationReplicationExtensionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataReplicationReplicationExtensionProperties properties) : base(id, name, resourceType, systemData) + { + Properties = properties; + } + + /// Replication extension model properties. + public DataReplicationReplicationExtensionProperties Properties { get; set; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationReplicationExtensionResource.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationReplicationExtensionResource.cs new file mode 100644 index 000000000000..8263c6ea2c78 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationReplicationExtensionResource.cs @@ -0,0 +1,297 @@ +// 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.RecoveryServicesDataReplication +{ + /// + /// A Class representing a DataReplicationReplicationExtension 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 GetDataReplicationReplicationExtensionResource method. + /// Otherwise you can get one from its parent resource using the GetDataReplicationReplicationExtension method. + /// + public partial class DataReplicationReplicationExtensionResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string replicationExtensionName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _dataReplicationReplicationExtensionReplicationExtensionClientDiagnostics; + private readonly ReplicationExtensionRestOperations _dataReplicationReplicationExtensionReplicationExtensionRestClient; + private readonly DataReplicationReplicationExtensionData _data; + + /// Initializes a new instance of the class for mocking. + protected DataReplicationReplicationExtensionResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DataReplicationReplicationExtensionResource(ArmClient client, DataReplicationReplicationExtensionData 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 DataReplicationReplicationExtensionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dataReplicationReplicationExtensionReplicationExtensionClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesDataReplication", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string dataReplicationReplicationExtensionReplicationExtensionApiVersion); + _dataReplicationReplicationExtensionReplicationExtensionRestClient = new ReplicationExtensionRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dataReplicationReplicationExtensionReplicationExtensionApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.DataReplication/replicationVaults/replicationExtensions"; + + /// 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 DataReplicationReplicationExtensionData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the details of the replication extension. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName} + /// + /// + /// Operation Id + /// ReplicationExtension_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _dataReplicationReplicationExtensionReplicationExtensionClientDiagnostics.CreateScope("DataReplicationReplicationExtensionResource.Get"); + scope.Start(); + try + { + var response = await _dataReplicationReplicationExtensionReplicationExtensionRestClient.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 DataReplicationReplicationExtensionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the replication extension. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName} + /// + /// + /// Operation Id + /// ReplicationExtension_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _dataReplicationReplicationExtensionReplicationExtensionClientDiagnostics.CreateScope("DataReplicationReplicationExtensionResource.Get"); + scope.Start(); + try + { + var response = _dataReplicationReplicationExtensionReplicationExtensionRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataReplicationReplicationExtensionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the replication extension in the given vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName} + /// + /// + /// Operation Id + /// ReplicationExtension_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 cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _dataReplicationReplicationExtensionReplicationExtensionClientDiagnostics.CreateScope("DataReplicationReplicationExtensionResource.Delete"); + scope.Start(); + try + { + var response = await _dataReplicationReplicationExtensionReplicationExtensionRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new RecoveryServicesDataReplicationArmOperation(_dataReplicationReplicationExtensionReplicationExtensionClientDiagnostics, Pipeline, _dataReplicationReplicationExtensionReplicationExtensionRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the replication extension in the given vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName} + /// + /// + /// Operation Id + /// ReplicationExtension_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 cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _dataReplicationReplicationExtensionReplicationExtensionClientDiagnostics.CreateScope("DataReplicationReplicationExtensionResource.Delete"); + scope.Start(); + try + { + var response = _dataReplicationReplicationExtensionReplicationExtensionRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new RecoveryServicesDataReplicationArmOperation(_dataReplicationReplicationExtensionReplicationExtensionClientDiagnostics, Pipeline, _dataReplicationReplicationExtensionReplicationExtensionRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates the replication extension in the given vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName} + /// + /// + /// Operation Id + /// ReplicationExtension_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. + /// Replication extension model. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, DataReplicationReplicationExtensionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dataReplicationReplicationExtensionReplicationExtensionClientDiagnostics.CreateScope("DataReplicationReplicationExtensionResource.Update"); + scope.Start(); + try + { + var response = await _dataReplicationReplicationExtensionReplicationExtensionRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new RecoveryServicesDataReplicationArmOperation(new DataReplicationReplicationExtensionOperationSource(Client), _dataReplicationReplicationExtensionReplicationExtensionClientDiagnostics, Pipeline, _dataReplicationReplicationExtensionReplicationExtensionRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates the replication extension in the given vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName} + /// + /// + /// Operation Id + /// ReplicationExtension_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. + /// Replication extension model. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, DataReplicationReplicationExtensionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dataReplicationReplicationExtensionReplicationExtensionClientDiagnostics.CreateScope("DataReplicationReplicationExtensionResource.Update"); + scope.Start(); + try + { + var response = _dataReplicationReplicationExtensionReplicationExtensionRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new RecoveryServicesDataReplicationArmOperation(new DataReplicationReplicationExtensionOperationSource(Client), _dataReplicationReplicationExtensionReplicationExtensionClientDiagnostics, Pipeline, _dataReplicationReplicationExtensionReplicationExtensionRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationVaultCollection.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationVaultCollection.cs new file mode 100644 index 000000000000..dd5c283abca5 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationVaultCollection.cs @@ -0,0 +1,344 @@ +// 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.RecoveryServicesDataReplication +{ + /// + /// 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 GetDataReplicationVaults method from an instance of . + /// + public partial class DataReplicationVaultCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _dataReplicationVaultVaultClientDiagnostics; + private readonly VaultRestOperations _dataReplicationVaultVaultRestClient; + + /// Initializes a new instance of the class for mocking. + protected DataReplicationVaultCollection() + { + } + + /// 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 DataReplicationVaultCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dataReplicationVaultVaultClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesDataReplication", DataReplicationVaultResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DataReplicationVaultResource.ResourceType, out string dataReplicationVaultVaultApiVersion); + _dataReplicationVaultVaultRestClient = new VaultRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dataReplicationVaultVaultApiVersion); +#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 the vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName} + /// + /// + /// Operation Id + /// Vault_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 vault name. + /// Vault properties. + /// 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 vaultName, DataReplicationVaultData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dataReplicationVaultVaultClientDiagnostics.CreateScope("DataReplicationVaultCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _dataReplicationVaultVaultRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, vaultName, data, cancellationToken).ConfigureAwait(false); + var operation = new RecoveryServicesDataReplicationArmOperation(new DataReplicationVaultOperationSource(Client), _dataReplicationVaultVaultClientDiagnostics, Pipeline, _dataReplicationVaultVaultRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, vaultName, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates the vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName} + /// + /// + /// Operation Id + /// Vault_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 vault name. + /// Vault properties. + /// 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 vaultName, DataReplicationVaultData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dataReplicationVaultVaultClientDiagnostics.CreateScope("DataReplicationVaultCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _dataReplicationVaultVaultRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, vaultName, data, cancellationToken); + var operation = new RecoveryServicesDataReplicationArmOperation(new DataReplicationVaultOperationSource(Client), _dataReplicationVaultVaultClientDiagnostics, Pipeline, _dataReplicationVaultVaultRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, vaultName, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName} + /// + /// + /// Operation Id + /// Vault_Get + /// + /// + /// + /// The vault name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var scope = _dataReplicationVaultVaultClientDiagnostics.CreateScope("DataReplicationVaultCollection.Get"); + scope.Start(); + try + { + var response = await _dataReplicationVaultVaultRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, vaultName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataReplicationVaultResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName} + /// + /// + /// Operation Id + /// Vault_Get + /// + /// + /// + /// The vault name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var scope = _dataReplicationVaultVaultClientDiagnostics.CreateScope("DataReplicationVaultCollection.Get"); + scope.Start(); + try + { + var response = _dataReplicationVaultVaultRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, vaultName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataReplicationVaultResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the list of vaults in the given subscription and resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults + /// + /// + /// Operation Id + /// Vault_List + /// + /// + /// + /// Continuation token from the previous call. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string continuationToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _dataReplicationVaultVaultRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, continuationToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataReplicationVaultVaultRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, continuationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataReplicationVaultResource(Client, DataReplicationVaultData.DeserializeDataReplicationVaultData(e)), _dataReplicationVaultVaultClientDiagnostics, Pipeline, "DataReplicationVaultCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the list of vaults in the given subscription and resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults + /// + /// + /// Operation Id + /// Vault_List + /// + /// + /// + /// Continuation token from the previous call. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string continuationToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _dataReplicationVaultVaultRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, continuationToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataReplicationVaultVaultRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, continuationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataReplicationVaultResource(Client, DataReplicationVaultData.DeserializeDataReplicationVaultData(e)), _dataReplicationVaultVaultClientDiagnostics, Pipeline, "DataReplicationVaultCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName} + /// + /// + /// Operation Id + /// Vault_Get + /// + /// + /// + /// The vault name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var scope = _dataReplicationVaultVaultClientDiagnostics.CreateScope("DataReplicationVaultCollection.Exists"); + scope.Start(); + try + { + var response = await _dataReplicationVaultVaultRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, vaultName, 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.DataReplication/replicationVaults/{vaultName} + /// + /// + /// Operation Id + /// Vault_Get + /// + /// + /// + /// The vault name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var scope = _dataReplicationVaultVaultClientDiagnostics.CreateScope("DataReplicationVaultCollection.Exists"); + scope.Start(); + try + { + var response = _dataReplicationVaultVaultRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, vaultName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, 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/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationVaultData.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationVaultData.cs new file mode 100644 index 000000000000..81d16c83bc3b --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationVaultData.cs @@ -0,0 +1,43 @@ +// 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; +using Azure.ResourceManager.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication +{ + /// + /// A class representing the DataReplicationVault data model. + /// Vault model. + /// + public partial class DataReplicationVaultData : TrackedResourceData + { + /// Initializes a new instance of DataReplicationVaultData. + /// The location. + public DataReplicationVaultData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of DataReplicationVaultData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// Vault properties. + internal DataReplicationVaultData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, DataReplicationVaultProperties properties) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + } + + /// Vault properties. + public DataReplicationVaultProperties Properties { get; set; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationVaultResource.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationVaultResource.cs new file mode 100644 index 000000000000..2c48bd5d8a6f --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationVaultResource.cs @@ -0,0 +1,928 @@ +// 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.RecoveryServicesDataReplication.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication +{ + /// + /// A Class representing a DataReplicationVault 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 GetDataReplicationVaultResource method. + /// Otherwise you can get one from its parent resource using the GetDataReplicationVault method. + /// + public partial class DataReplicationVaultResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _dataReplicationVaultVaultClientDiagnostics; + private readonly VaultRestOperations _dataReplicationVaultVaultRestClient; + private readonly DataReplicationVaultData _data; + + /// Initializes a new instance of the class for mocking. + protected DataReplicationVaultResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DataReplicationVaultResource(ArmClient client, DataReplicationVaultData 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 DataReplicationVaultResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dataReplicationVaultVaultClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesDataReplication", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string dataReplicationVaultVaultApiVersion); + _dataReplicationVaultVaultRestClient = new VaultRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dataReplicationVaultVaultApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.DataReplication/replicationVaults"; + + /// 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 DataReplicationVaultData 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 DataReplicationEmailConfigurationResources in the DataReplicationVault. + /// An object representing collection of DataReplicationEmailConfigurationResources and their operations over a DataReplicationEmailConfigurationResource. + public virtual DataReplicationEmailConfigurationCollection GetDataReplicationEmailConfigurations() + { + return GetCachedClient(Client => new DataReplicationEmailConfigurationCollection(Client, Id)); + } + + /// + /// Gets the details of the alert configuration setting. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/alertSettings/{emailConfigurationName} + /// + /// + /// Operation Id + /// EmailConfiguration_Get + /// + /// + /// + /// The email configuration name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetDataReplicationEmailConfigurationAsync(string emailConfigurationName, CancellationToken cancellationToken = default) + { + return await GetDataReplicationEmailConfigurations().GetAsync(emailConfigurationName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the alert configuration setting. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/alertSettings/{emailConfigurationName} + /// + /// + /// Operation Id + /// EmailConfiguration_Get + /// + /// + /// + /// The email configuration name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetDataReplicationEmailConfiguration(string emailConfigurationName, CancellationToken cancellationToken = default) + { + return GetDataReplicationEmailConfigurations().Get(emailConfigurationName, cancellationToken); + } + + /// Gets a collection of DataReplicationEventResources in the DataReplicationVault. + /// An object representing collection of DataReplicationEventResources and their operations over a DataReplicationEventResource. + public virtual DataReplicationEventCollection GetDataReplicationEvents() + { + return GetCachedClient(Client => new DataReplicationEventCollection(Client, Id)); + } + + /// + /// Gets the details of the event. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/events/{eventName} + /// + /// + /// Operation Id + /// Event_Get + /// + /// + /// + /// The event name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetDataReplicationEventAsync(string eventName, CancellationToken cancellationToken = default) + { + return await GetDataReplicationEvents().GetAsync(eventName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the event. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/events/{eventName} + /// + /// + /// Operation Id + /// Event_Get + /// + /// + /// + /// The event name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetDataReplicationEvent(string eventName, CancellationToken cancellationToken = default) + { + return GetDataReplicationEvents().Get(eventName, cancellationToken); + } + + /// Gets a collection of DataReplicationPolicyResources in the DataReplicationVault. + /// An object representing collection of DataReplicationPolicyResources and their operations over a DataReplicationPolicyResource. + public virtual DataReplicationPolicyCollection GetDataReplicationPolicies() + { + return GetCachedClient(Client => new DataReplicationPolicyCollection(Client, Id)); + } + + /// + /// Gets the details of the policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName} + /// + /// + /// Operation Id + /// Policy_Get + /// + /// + /// + /// The policy name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetDataReplicationPolicyAsync(string policyName, CancellationToken cancellationToken = default) + { + return await GetDataReplicationPolicies().GetAsync(policyName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the policy. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName} + /// + /// + /// Operation Id + /// Policy_Get + /// + /// + /// + /// The policy name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetDataReplicationPolicy(string policyName, CancellationToken cancellationToken = default) + { + return GetDataReplicationPolicies().Get(policyName, cancellationToken); + } + + /// Gets a collection of DataReplicationProtectedItemResources in the DataReplicationVault. + /// An object representing collection of DataReplicationProtectedItemResources and their operations over a DataReplicationProtectedItemResource. + public virtual DataReplicationProtectedItemCollection GetDataReplicationProtectedItems() + { + return GetCachedClient(Client => new DataReplicationProtectedItemCollection(Client, Id)); + } + + /// + /// Gets the details of the protected item. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName} + /// + /// + /// Operation Id + /// ProtectedItem_Get + /// + /// + /// + /// The protected item name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetDataReplicationProtectedItemAsync(string protectedItemName, CancellationToken cancellationToken = default) + { + return await GetDataReplicationProtectedItems().GetAsync(protectedItemName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the protected item. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName} + /// + /// + /// Operation Id + /// ProtectedItem_Get + /// + /// + /// + /// The protected item name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetDataReplicationProtectedItem(string protectedItemName, CancellationToken cancellationToken = default) + { + return GetDataReplicationProtectedItems().Get(protectedItemName, cancellationToken); + } + + /// Gets a collection of DataReplicationReplicationExtensionResources in the DataReplicationVault. + /// An object representing collection of DataReplicationReplicationExtensionResources and their operations over a DataReplicationReplicationExtensionResource. + public virtual DataReplicationReplicationExtensionCollection GetDataReplicationReplicationExtensions() + { + return GetCachedClient(Client => new DataReplicationReplicationExtensionCollection(Client, Id)); + } + + /// + /// Gets the details of the replication extension. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName} + /// + /// + /// Operation Id + /// ReplicationExtension_Get + /// + /// + /// + /// The replication extension name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetDataReplicationReplicationExtensionAsync(string replicationExtensionName, CancellationToken cancellationToken = default) + { + return await GetDataReplicationReplicationExtensions().GetAsync(replicationExtensionName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the replication extension. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName} + /// + /// + /// Operation Id + /// ReplicationExtension_Get + /// + /// + /// + /// The replication extension name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetDataReplicationReplicationExtension(string replicationExtensionName, CancellationToken cancellationToken = default) + { + return GetDataReplicationReplicationExtensions().Get(replicationExtensionName, cancellationToken); + } + + /// Gets a collection of DataReplicationWorkflowResources in the DataReplicationVault. + /// An object representing collection of DataReplicationWorkflowResources and their operations over a DataReplicationWorkflowResource. + public virtual DataReplicationWorkflowCollection GetDataReplicationWorkflows() + { + return GetCachedClient(Client => new DataReplicationWorkflowCollection(Client, Id)); + } + + /// + /// Gets the details of the job. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/jobs/{jobName} + /// + /// + /// Operation Id + /// Workflow_Get + /// + /// + /// + /// The job (workflow) name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetDataReplicationWorkflowAsync(string jobName, CancellationToken cancellationToken = default) + { + return await GetDataReplicationWorkflows().GetAsync(jobName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the job. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/jobs/{jobName} + /// + /// + /// Operation Id + /// Workflow_Get + /// + /// + /// + /// The job (workflow) name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetDataReplicationWorkflow(string jobName, CancellationToken cancellationToken = default) + { + return GetDataReplicationWorkflows().Get(jobName, cancellationToken); + } + + /// + /// Gets the details of the vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName} + /// + /// + /// Operation Id + /// Vault_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _dataReplicationVaultVaultClientDiagnostics.CreateScope("DataReplicationVaultResource.Get"); + scope.Start(); + try + { + var response = await _dataReplicationVaultVaultRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataReplicationVaultResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName} + /// + /// + /// Operation Id + /// Vault_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _dataReplicationVaultVaultClientDiagnostics.CreateScope("DataReplicationVaultResource.Get"); + scope.Start(); + try + { + var response = _dataReplicationVaultVaultRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataReplicationVaultResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes the vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName} + /// + /// + /// Operation Id + /// Vault_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 cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _dataReplicationVaultVaultClientDiagnostics.CreateScope("DataReplicationVaultResource.Delete"); + scope.Start(); + try + { + var response = await _dataReplicationVaultVaultRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new RecoveryServicesDataReplicationArmOperation(_dataReplicationVaultVaultClientDiagnostics, Pipeline, _dataReplicationVaultVaultRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes the vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName} + /// + /// + /// Operation Id + /// Vault_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 cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _dataReplicationVaultVaultClientDiagnostics.CreateScope("DataReplicationVaultResource.Delete"); + scope.Start(); + try + { + var response = _dataReplicationVaultVaultRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new RecoveryServicesDataReplicationArmOperation(_dataReplicationVaultVaultClientDiagnostics, Pipeline, _dataReplicationVaultVaultRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Performs update on the vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName} + /// + /// + /// Operation Id + /// Vault_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. + /// Vault properties. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, DataReplicationVaultPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _dataReplicationVaultVaultClientDiagnostics.CreateScope("DataReplicationVaultResource.Update"); + scope.Start(); + try + { + var response = await _dataReplicationVaultVaultRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new RecoveryServicesDataReplicationArmOperation(new DataReplicationVaultOperationSource(Client), _dataReplicationVaultVaultClientDiagnostics, Pipeline, _dataReplicationVaultVaultRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Performs update on the vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName} + /// + /// + /// Operation Id + /// Vault_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. + /// Vault properties. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, DataReplicationVaultPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _dataReplicationVaultVaultClientDiagnostics.CreateScope("DataReplicationVaultResource.Update"); + scope.Start(); + try + { + var response = _dataReplicationVaultVaultRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); + var operation = new RecoveryServicesDataReplicationArmOperation(new DataReplicationVaultOperationSource(Client), _dataReplicationVaultVaultClientDiagnostics, Pipeline, _dataReplicationVaultVaultRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName} + /// + /// + /// Operation Id + /// Vault_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 = _dataReplicationVaultVaultClientDiagnostics.CreateScope("DataReplicationVaultResource.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 _dataReplicationVaultVaultRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DataReplicationVaultResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DataReplicationVaultPatch(); + 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.DataReplication/replicationVaults/{vaultName} + /// + /// + /// Operation Id + /// Vault_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 = _dataReplicationVaultVaultClientDiagnostics.CreateScope("DataReplicationVaultResource.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 = _dataReplicationVaultVaultRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new DataReplicationVaultResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DataReplicationVaultPatch(); + 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.DataReplication/replicationVaults/{vaultName} + /// + /// + /// Operation Id + /// Vault_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 = _dataReplicationVaultVaultClientDiagnostics.CreateScope("DataReplicationVaultResource.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 _dataReplicationVaultVaultRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DataReplicationVaultResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DataReplicationVaultPatch(); + 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.DataReplication/replicationVaults/{vaultName} + /// + /// + /// Operation Id + /// Vault_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 = _dataReplicationVaultVaultClientDiagnostics.CreateScope("DataReplicationVaultResource.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 = _dataReplicationVaultVaultRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new DataReplicationVaultResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DataReplicationVaultPatch(); + 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.DataReplication/replicationVaults/{vaultName} + /// + /// + /// Operation Id + /// Vault_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 = _dataReplicationVaultVaultClientDiagnostics.CreateScope("DataReplicationVaultResource.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 _dataReplicationVaultVaultRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DataReplicationVaultResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DataReplicationVaultPatch(); + 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.DataReplication/replicationVaults/{vaultName} + /// + /// + /// Operation Id + /// Vault_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 = _dataReplicationVaultVaultClientDiagnostics.CreateScope("DataReplicationVaultResource.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 = _dataReplicationVaultVaultRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new DataReplicationVaultResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DataReplicationVaultPatch(); + 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/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationWorkflowCollection.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationWorkflowCollection.cs new file mode 100644 index 000000000000..dd9d8e9d4b4f --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationWorkflowCollection.cs @@ -0,0 +1,263 @@ +// 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.RecoveryServicesDataReplication +{ + /// + /// 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 GetDataReplicationWorkflows method from an instance of . + /// + public partial class DataReplicationWorkflowCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _dataReplicationWorkflowWorkflowClientDiagnostics; + private readonly WorkflowRestOperations _dataReplicationWorkflowWorkflowRestClient; + + /// Initializes a new instance of the class for mocking. + protected DataReplicationWorkflowCollection() + { + } + + /// 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 DataReplicationWorkflowCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dataReplicationWorkflowWorkflowClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesDataReplication", DataReplicationWorkflowResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DataReplicationWorkflowResource.ResourceType, out string dataReplicationWorkflowWorkflowApiVersion); + _dataReplicationWorkflowWorkflowRestClient = new WorkflowRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dataReplicationWorkflowWorkflowApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != DataReplicationVaultResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DataReplicationVaultResource.ResourceType), nameof(id)); + } + + /// + /// Gets the details of the job. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/jobs/{jobName} + /// + /// + /// Operation Id + /// Workflow_Get + /// + /// + /// + /// The job (workflow) name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string jobName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(jobName, nameof(jobName)); + + using var scope = _dataReplicationWorkflowWorkflowClientDiagnostics.CreateScope("DataReplicationWorkflowCollection.Get"); + scope.Start(); + try + { + var response = await _dataReplicationWorkflowWorkflowRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, jobName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataReplicationWorkflowResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the job. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/jobs/{jobName} + /// + /// + /// Operation Id + /// Workflow_Get + /// + /// + /// + /// The job (workflow) name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string jobName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(jobName, nameof(jobName)); + + using var scope = _dataReplicationWorkflowWorkflowClientDiagnostics.CreateScope("DataReplicationWorkflowCollection.Get"); + scope.Start(); + try + { + var response = _dataReplicationWorkflowWorkflowRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, jobName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataReplicationWorkflowResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the list of jobs in the given vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/jobs + /// + /// + /// Operation Id + /// Workflow_List + /// + /// + /// + /// Filter string. + /// Continuation token. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, string continuationToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _dataReplicationWorkflowWorkflowRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, continuationToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataReplicationWorkflowWorkflowRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, continuationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataReplicationWorkflowResource(Client, DataReplicationWorkflowData.DeserializeDataReplicationWorkflowData(e)), _dataReplicationWorkflowWorkflowClientDiagnostics, Pipeline, "DataReplicationWorkflowCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the list of jobs in the given vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/jobs + /// + /// + /// Operation Id + /// Workflow_List + /// + /// + /// + /// Filter string. + /// Continuation token. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, string continuationToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _dataReplicationWorkflowWorkflowRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, continuationToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dataReplicationWorkflowWorkflowRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, filter, continuationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataReplicationWorkflowResource(Client, DataReplicationWorkflowData.DeserializeDataReplicationWorkflowData(e)), _dataReplicationWorkflowWorkflowClientDiagnostics, Pipeline, "DataReplicationWorkflowCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/jobs/{jobName} + /// + /// + /// Operation Id + /// Workflow_Get + /// + /// + /// + /// The job (workflow) name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string jobName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(jobName, nameof(jobName)); + + using var scope = _dataReplicationWorkflowWorkflowClientDiagnostics.CreateScope("DataReplicationWorkflowCollection.Exists"); + scope.Start(); + try + { + var response = await _dataReplicationWorkflowWorkflowRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, jobName, 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.DataReplication/replicationVaults/{vaultName}/jobs/{jobName} + /// + /// + /// Operation Id + /// Workflow_Get + /// + /// + /// + /// The job (workflow) name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string jobName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(jobName, nameof(jobName)); + + using var scope = _dataReplicationWorkflowWorkflowClientDiagnostics.CreateScope("DataReplicationWorkflowCollection.Exists"); + scope.Start(); + try + { + var response = _dataReplicationWorkflowWorkflowRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, jobName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, 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/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationWorkflowData.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationWorkflowData.cs new file mode 100644 index 000000000000..1657be7706e6 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationWorkflowData.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication +{ + /// + /// A class representing the DataReplicationWorkflow data model. + /// Workflow model. + /// + public partial class DataReplicationWorkflowData : ResourceData + { + /// Initializes a new instance of DataReplicationWorkflowData. + /// Workflow model properties. + /// is null. + internal DataReplicationWorkflowData(DataReplicationWorkflowProperties properties) + { + Argument.AssertNotNull(properties, nameof(properties)); + + Properties = properties; + } + + /// Initializes a new instance of DataReplicationWorkflowData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Workflow model properties. + internal DataReplicationWorkflowData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DataReplicationWorkflowProperties properties) : base(id, name, resourceType, systemData) + { + Properties = properties; + } + + /// Workflow model properties. + public DataReplicationWorkflowProperties Properties { get; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationWorkflowResource.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationWorkflowResource.cs new file mode 100644 index 000000000000..9b8acc77b690 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationWorkflowResource.cs @@ -0,0 +1,153 @@ +// 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.RecoveryServicesDataReplication +{ + /// + /// A Class representing a DataReplicationWorkflow 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 GetDataReplicationWorkflowResource method. + /// Otherwise you can get one from its parent resource using the GetDataReplicationWorkflow method. + /// + public partial class DataReplicationWorkflowResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vaultName, string jobName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/jobs/{jobName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _dataReplicationWorkflowWorkflowClientDiagnostics; + private readonly WorkflowRestOperations _dataReplicationWorkflowWorkflowRestClient; + private readonly DataReplicationWorkflowData _data; + + /// Initializes a new instance of the class for mocking. + protected DataReplicationWorkflowResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DataReplicationWorkflowResource(ArmClient client, DataReplicationWorkflowData 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 DataReplicationWorkflowResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dataReplicationWorkflowWorkflowClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesDataReplication", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string dataReplicationWorkflowWorkflowApiVersion); + _dataReplicationWorkflowWorkflowRestClient = new WorkflowRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dataReplicationWorkflowWorkflowApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.DataReplication/replicationVaults/jobs"; + + /// 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 DataReplicationWorkflowData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the details of the job. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/jobs/{jobName} + /// + /// + /// Operation Id + /// Workflow_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _dataReplicationWorkflowWorkflowClientDiagnostics.CreateScope("DataReplicationWorkflowResource.Get"); + scope.Start(); + try + { + var response = await _dataReplicationWorkflowWorkflowRestClient.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 DataReplicationWorkflowResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the details of the job. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/jobs/{jobName} + /// + /// + /// Operation Id + /// Workflow_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _dataReplicationWorkflowWorkflowClientDiagnostics.CreateScope("DataReplicationWorkflowResource.Get"); + scope.Start(); + try + { + var response = _dataReplicationWorkflowWorkflowRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DataReplicationWorkflowResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Extensions/RecoveryServicesDataReplicationExtensions.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Extensions/RecoveryServicesDataReplicationExtensions.cs new file mode 100644 index 000000000000..a7f4414a17e6 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Extensions/RecoveryServicesDataReplicationExtensions.cs @@ -0,0 +1,539 @@ +// 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.RecoveryServicesDataReplication.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication +{ + /// A class to add extension methods to Azure.ResourceManager.RecoveryServicesDataReplication. + public static partial class RecoveryServicesDataReplicationExtensions + { + 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 DataReplicationDraResource + /// + /// 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 DataReplicationDraResource GetDataReplicationDraResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + DataReplicationDraResource.ValidateResourceId(id); + return new DataReplicationDraResource(client, id); + } + ); + } + #endregion + + #region DataReplicationEmailConfigurationResource + /// + /// 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 DataReplicationEmailConfigurationResource GetDataReplicationEmailConfigurationResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + DataReplicationEmailConfigurationResource.ValidateResourceId(id); + return new DataReplicationEmailConfigurationResource(client, id); + } + ); + } + #endregion + + #region DataReplicationEventResource + /// + /// 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 DataReplicationEventResource GetDataReplicationEventResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + DataReplicationEventResource.ValidateResourceId(id); + return new DataReplicationEventResource(client, id); + } + ); + } + #endregion + + #region DataReplicationFabricResource + /// + /// 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 DataReplicationFabricResource GetDataReplicationFabricResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + DataReplicationFabricResource.ValidateResourceId(id); + return new DataReplicationFabricResource(client, id); + } + ); + } + #endregion + + #region DataReplicationPolicyResource + /// + /// 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 DataReplicationPolicyResource GetDataReplicationPolicyResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + DataReplicationPolicyResource.ValidateResourceId(id); + return new DataReplicationPolicyResource(client, id); + } + ); + } + #endregion + + #region DataReplicationProtectedItemResource + /// + /// 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 DataReplicationProtectedItemResource GetDataReplicationProtectedItemResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + DataReplicationProtectedItemResource.ValidateResourceId(id); + return new DataReplicationProtectedItemResource(client, id); + } + ); + } + #endregion + + #region DataReplicationRecoveryPointResource + /// + /// 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 DataReplicationRecoveryPointResource GetDataReplicationRecoveryPointResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + DataReplicationRecoveryPointResource.ValidateResourceId(id); + return new DataReplicationRecoveryPointResource(client, id); + } + ); + } + #endregion + + #region DataReplicationReplicationExtensionResource + /// + /// 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 DataReplicationReplicationExtensionResource GetDataReplicationReplicationExtensionResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + DataReplicationReplicationExtensionResource.ValidateResourceId(id); + return new DataReplicationReplicationExtensionResource(client, id); + } + ); + } + #endregion + + #region DataReplicationVaultResource + /// + /// 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 DataReplicationVaultResource GetDataReplicationVaultResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + DataReplicationVaultResource.ValidateResourceId(id); + return new DataReplicationVaultResource(client, id); + } + ); + } + #endregion + + #region DataReplicationWorkflowResource + /// + /// 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 DataReplicationWorkflowResource GetDataReplicationWorkflowResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + DataReplicationWorkflowResource.ValidateResourceId(id); + return new DataReplicationWorkflowResource(client, id); + } + ); + } + #endregion + + /// Gets a collection of DataReplicationFabricResources in the ResourceGroupResource. + /// The instance the method will execute against. + /// An object representing collection of DataReplicationFabricResources and their operations over a DataReplicationFabricResource. + public static DataReplicationFabricCollection GetDataReplicationFabrics(this ResourceGroupResource resourceGroupResource) + { + return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDataReplicationFabrics(); + } + + /// + /// Gets the details of the fabric. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName} + /// + /// + /// Operation Id + /// Fabric_Get + /// + /// + /// + /// The instance the method will execute against. + /// The fabric name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public static async Task> GetDataReplicationFabricAsync(this ResourceGroupResource resourceGroupResource, string fabricName, CancellationToken cancellationToken = default) + { + return await resourceGroupResource.GetDataReplicationFabrics().GetAsync(fabricName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the fabric. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName} + /// + /// + /// Operation Id + /// Fabric_Get + /// + /// + /// + /// The instance the method will execute against. + /// The fabric name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public static Response GetDataReplicationFabric(this ResourceGroupResource resourceGroupResource, string fabricName, CancellationToken cancellationToken = default) + { + return resourceGroupResource.GetDataReplicationFabrics().Get(fabricName, cancellationToken); + } + + /// Gets a collection of DataReplicationVaultResources in the ResourceGroupResource. + /// The instance the method will execute against. + /// An object representing collection of DataReplicationVaultResources and their operations over a DataReplicationVaultResource. + public static DataReplicationVaultCollection GetDataReplicationVaults(this ResourceGroupResource resourceGroupResource) + { + return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetDataReplicationVaults(); + } + + /// + /// Gets the details of the vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName} + /// + /// + /// Operation Id + /// Vault_Get + /// + /// + /// + /// The instance the method will execute against. + /// The vault name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public static async Task> GetDataReplicationVaultAsync(this ResourceGroupResource resourceGroupResource, string vaultName, CancellationToken cancellationToken = default) + { + return await resourceGroupResource.GetDataReplicationVaults().GetAsync(vaultName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the details of the vault. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName} + /// + /// + /// Operation Id + /// Vault_Get + /// + /// + /// + /// The instance the method will execute against. + /// The vault name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public static Response GetDataReplicationVault(this ResourceGroupResource resourceGroupResource, string vaultName, CancellationToken cancellationToken = default) + { + return resourceGroupResource.GetDataReplicationVaults().Get(vaultName, cancellationToken); + } + + /// + /// Performs resource deployment validation. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/deployments/{deploymentId}/preflight + /// + /// + /// Operation Id + /// DeploymentPreflight + /// + /// + /// + /// The instance the method will execute against. + /// Deployment Id. + /// Deployment preflight model. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public static async Task> DeploymentPreflightAsync(this ResourceGroupResource resourceGroupResource, string deploymentId, DeploymentPreflightModel body = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(deploymentId, nameof(deploymentId)); + + return await GetResourceGroupResourceExtensionClient(resourceGroupResource).DeploymentPreflightAsync(deploymentId, body, cancellationToken).ConfigureAwait(false); + } + + /// + /// Performs resource deployment validation. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/deployments/{deploymentId}/preflight + /// + /// + /// Operation Id + /// DeploymentPreflight + /// + /// + /// + /// The instance the method will execute against. + /// Deployment Id. + /// Deployment preflight model. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public static Response DeploymentPreflight(this ResourceGroupResource resourceGroupResource, string deploymentId, DeploymentPreflightModel body = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(deploymentId, nameof(deploymentId)); + + return GetResourceGroupResourceExtensionClient(resourceGroupResource).DeploymentPreflight(deploymentId, body, cancellationToken); + } + + /// + /// Gets the list of fabrics in the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/replicationFabrics + /// + /// + /// Operation Id + /// Fabric_ListBySubscription + /// + /// + /// + /// The instance the method will execute against. + /// Continuation token from the previous call. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetDataReplicationFabricsAsync(this SubscriptionResource subscriptionResource, string continuationToken = null, CancellationToken cancellationToken = default) + { + return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDataReplicationFabricsAsync(continuationToken, cancellationToken); + } + + /// + /// Gets the list of fabrics in the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/replicationFabrics + /// + /// + /// Operation Id + /// Fabric_ListBySubscription + /// + /// + /// + /// The instance the method will execute against. + /// Continuation token from the previous call. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetDataReplicationFabrics(this SubscriptionResource subscriptionResource, string continuationToken = null, CancellationToken cancellationToken = default) + { + return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDataReplicationFabrics(continuationToken, cancellationToken); + } + + /// + /// Checks the resource name availability. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/locations/{location}/checkNameAvailability + /// + /// + /// Operation Id + /// CheckNameAvailability + /// + /// + /// + /// The instance the method will execute against. + /// The name of the Azure region. + /// Resource details. + /// The cancellation token to use. + public static async Task> CheckDataReplicationNameAvailabilityAsync(this SubscriptionResource subscriptionResource, AzureLocation location, DataReplicationNameAvailabilityContent content = null, CancellationToken cancellationToken = default) + { + return await GetSubscriptionResourceExtensionClient(subscriptionResource).CheckDataReplicationNameAvailabilityAsync(location, content, cancellationToken).ConfigureAwait(false); + } + + /// + /// Checks the resource name availability. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/locations/{location}/checkNameAvailability + /// + /// + /// Operation Id + /// CheckNameAvailability + /// + /// + /// + /// The instance the method will execute against. + /// The name of the Azure region. + /// Resource details. + /// The cancellation token to use. + public static Response CheckDataReplicationNameAvailability(this SubscriptionResource subscriptionResource, AzureLocation location, DataReplicationNameAvailabilityContent content = null, CancellationToken cancellationToken = default) + { + return GetSubscriptionResourceExtensionClient(subscriptionResource).CheckDataReplicationNameAvailability(location, content, cancellationToken); + } + + /// + /// Gets the list of vaults in the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/replicationVaults + /// + /// + /// Operation Id + /// Vault_ListBySubscription + /// + /// + /// + /// The instance the method will execute against. + /// Continuation token from the previous call. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetDataReplicationVaultsAsync(this SubscriptionResource subscriptionResource, string continuationToken = null, CancellationToken cancellationToken = default) + { + return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDataReplicationVaultsAsync(continuationToken, cancellationToken); + } + + /// + /// Gets the list of vaults in the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/replicationVaults + /// + /// + /// Operation Id + /// Vault_ListBySubscription + /// + /// + /// + /// The instance the method will execute against. + /// Continuation token from the previous call. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetDataReplicationVaults(this SubscriptionResource subscriptionResource, string continuationToken = null, CancellationToken cancellationToken = default) + { + return GetSubscriptionResourceExtensionClient(subscriptionResource).GetDataReplicationVaults(continuationToken, cancellationToken); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs new file mode 100644 index 000000000000..28bf48155fcc --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs @@ -0,0 +1,124 @@ +// 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; +using Azure.ResourceManager.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication +{ + /// A class to add extension methods to ResourceGroupResource. + internal partial class ResourceGroupResourceExtensionClient : ArmResource + { + private ClientDiagnostics _defaultClientDiagnostics; + private AzureSiteRecoveryManagementServiceAPIRestOperations _defaultRestClient; + + /// 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 ClientDiagnostics DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesDataReplication", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private AzureSiteRecoveryManagementServiceAPIRestOperations DefaultRestClient => _defaultRestClient ??= new AzureSiteRecoveryManagementServiceAPIRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of DataReplicationFabricResources in the ResourceGroupResource. + /// An object representing collection of DataReplicationFabricResources and their operations over a DataReplicationFabricResource. + public virtual DataReplicationFabricCollection GetDataReplicationFabrics() + { + return GetCachedClient(Client => new DataReplicationFabricCollection(Client, Id)); + } + + /// Gets a collection of DataReplicationVaultResources in the ResourceGroupResource. + /// An object representing collection of DataReplicationVaultResources and their operations over a DataReplicationVaultResource. + public virtual DataReplicationVaultCollection GetDataReplicationVaults() + { + return GetCachedClient(Client => new DataReplicationVaultCollection(Client, Id)); + } + + /// + /// Performs resource deployment validation. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/deployments/{deploymentId}/preflight + /// + /// + /// Operation Id + /// DeploymentPreflight + /// + /// + /// + /// Deployment Id. + /// Deployment preflight model. + /// The cancellation token to use. + public virtual async Task> DeploymentPreflightAsync(string deploymentId, DeploymentPreflightModel body = null, CancellationToken cancellationToken = default) + { + using var scope = DefaultClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.DeploymentPreflight"); + scope.Start(); + try + { + var response = await DefaultRestClient.DeploymentPreflightAsync(Id.SubscriptionId, Id.ResourceGroupName, deploymentId, body, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Performs resource deployment validation. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/deployments/{deploymentId}/preflight + /// + /// + /// Operation Id + /// DeploymentPreflight + /// + /// + /// + /// Deployment Id. + /// Deployment preflight model. + /// The cancellation token to use. + public virtual Response DeploymentPreflight(string deploymentId, DeploymentPreflightModel body = null, CancellationToken cancellationToken = default) + { + using var scope = DefaultClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.DeploymentPreflight"); + scope.Start(); + try + { + var response = DefaultRestClient.DeploymentPreflight(Id.SubscriptionId, Id.ResourceGroupName, deploymentId, body, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs new file mode 100644 index 000000000000..3ffb3aaf3ae3 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +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.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication +{ + /// A class to add extension methods to SubscriptionResource. + internal partial class SubscriptionResourceExtensionClient : ArmResource + { + private ClientDiagnostics _dataReplicationFabricFabricClientDiagnostics; + private FabricRestOperations _dataReplicationFabricFabricRestClient; + private ClientDiagnostics _defaultClientDiagnostics; + private AzureSiteRecoveryManagementServiceAPIRestOperations _defaultRestClient; + private ClientDiagnostics _dataReplicationVaultVaultClientDiagnostics; + private VaultRestOperations _dataReplicationVaultVaultRestClient; + + /// 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 DataReplicationFabricFabricClientDiagnostics => _dataReplicationFabricFabricClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesDataReplication", DataReplicationFabricResource.ResourceType.Namespace, Diagnostics); + private FabricRestOperations DataReplicationFabricFabricRestClient => _dataReplicationFabricFabricRestClient ??= new FabricRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DataReplicationFabricResource.ResourceType)); + private ClientDiagnostics DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesDataReplication", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private AzureSiteRecoveryManagementServiceAPIRestOperations DefaultRestClient => _defaultRestClient ??= new AzureSiteRecoveryManagementServiceAPIRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics DataReplicationVaultVaultClientDiagnostics => _dataReplicationVaultVaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.RecoveryServicesDataReplication", DataReplicationVaultResource.ResourceType.Namespace, Diagnostics); + private VaultRestOperations DataReplicationVaultVaultRestClient => _dataReplicationVaultVaultRestClient ??= new VaultRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DataReplicationVaultResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets the list of fabrics in the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/replicationFabrics + /// + /// + /// Operation Id + /// Fabric_ListBySubscription + /// + /// + /// + /// Continuation token from the previous call. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDataReplicationFabricsAsync(string continuationToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DataReplicationFabricFabricRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, continuationToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataReplicationFabricFabricRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, continuationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataReplicationFabricResource(Client, DataReplicationFabricData.DeserializeDataReplicationFabricData(e)), DataReplicationFabricFabricClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDataReplicationFabrics", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the list of fabrics in the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/replicationFabrics + /// + /// + /// Operation Id + /// Fabric_ListBySubscription + /// + /// + /// + /// Continuation token from the previous call. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDataReplicationFabrics(string continuationToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DataReplicationFabricFabricRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, continuationToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataReplicationFabricFabricRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, continuationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataReplicationFabricResource(Client, DataReplicationFabricData.DeserializeDataReplicationFabricData(e)), DataReplicationFabricFabricClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDataReplicationFabrics", "value", "nextLink", cancellationToken); + } + + /// + /// Checks the resource name availability. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/locations/{location}/checkNameAvailability + /// + /// + /// Operation Id + /// CheckNameAvailability + /// + /// + /// + /// The name of the Azure region. + /// Resource details. + /// The cancellation token to use. + public virtual async Task> CheckDataReplicationNameAvailabilityAsync(AzureLocation location, DataReplicationNameAvailabilityContent content = null, CancellationToken cancellationToken = default) + { + using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckDataReplicationNameAvailability"); + scope.Start(); + try + { + var response = await DefaultRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, location, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks the resource name availability. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/locations/{location}/checkNameAvailability + /// + /// + /// Operation Id + /// CheckNameAvailability + /// + /// + /// + /// The name of the Azure region. + /// Resource details. + /// The cancellation token to use. + public virtual Response CheckDataReplicationNameAvailability(AzureLocation location, DataReplicationNameAvailabilityContent content = null, CancellationToken cancellationToken = default) + { + using var scope = DefaultClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckDataReplicationNameAvailability"); + scope.Start(); + try + { + var response = DefaultRestClient.CheckNameAvailability(Id.SubscriptionId, location, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the list of vaults in the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/replicationVaults + /// + /// + /// Operation Id + /// Vault_ListBySubscription + /// + /// + /// + /// Continuation token from the previous call. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDataReplicationVaultsAsync(string continuationToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DataReplicationVaultVaultRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, continuationToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataReplicationVaultVaultRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, continuationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DataReplicationVaultResource(Client, DataReplicationVaultData.DeserializeDataReplicationVaultData(e)), DataReplicationVaultVaultClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDataReplicationVaults", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the list of vaults in the given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/replicationVaults + /// + /// + /// Operation Id + /// Vault_ListBySubscription + /// + /// + /// + /// Continuation token from the previous call. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDataReplicationVaults(string continuationToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DataReplicationVaultVaultRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, continuationToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DataReplicationVaultVaultRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, continuationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DataReplicationVaultResource(Client, DataReplicationVaultData.DeserializeDataReplicationVaultData(e)), DataReplicationVaultVaultClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetDataReplicationVaults", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/LongRunningOperation/DataReplicationDraOperationSource.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/LongRunningOperation/DataReplicationDraOperationSource.cs new file mode 100644 index 000000000000..26c5d7b1016f --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/LongRunningOperation/DataReplicationDraOperationSource.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.RecoveryServicesDataReplication +{ + internal class DataReplicationDraOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal DataReplicationDraOperationSource(ArmClient client) + { + _client = client; + } + + DataReplicationDraResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = DataReplicationDraData.DeserializeDataReplicationDraData(document.RootElement); + return new DataReplicationDraResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = DataReplicationDraData.DeserializeDataReplicationDraData(document.RootElement); + return new DataReplicationDraResource(_client, data); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/LongRunningOperation/DataReplicationFabricOperationSource.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/LongRunningOperation/DataReplicationFabricOperationSource.cs new file mode 100644 index 000000000000..f67a4ec936f8 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/LongRunningOperation/DataReplicationFabricOperationSource.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.RecoveryServicesDataReplication +{ + internal class DataReplicationFabricOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal DataReplicationFabricOperationSource(ArmClient client) + { + _client = client; + } + + DataReplicationFabricResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = DataReplicationFabricData.DeserializeDataReplicationFabricData(document.RootElement); + return new DataReplicationFabricResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = DataReplicationFabricData.DeserializeDataReplicationFabricData(document.RootElement); + return new DataReplicationFabricResource(_client, data); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/LongRunningOperation/DataReplicationPolicyOperationSource.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/LongRunningOperation/DataReplicationPolicyOperationSource.cs new file mode 100644 index 000000000000..f445ac553318 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/LongRunningOperation/DataReplicationPolicyOperationSource.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.RecoveryServicesDataReplication +{ + internal class DataReplicationPolicyOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal DataReplicationPolicyOperationSource(ArmClient client) + { + _client = client; + } + + DataReplicationPolicyResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = DataReplicationPolicyData.DeserializeDataReplicationPolicyData(document.RootElement); + return new DataReplicationPolicyResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = DataReplicationPolicyData.DeserializeDataReplicationPolicyData(document.RootElement); + return new DataReplicationPolicyResource(_client, data); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/LongRunningOperation/DataReplicationProtectedItemOperationSource.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/LongRunningOperation/DataReplicationProtectedItemOperationSource.cs new file mode 100644 index 000000000000..991d8a100e7f --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/LongRunningOperation/DataReplicationProtectedItemOperationSource.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.RecoveryServicesDataReplication +{ + internal class DataReplicationProtectedItemOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal DataReplicationProtectedItemOperationSource(ArmClient client) + { + _client = client; + } + + DataReplicationProtectedItemResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = DataReplicationProtectedItemData.DeserializeDataReplicationProtectedItemData(document.RootElement); + return new DataReplicationProtectedItemResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = DataReplicationProtectedItemData.DeserializeDataReplicationProtectedItemData(document.RootElement); + return new DataReplicationProtectedItemResource(_client, data); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/LongRunningOperation/DataReplicationReplicationExtensionOperationSource.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/LongRunningOperation/DataReplicationReplicationExtensionOperationSource.cs new file mode 100644 index 000000000000..5103e1b3a39e --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/LongRunningOperation/DataReplicationReplicationExtensionOperationSource.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.RecoveryServicesDataReplication +{ + internal class DataReplicationReplicationExtensionOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal DataReplicationReplicationExtensionOperationSource(ArmClient client) + { + _client = client; + } + + DataReplicationReplicationExtensionResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = DataReplicationReplicationExtensionData.DeserializeDataReplicationReplicationExtensionData(document.RootElement); + return new DataReplicationReplicationExtensionResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = DataReplicationReplicationExtensionData.DeserializeDataReplicationReplicationExtensionData(document.RootElement); + return new DataReplicationReplicationExtensionResource(_client, data); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/LongRunningOperation/DataReplicationVaultOperationSource.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/LongRunningOperation/DataReplicationVaultOperationSource.cs new file mode 100644 index 000000000000..25811ddb989d --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/LongRunningOperation/DataReplicationVaultOperationSource.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.RecoveryServicesDataReplication +{ + internal class DataReplicationVaultOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal DataReplicationVaultOperationSource(ArmClient client) + { + _client = client; + } + + DataReplicationVaultResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = DataReplicationVaultData.DeserializeDataReplicationVaultData(document.RootElement); + return new DataReplicationVaultResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = DataReplicationVaultData.DeserializeDataReplicationVaultData(document.RootElement); + return new DataReplicationVaultResource(_client, data); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/LongRunningOperation/PlannedFailoverModelOperationSource.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/LongRunningOperation/PlannedFailoverModelOperationSource.cs new file mode 100644 index 000000000000..6251359a249f --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/LongRunningOperation/PlannedFailoverModelOperationSource.cs @@ -0,0 +1,31 @@ +// 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.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication +{ + internal class PlannedFailoverModelOperationSource : IOperationSource + { + PlannedFailoverModel IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return PlannedFailoverModel.DeserializePlannedFailoverModel(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return PlannedFailoverModel.DeserializePlannedFailoverModel(document.RootElement); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/LongRunningOperation/RecoveryServicesDataReplicationArmOperation.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/LongRunningOperation/RecoveryServicesDataReplicationArmOperation.cs new file mode 100644 index 000000000000..6c9ea67cac22 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/LongRunningOperation/RecoveryServicesDataReplicationArmOperation.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.RecoveryServicesDataReplication +{ +#pragma warning disable SA1649 // File name should match first type name + internal class RecoveryServicesDataReplicationArmOperation : ArmOperation +#pragma warning restore SA1649 // File name should match first type name + { + private readonly OperationInternal _operation; + + /// Initializes a new instance of RecoveryServicesDataReplicationArmOperation for mocking. + protected RecoveryServicesDataReplicationArmOperation() + { + } + + internal RecoveryServicesDataReplicationArmOperation(Response response) + { + _operation = OperationInternal.Succeeded(response); + } + + internal RecoveryServicesDataReplicationArmOperation(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, "RecoveryServicesDataReplicationArmOperation", 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/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/LongRunningOperation/RecoveryServicesDataReplicationArmOperationOfT.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/LongRunningOperation/RecoveryServicesDataReplicationArmOperationOfT.cs new file mode 100644 index 000000000000..7912bde0baea --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/LongRunningOperation/RecoveryServicesDataReplicationArmOperationOfT.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.RecoveryServicesDataReplication +{ +#pragma warning disable SA1649 // File name should match first type name + internal class RecoveryServicesDataReplicationArmOperation : ArmOperation +#pragma warning restore SA1649 // File name should match first type name + { + private readonly OperationInternal _operation; + + /// Initializes a new instance of RecoveryServicesDataReplicationArmOperation for mocking. + protected RecoveryServicesDataReplicationArmOperation() + { + } + + internal RecoveryServicesDataReplicationArmOperation(Response response) + { + _operation = OperationInternal.Succeeded(response.GetRawResponse(), response.Value); + } + + internal RecoveryServicesDataReplicationArmOperation(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, "RecoveryServicesDataReplicationArmOperation", 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/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/AzStackHciClusterProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/AzStackHciClusterProperties.Serialization.cs new file mode 100644 index 000000000000..694c68e0c9b3 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/AzStackHciClusterProperties.Serialization.cs @@ -0,0 +1,76 @@ +// 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.RecoveryServicesDataReplication.Models +{ + public partial class AzStackHciClusterProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("clusterName"u8); + writer.WriteStringValue(ClusterName); + writer.WritePropertyName("resourceName"u8); + writer.WriteStringValue(ResourceName); + writer.WritePropertyName("storageAccountName"u8); + writer.WriteStringValue(StorageAccountName); + writer.WritePropertyName("storageContainers"u8); + writer.WriteStartArray(); + foreach (var item in StorageContainers) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + writer.WriteEndObject(); + } + + internal static AzStackHciClusterProperties DeserializeAzStackHciClusterProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string clusterName = default; + string resourceName = default; + string storageAccountName = default; + IList storageContainers = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("clusterName"u8)) + { + clusterName = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceName"u8)) + { + resourceName = property.Value.GetString(); + continue; + } + if (property.NameEquals("storageAccountName"u8)) + { + storageAccountName = property.Value.GetString(); + continue; + } + if (property.NameEquals("storageContainers"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(StorageContainerProperties.DeserializeStorageContainerProperties(item)); + } + storageContainers = array; + continue; + } + } + return new AzStackHciClusterProperties(clusterName, resourceName, storageAccountName, storageContainers); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/AzStackHciClusterProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/AzStackHciClusterProperties.cs new file mode 100644 index 000000000000..1013786f311f --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/AzStackHciClusterProperties.cs @@ -0,0 +1,59 @@ +// 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.RecoveryServicesDataReplication.Models +{ + /// AzStackHCI cluster properties. + public partial class AzStackHciClusterProperties + { + /// Initializes a new instance of AzStackHciClusterProperties. + /// Gets or sets the AzStackHCICluster FQDN name. + /// Gets or sets the AzStackHCICluster resource name. + /// Gets or sets the Storage account name. + /// Gets or sets the list of AzStackHCICluster Storage Container. + /// , , or is null. + public AzStackHciClusterProperties(string clusterName, string resourceName, string storageAccountName, IEnumerable storageContainers) + { + Argument.AssertNotNull(clusterName, nameof(clusterName)); + Argument.AssertNotNull(resourceName, nameof(resourceName)); + Argument.AssertNotNull(storageAccountName, nameof(storageAccountName)); + Argument.AssertNotNull(storageContainers, nameof(storageContainers)); + + ClusterName = clusterName; + ResourceName = resourceName; + StorageAccountName = storageAccountName; + StorageContainers = storageContainers.ToList(); + } + + /// Initializes a new instance of AzStackHciClusterProperties. + /// Gets or sets the AzStackHCICluster FQDN name. + /// Gets or sets the AzStackHCICluster resource name. + /// Gets or sets the Storage account name. + /// Gets or sets the list of AzStackHCICluster Storage Container. + internal AzStackHciClusterProperties(string clusterName, string resourceName, string storageAccountName, IList storageContainers) + { + ClusterName = clusterName; + ResourceName = resourceName; + StorageAccountName = storageAccountName; + StorageContainers = storageContainers; + } + + /// Gets or sets the AzStackHCICluster FQDN name. + public string ClusterName { get; set; } + /// Gets or sets the AzStackHCICluster resource name. + public string ResourceName { get; set; } + /// Gets or sets the Storage account name. + public string StorageAccountName { get; set; } + /// Gets or sets the list of AzStackHCICluster Storage Container. + public IList StorageContainers { get; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/AzStackHciFabricModelCustomProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/AzStackHciFabricModelCustomProperties.Serialization.cs new file mode 100644 index 000000000000..bcb35853b0f3 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/AzStackHciFabricModelCustomProperties.Serialization.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + public partial class AzStackHciFabricModelCustomProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("azStackHciSiteId"u8); + writer.WriteStringValue(AzStackHciSiteId); + writer.WritePropertyName("cluster"u8); + writer.WriteObjectValue(Cluster); + writer.WritePropertyName("migrationSolutionId"u8); + writer.WriteStringValue(MigrationSolutionId); + writer.WritePropertyName("instanceType"u8); + writer.WriteStringValue(InstanceType); + writer.WriteEndObject(); + } + + internal static AzStackHciFabricModelCustomProperties DeserializeAzStackHciFabricModelCustomProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier azStackHciSiteId = default; + Optional> applianceName = default; + AzStackHciClusterProperties cluster = default; + Optional fabricResourceId = default; + Optional fabricContainerId = default; + ResourceIdentifier migrationSolutionId = default; + Optional migrationHubUri = default; + string instanceType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("azStackHciSiteId"u8)) + { + azStackHciSiteId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("applianceName"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + applianceName = array; + continue; + } + if (property.NameEquals("cluster"u8)) + { + cluster = AzStackHciClusterProperties.DeserializeAzStackHciClusterProperties(property.Value); + continue; + } + if (property.NameEquals("fabricResourceId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + fabricResourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("fabricContainerId"u8)) + { + fabricContainerId = property.Value.GetString(); + continue; + } + if (property.NameEquals("migrationSolutionId"u8)) + { + migrationSolutionId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("migrationHubUri"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + migrationHubUri = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("instanceType"u8)) + { + instanceType = property.Value.GetString(); + continue; + } + } + return new AzStackHciFabricModelCustomProperties(instanceType, azStackHciSiteId, Optional.ToList(applianceName), cluster, fabricResourceId.Value, fabricContainerId.Value, migrationSolutionId, migrationHubUri.Value); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/AzStackHciFabricModelCustomProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/AzStackHciFabricModelCustomProperties.cs new file mode 100644 index 000000000000..a6dfbbe62797 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/AzStackHciFabricModelCustomProperties.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// AzStackHCI fabric model custom properties. + public partial class AzStackHciFabricModelCustomProperties : FabricModelCustomProperties + { + /// Initializes a new instance of AzStackHciFabricModelCustomProperties. + /// Gets or sets the ARM Id of the AzStackHCI site. + /// AzStackHCI cluster properties. + /// Gets or sets the Migration solution ARM Id. + /// , or is null. + public AzStackHciFabricModelCustomProperties(ResourceIdentifier azStackHciSiteId, AzStackHciClusterProperties cluster, ResourceIdentifier migrationSolutionId) + { + Argument.AssertNotNull(azStackHciSiteId, nameof(azStackHciSiteId)); + Argument.AssertNotNull(cluster, nameof(cluster)); + Argument.AssertNotNull(migrationSolutionId, nameof(migrationSolutionId)); + + AzStackHciSiteId = azStackHciSiteId; + ApplianceName = new ChangeTrackingList(); + Cluster = cluster; + MigrationSolutionId = migrationSolutionId; + InstanceType = "AzStackHCI"; + } + + /// Initializes a new instance of AzStackHciFabricModelCustomProperties. + /// Gets or sets the instance type. + /// Gets or sets the ARM Id of the AzStackHCI site. + /// Gets or sets the Appliance name. + /// AzStackHCI cluster properties. + /// Gets or sets the fabric resource Id. + /// Gets or sets the fabric container Id. + /// Gets or sets the Migration solution ARM Id. + /// Gets or sets the migration hub Uri. + internal AzStackHciFabricModelCustomProperties(string instanceType, ResourceIdentifier azStackHciSiteId, IReadOnlyList applianceName, AzStackHciClusterProperties cluster, ResourceIdentifier fabricResourceId, string fabricContainerId, ResourceIdentifier migrationSolutionId, Uri migrationHubUri) : base(instanceType) + { + AzStackHciSiteId = azStackHciSiteId; + ApplianceName = applianceName; + Cluster = cluster; + FabricResourceId = fabricResourceId; + FabricContainerId = fabricContainerId; + MigrationSolutionId = migrationSolutionId; + MigrationHubUri = migrationHubUri; + InstanceType = instanceType ?? "AzStackHCI"; + } + + /// Gets or sets the ARM Id of the AzStackHCI site. + public ResourceIdentifier AzStackHciSiteId { get; set; } + /// Gets or sets the Appliance name. + public IReadOnlyList ApplianceName { get; } + /// AzStackHCI cluster properties. + public AzStackHciClusterProperties Cluster { get; set; } + /// Gets or sets the fabric resource Id. + public ResourceIdentifier FabricResourceId { get; } + /// Gets or sets the fabric container Id. + public string FabricContainerId { get; } + /// Gets or sets the Migration solution ARM Id. + public ResourceIdentifier MigrationSolutionId { get; set; } + /// Gets or sets the migration hub Uri. + public Uri MigrationHubUri { get; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationDraData.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationDraData.Serialization.cs new file mode 100644 index 000000000000..e8719f1eec74 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationDraData.Serialization.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication +{ + public partial class DataReplicationDraData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + writer.WriteEndObject(); + } + + internal static DataReplicationDraData DeserializeDataReplicationDraData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DataReplicationDraProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + properties = DataReplicationDraProperties.DeserializeDataReplicationDraProperties(property.Value); + 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; + } + } + return new DataReplicationDraData(id, name, type, systemData.Value, properties); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationDraListResult.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationDraListResult.Serialization.cs new file mode 100644 index 000000000000..da8f08f38928 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationDraListResult.Serialization.cs @@ -0,0 +1,50 @@ +// 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; +using Azure.ResourceManager.RecoveryServicesDataReplication; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + internal partial class DataReplicationDraListResult + { + internal static DataReplicationDraListResult DeserializeDataReplicationDraListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DataReplicationDraData.DeserializeDataReplicationDraData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new DataReplicationDraListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationDraListResult.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationDraListResult.cs new file mode 100644 index 000000000000..db148277e2c2 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationDraListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.RecoveryServicesDataReplication; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// Dra model collection. + internal partial class DataReplicationDraListResult + { + /// Initializes a new instance of DataReplicationDraListResult. + internal DataReplicationDraListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of DataReplicationDraListResult. + /// Gets or sets the list of Dras. + /// Gets or sets the value of next link. + internal DataReplicationDraListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Gets or sets the list of Dras. + public IReadOnlyList Value { get; } + /// Gets or sets the value of next link. + public string NextLink { get; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationDraProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationDraProperties.Serialization.cs new file mode 100644 index 000000000000..19114a099bf8 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationDraProperties.Serialization.cs @@ -0,0 +1,132 @@ +// 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; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + public partial class DataReplicationDraProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("machineId"u8); + writer.WriteStringValue(MachineId); + writer.WritePropertyName("machineName"u8); + writer.WriteStringValue(MachineName); + writer.WritePropertyName("authenticationIdentity"u8); + writer.WriteObjectValue(AuthenticationIdentity); + writer.WritePropertyName("resourceAccessIdentity"u8); + writer.WriteObjectValue(ResourceAccessIdentity); + writer.WritePropertyName("customProperties"u8); + writer.WriteObjectValue(CustomProperties); + writer.WriteEndObject(); + } + + internal static DataReplicationDraProperties DeserializeDataReplicationDraProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional correlationId = default; + string machineId = default; + string machineName = default; + DataReplicationIdentity authenticationIdentity = default; + DataReplicationIdentity resourceAccessIdentity = default; + Optional isResponsive = default; + Optional lastHeartbeat = default; + Optional versionNumber = default; + Optional provisioningState = default; + Optional> healthErrors = default; + DraModelCustomProperties customProperties = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("correlationId"u8)) + { + correlationId = property.Value.GetString(); + continue; + } + if (property.NameEquals("machineId"u8)) + { + machineId = property.Value.GetString(); + continue; + } + if (property.NameEquals("machineName"u8)) + { + machineName = property.Value.GetString(); + continue; + } + if (property.NameEquals("authenticationIdentity"u8)) + { + authenticationIdentity = DataReplicationIdentity.DeserializeDataReplicationIdentity(property.Value); + continue; + } + if (property.NameEquals("resourceAccessIdentity"u8)) + { + resourceAccessIdentity = DataReplicationIdentity.DeserializeDataReplicationIdentity(property.Value); + continue; + } + if (property.NameEquals("isResponsive"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isResponsive = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("lastHeartbeat"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastHeartbeat = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("versionNumber"u8)) + { + versionNumber = property.Value.GetString(); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new DataReplicationProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("healthErrors"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DataReplicationHealthErrorInfo.DeserializeDataReplicationHealthErrorInfo(item)); + } + healthErrors = array; + continue; + } + if (property.NameEquals("customProperties"u8)) + { + customProperties = DraModelCustomProperties.DeserializeDraModelCustomProperties(property.Value); + continue; + } + } + return new DataReplicationDraProperties(correlationId.Value, machineId, machineName, authenticationIdentity, resourceAccessIdentity, Optional.ToNullable(isResponsive), Optional.ToNullable(lastHeartbeat), versionNumber.Value, Optional.ToNullable(provisioningState), Optional.ToList(healthErrors), customProperties); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationDraProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationDraProperties.cs new file mode 100644 index 000000000000..0b9953a696db --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationDraProperties.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// Dra model properties. + public partial class DataReplicationDraProperties + { + /// Initializes a new instance of DataReplicationDraProperties. + /// Gets or sets the machine Id where Dra is running. + /// Gets or sets the machine name where Dra is running. + /// Identity model. + /// Identity model. + /// + /// Dra model custom properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// , , , or is null. + public DataReplicationDraProperties(string machineId, string machineName, DataReplicationIdentity authenticationIdentity, DataReplicationIdentity resourceAccessIdentity, DraModelCustomProperties customProperties) + { + Argument.AssertNotNull(machineId, nameof(machineId)); + Argument.AssertNotNull(machineName, nameof(machineName)); + Argument.AssertNotNull(authenticationIdentity, nameof(authenticationIdentity)); + Argument.AssertNotNull(resourceAccessIdentity, nameof(resourceAccessIdentity)); + Argument.AssertNotNull(customProperties, nameof(customProperties)); + + MachineId = machineId; + MachineName = machineName; + AuthenticationIdentity = authenticationIdentity; + ResourceAccessIdentity = resourceAccessIdentity; + HealthErrors = new ChangeTrackingList(); + CustomProperties = customProperties; + } + + /// Initializes a new instance of DataReplicationDraProperties. + /// Gets or sets the Dra correlation Id. + /// Gets or sets the machine Id where Dra is running. + /// Gets or sets the machine name where Dra is running. + /// Identity model. + /// Identity model. + /// Gets or sets a value indicating whether Dra is responsive. + /// Gets or sets the time when last heartbeat was sent by the Dra. + /// Gets or sets the Dra version. + /// Gets or sets the provisioning state of the Dra. + /// Gets or sets the list of health errors. + /// + /// Dra model custom properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + internal DataReplicationDraProperties(string correlationId, string machineId, string machineName, DataReplicationIdentity authenticationIdentity, DataReplicationIdentity resourceAccessIdentity, bool? isResponsive, DateTimeOffset? lastHeartbeatOn, string versionNumber, DataReplicationProvisioningState? provisioningState, IReadOnlyList healthErrors, DraModelCustomProperties customProperties) + { + CorrelationId = correlationId; + MachineId = machineId; + MachineName = machineName; + AuthenticationIdentity = authenticationIdentity; + ResourceAccessIdentity = resourceAccessIdentity; + IsResponsive = isResponsive; + LastHeartbeatOn = lastHeartbeatOn; + VersionNumber = versionNumber; + ProvisioningState = provisioningState; + HealthErrors = healthErrors; + CustomProperties = customProperties; + } + + /// Gets or sets the Dra correlation Id. + public string CorrelationId { get; } + /// Gets or sets the machine Id where Dra is running. + public string MachineId { get; set; } + /// Gets or sets the machine name where Dra is running. + public string MachineName { get; set; } + /// Identity model. + public DataReplicationIdentity AuthenticationIdentity { get; set; } + /// Identity model. + public DataReplicationIdentity ResourceAccessIdentity { get; set; } + /// Gets or sets a value indicating whether Dra is responsive. + public bool? IsResponsive { get; } + /// Gets or sets the time when last heartbeat was sent by the Dra. + public DateTimeOffset? LastHeartbeatOn { get; } + /// Gets or sets the Dra version. + public string VersionNumber { get; } + /// Gets or sets the provisioning state of the Dra. + public DataReplicationProvisioningState? ProvisioningState { get; } + /// Gets or sets the list of health errors. + public IReadOnlyList HealthErrors { get; } + /// + /// Dra model custom properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public DraModelCustomProperties CustomProperties { get; set; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationEmailConfigurationData.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationEmailConfigurationData.Serialization.cs new file mode 100644 index 000000000000..ad70bd13aa22 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationEmailConfigurationData.Serialization.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication +{ + public partial class DataReplicationEmailConfigurationData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + writer.WriteEndObject(); + } + + internal static DataReplicationEmailConfigurationData DeserializeDataReplicationEmailConfigurationData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DataReplicationEmailConfigurationProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + properties = DataReplicationEmailConfigurationProperties.DeserializeDataReplicationEmailConfigurationProperties(property.Value); + 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; + } + } + return new DataReplicationEmailConfigurationData(id, name, type, systemData.Value, properties); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationEmailConfigurationListResult.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationEmailConfigurationListResult.Serialization.cs new file mode 100644 index 000000000000..2b3a68ad1ccf --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationEmailConfigurationListResult.Serialization.cs @@ -0,0 +1,50 @@ +// 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; +using Azure.ResourceManager.RecoveryServicesDataReplication; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + internal partial class DataReplicationEmailConfigurationListResult + { + internal static DataReplicationEmailConfigurationListResult DeserializeDataReplicationEmailConfigurationListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DataReplicationEmailConfigurationData.DeserializeDataReplicationEmailConfigurationData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new DataReplicationEmailConfigurationListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationEmailConfigurationListResult.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationEmailConfigurationListResult.cs new file mode 100644 index 000000000000..3db0df701460 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationEmailConfigurationListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.RecoveryServicesDataReplication; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// Email configuration model collection. + internal partial class DataReplicationEmailConfigurationListResult + { + /// Initializes a new instance of DataReplicationEmailConfigurationListResult. + internal DataReplicationEmailConfigurationListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of DataReplicationEmailConfigurationListResult. + /// Gets or sets the list of email configurations. + /// Gets or sets the value of next link. + internal DataReplicationEmailConfigurationListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Gets or sets the list of email configurations. + public IReadOnlyList Value { get; } + /// Gets or sets the value of next link. + public string NextLink { get; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationEmailConfigurationProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationEmailConfigurationProperties.Serialization.cs new file mode 100644 index 000000000000..572a3a13a8b6 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationEmailConfigurationProperties.Serialization.cs @@ -0,0 +1,78 @@ +// 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.RecoveryServicesDataReplication.Models +{ + public partial class DataReplicationEmailConfigurationProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("sendToOwners"u8); + writer.WriteBooleanValue(SendToOwners); + if (Optional.IsCollectionDefined(CustomEmailAddresses)) + { + writer.WritePropertyName("customEmailAddresses"u8); + writer.WriteStartArray(); + foreach (var item in CustomEmailAddresses) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Locale)) + { + writer.WritePropertyName("locale"u8); + writer.WriteStringValue(Locale); + } + writer.WriteEndObject(); + } + + internal static DataReplicationEmailConfigurationProperties DeserializeDataReplicationEmailConfigurationProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool sendToOwners = default; + Optional> customEmailAddresses = default; + Optional locale = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sendToOwners"u8)) + { + sendToOwners = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("customEmailAddresses"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + customEmailAddresses = array; + continue; + } + if (property.NameEquals("locale"u8)) + { + locale = property.Value.GetString(); + continue; + } + } + return new DataReplicationEmailConfigurationProperties(sendToOwners, Optional.ToList(customEmailAddresses), locale.Value); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationEmailConfigurationProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationEmailConfigurationProperties.cs new file mode 100644 index 000000000000..af20a35802ed --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationEmailConfigurationProperties.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// Email configuration model properties. + public partial class DataReplicationEmailConfigurationProperties + { + /// Initializes a new instance of DataReplicationEmailConfigurationProperties. + /// Gets or sets a value indicating whether to send email to subscription administrator. + public DataReplicationEmailConfigurationProperties(bool sendToOwners) + { + SendToOwners = sendToOwners; + CustomEmailAddresses = new ChangeTrackingList(); + } + + /// Initializes a new instance of DataReplicationEmailConfigurationProperties. + /// Gets or sets a value indicating whether to send email to subscription administrator. + /// Gets or sets the custom email address for sending emails. + /// Gets or sets the locale for the email notification. + internal DataReplicationEmailConfigurationProperties(bool sendToOwners, IList customEmailAddresses, string locale) + { + SendToOwners = sendToOwners; + CustomEmailAddresses = customEmailAddresses; + Locale = locale; + } + + /// Gets or sets a value indicating whether to send email to subscription administrator. + public bool SendToOwners { get; set; } + /// Gets or sets the custom email address for sending emails. + public IList CustomEmailAddresses { get; } + /// Gets or sets the locale for the email notification. + public string Locale { get; set; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationErrorInfo.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationErrorInfo.Serialization.cs new file mode 100644 index 000000000000..19fc8d52cb45 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationErrorInfo.Serialization.cs @@ -0,0 +1,74 @@ +// 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.RecoveryServicesDataReplication.Models +{ + public partial class DataReplicationErrorInfo + { + internal static DataReplicationErrorInfo DeserializeDataReplicationErrorInfo(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional code = default; + Optional type = default; + Optional severity = default; + Optional creationTime = default; + Optional message = default; + Optional causes = default; + Optional recommendation = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("code"u8)) + { + code = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("severity"u8)) + { + severity = property.Value.GetString(); + continue; + } + if (property.NameEquals("creationTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + creationTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("message"u8)) + { + message = property.Value.GetString(); + continue; + } + if (property.NameEquals("causes"u8)) + { + causes = property.Value.GetString(); + continue; + } + if (property.NameEquals("recommendation"u8)) + { + recommendation = property.Value.GetString(); + continue; + } + } + return new DataReplicationErrorInfo(code.Value, type.Value, severity.Value, Optional.ToNullable(creationTime), message.Value, causes.Value, recommendation.Value); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationErrorInfo.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationErrorInfo.cs new file mode 100644 index 000000000000..0fb3b99cc071 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationErrorInfo.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// Error model. + public partial class DataReplicationErrorInfo + { + /// Initializes a new instance of DataReplicationErrorInfo. + internal DataReplicationErrorInfo() + { + } + + /// Initializes a new instance of DataReplicationErrorInfo. + /// Gets or sets the error code. + /// Gets or sets the error type. + /// Gets or sets the error severity. + /// Gets or sets the creation time of error. + /// Gets or sets the error message. + /// Gets or sets the possible causes of error. + /// Gets or sets the recommended action to resolve error. + internal DataReplicationErrorInfo(string code, string errorModelType, string severity, DateTimeOffset? createdOn, string message, string causes, string recommendation) + { + Code = code; + ErrorModelType = errorModelType; + Severity = severity; + CreatedOn = createdOn; + Message = message; + Causes = causes; + Recommendation = recommendation; + } + + /// Gets or sets the error code. + public string Code { get; } + /// Gets or sets the error type. + public string ErrorModelType { get; } + /// Gets or sets the error severity. + public string Severity { get; } + /// Gets or sets the creation time of error. + public DateTimeOffset? CreatedOn { get; } + /// Gets or sets the error message. + public string Message { get; } + /// Gets or sets the possible causes of error. + public string Causes { get; } + /// Gets or sets the recommended action to resolve error. + public string Recommendation { get; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationEventData.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationEventData.Serialization.cs new file mode 100644 index 000000000000..64bf7c75efd8 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationEventData.Serialization.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication +{ + public partial class DataReplicationEventData + { + internal static DataReplicationEventData DeserializeDataReplicationEventData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DataReplicationEventProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + properties = DataReplicationEventProperties.DeserializeDataReplicationEventProperties(property.Value); + 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; + } + } + return new DataReplicationEventData(id, name, type, systemData.Value, properties); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationEventListResult.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationEventListResult.Serialization.cs new file mode 100644 index 000000000000..568ea8fcb8b8 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationEventListResult.Serialization.cs @@ -0,0 +1,50 @@ +// 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; +using Azure.ResourceManager.RecoveryServicesDataReplication; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + internal partial class DataReplicationEventListResult + { + internal static DataReplicationEventListResult DeserializeDataReplicationEventListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DataReplicationEventData.DeserializeDataReplicationEventData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new DataReplicationEventListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationEventListResult.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationEventListResult.cs new file mode 100644 index 000000000000..d91050efb131 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationEventListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.RecoveryServicesDataReplication; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// Event model collection. + internal partial class DataReplicationEventListResult + { + /// Initializes a new instance of DataReplicationEventListResult. + internal DataReplicationEventListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of DataReplicationEventListResult. + /// Gets or sets the list of events. + /// Gets or sets the value of next link. + internal DataReplicationEventListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Gets or sets the list of events. + public IReadOnlyList Value { get; } + /// Gets or sets the value of next link. + public string NextLink { get; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationEventProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationEventProperties.Serialization.cs new file mode 100644 index 000000000000..fea428828c19 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationEventProperties.Serialization.cs @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + public partial class DataReplicationEventProperties + { + internal static DataReplicationEventProperties DeserializeDataReplicationEventProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional resourceType = default; + Optional resourceName = default; + Optional eventType = default; + Optional eventName = default; + Optional timeOfOccurrence = default; + Optional severity = default; + Optional description = default; + Optional correlationId = default; + Optional> healthErrors = default; + EventModelCustomProperties customProperties = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("resourceType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("resourceName"u8)) + { + resourceName = property.Value.GetString(); + continue; + } + if (property.NameEquals("eventType"u8)) + { + eventType = property.Value.GetString(); + continue; + } + if (property.NameEquals("eventName"u8)) + { + eventName = property.Value.GetString(); + continue; + } + if (property.NameEquals("timeOfOccurrence"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + timeOfOccurrence = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("severity"u8)) + { + severity = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("correlationId"u8)) + { + correlationId = property.Value.GetString(); + continue; + } + if (property.NameEquals("healthErrors"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DataReplicationHealthErrorInfo.DeserializeDataReplicationHealthErrorInfo(item)); + } + healthErrors = array; + continue; + } + if (property.NameEquals("customProperties"u8)) + { + customProperties = EventModelCustomProperties.DeserializeEventModelCustomProperties(property.Value); + continue; + } + } + return new DataReplicationEventProperties(Optional.ToNullable(resourceType), resourceName.Value, eventType.Value, eventName.Value, Optional.ToNullable(timeOfOccurrence), severity.Value, description.Value, correlationId.Value, Optional.ToList(healthErrors), customProperties); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationEventProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationEventProperties.cs new file mode 100644 index 000000000000..485c7347e58b --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationEventProperties.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// Event model properties. + public partial class DataReplicationEventProperties + { + /// Initializes a new instance of DataReplicationEventProperties. + /// + /// Event model custom properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + /// is null. + internal DataReplicationEventProperties(EventModelCustomProperties customProperties) + { + Argument.AssertNotNull(customProperties, nameof(customProperties)); + + HealthErrors = new ChangeTrackingList(); + CustomProperties = customProperties; + } + + /// Initializes a new instance of DataReplicationEventProperties. + /// Gets or sets the resource type. + /// Gets or sets the resource name. + /// Gets or sets the event type. + /// Gets or sets the event name. + /// Gets or sets the time at which the event occurred at source. + /// Gets or sets the event severity. + /// Gets or sets the event description. + /// Gets or sets the event correlation Id. + /// Gets or sets the errors associated with this event. + /// + /// Event model custom properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + internal DataReplicationEventProperties(ResourceType? resourceType, string resourceName, string eventType, string eventName, DateTimeOffset? occurredOn, string severity, string description, string correlationId, IReadOnlyList healthErrors, EventModelCustomProperties customProperties) + { + ResourceType = resourceType; + ResourceName = resourceName; + EventType = eventType; + EventName = eventName; + OccurredOn = occurredOn; + Severity = severity; + Description = description; + CorrelationId = correlationId; + HealthErrors = healthErrors; + CustomProperties = customProperties; + } + + /// Gets or sets the resource type. + public ResourceType? ResourceType { get; } + /// Gets or sets the resource name. + public string ResourceName { get; } + /// Gets or sets the event type. + public string EventType { get; } + /// Gets or sets the event name. + public string EventName { get; } + /// Gets or sets the time at which the event occurred at source. + public DateTimeOffset? OccurredOn { get; } + /// Gets or sets the event severity. + public string Severity { get; } + /// Gets or sets the event description. + public string Description { get; } + /// Gets or sets the event correlation Id. + public string CorrelationId { get; } + /// Gets or sets the errors associated with this event. + public IReadOnlyList HealthErrors { get; } + /// + /// Event model custom properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + public EventModelCustomProperties CustomProperties { get; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationFabricData.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationFabricData.Serialization.cs new file mode 100644 index 000000000000..652ace3a42b6 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationFabricData.Serialization.cs @@ -0,0 +1,106 @@ +// 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; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication +{ + public partial class DataReplicationFabricData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + 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.WriteEndObject(); + } + + internal static DataReplicationFabricData DeserializeDataReplicationFabricData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DataReplicationFabricProperties properties = default; + Optional> tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + properties = DataReplicationFabricProperties.DeserializeDataReplicationFabricProperties(property.Value); + 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; + } + } + return new DataReplicationFabricData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationFabricListResult.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationFabricListResult.Serialization.cs new file mode 100644 index 000000000000..e3181820401b --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationFabricListResult.Serialization.cs @@ -0,0 +1,50 @@ +// 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; +using Azure.ResourceManager.RecoveryServicesDataReplication; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + internal partial class DataReplicationFabricListResult + { + internal static DataReplicationFabricListResult DeserializeDataReplicationFabricListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DataReplicationFabricData.DeserializeDataReplicationFabricData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new DataReplicationFabricListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationFabricListResult.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationFabricListResult.cs new file mode 100644 index 000000000000..c33c5ed1ca8d --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationFabricListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.RecoveryServicesDataReplication; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// Fabric model collection. + internal partial class DataReplicationFabricListResult + { + /// Initializes a new instance of DataReplicationFabricListResult. + internal DataReplicationFabricListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of DataReplicationFabricListResult. + /// Gets or sets the list of fabrics. + /// Gets or sets the value of next link. + internal DataReplicationFabricListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Gets or sets the list of fabrics. + public IReadOnlyList Value { get; } + /// Gets or sets the value of next link. + public string NextLink { get; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationFabricPatch.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationFabricPatch.Serialization.cs new file mode 100644 index 000000000000..125103b95f01 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationFabricPatch.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.RecoveryServicesDataReplication.Models +{ + public partial class DataReplicationFabricPatch : 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(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationFabricPatch.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationFabricPatch.cs new file mode 100644 index 000000000000..8099d15fcde9 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationFabricPatch.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.RecoveryServicesDataReplication.Models +{ + /// Fabric model for update. + public partial class DataReplicationFabricPatch : ResourceData + { + /// Initializes a new instance of DataReplicationFabricPatch. + public DataReplicationFabricPatch() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Gets or sets the resource tags. + public IDictionary Tags { get; } + /// Fabric model properties. + public DataReplicationFabricProperties Properties { get; set; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationFabricProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationFabricProperties.Serialization.cs new file mode 100644 index 000000000000..c0c83ce243e2 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationFabricProperties.Serialization.cs @@ -0,0 +1,93 @@ +// 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.RecoveryServicesDataReplication.Models +{ + public partial class DataReplicationFabricProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("customProperties"u8); + writer.WriteObjectValue(CustomProperties); + writer.WriteEndObject(); + } + + internal static DataReplicationFabricProperties DeserializeDataReplicationFabricProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional provisioningState = default; + Optional serviceEndpoint = default; + Optional serviceResourceId = default; + Optional health = default; + Optional> healthErrors = default; + FabricModelCustomProperties customProperties = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new DataReplicationProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("serviceEndpoint"u8)) + { + serviceEndpoint = property.Value.GetString(); + continue; + } + if (property.NameEquals("serviceResourceId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + serviceResourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("health"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + health = new DataReplicationHealthStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("healthErrors"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DataReplicationHealthErrorInfo.DeserializeDataReplicationHealthErrorInfo(item)); + } + healthErrors = array; + continue; + } + if (property.NameEquals("customProperties"u8)) + { + customProperties = FabricModelCustomProperties.DeserializeFabricModelCustomProperties(property.Value); + continue; + } + } + return new DataReplicationFabricProperties(Optional.ToNullable(provisioningState), serviceEndpoint.Value, serviceResourceId.Value, Optional.ToNullable(health), Optional.ToList(healthErrors), customProperties); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationFabricProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationFabricProperties.cs new file mode 100644 index 000000000000..16be443cccd4 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationFabricProperties.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// Fabric model properties. + public partial class DataReplicationFabricProperties + { + /// Initializes a new instance of DataReplicationFabricProperties. + /// + /// Fabric model custom properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , and . + /// + /// is null. + public DataReplicationFabricProperties(FabricModelCustomProperties customProperties) + { + Argument.AssertNotNull(customProperties, nameof(customProperties)); + + HealthErrors = new ChangeTrackingList(); + CustomProperties = customProperties; + } + + /// Initializes a new instance of DataReplicationFabricProperties. + /// Gets or sets the provisioning state of the fabric. + /// Gets or sets the service endpoint. + /// Gets or sets the service resource Id. + /// Gets or sets the fabric health. + /// Gets or sets the list of health errors. + /// + /// Fabric model custom properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , and . + /// + internal DataReplicationFabricProperties(DataReplicationProvisioningState? provisioningState, string serviceEndpoint, ResourceIdentifier serviceResourceId, DataReplicationHealthStatus? health, IReadOnlyList healthErrors, FabricModelCustomProperties customProperties) + { + ProvisioningState = provisioningState; + ServiceEndpoint = serviceEndpoint; + ServiceResourceId = serviceResourceId; + Health = health; + HealthErrors = healthErrors; + CustomProperties = customProperties; + } + + /// Gets or sets the provisioning state of the fabric. + public DataReplicationProvisioningState? ProvisioningState { get; } + /// Gets or sets the service endpoint. + public string ServiceEndpoint { get; } + /// Gets or sets the service resource Id. + public ResourceIdentifier ServiceResourceId { get; } + /// Gets or sets the fabric health. + public DataReplicationHealthStatus? Health { get; } + /// Gets or sets the list of health errors. + public IReadOnlyList HealthErrors { get; } + /// + /// Fabric model custom properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , and . + /// + public FabricModelCustomProperties CustomProperties { get; set; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationHealthErrorInfo.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationHealthErrorInfo.Serialization.cs new file mode 100644 index 000000000000..b5fd235f4999 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationHealthErrorInfo.Serialization.cs @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + public partial class DataReplicationHealthErrorInfo + { + internal static DataReplicationHealthErrorInfo DeserializeDataReplicationHealthErrorInfo(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional affectedResourceType = default; + Optional> affectedResourceCorrelationIds = default; + Optional> childErrors = default; + Optional code = default; + Optional healthCategory = default; + Optional category = default; + Optional severity = default; + Optional source = default; + Optional creationTime = default; + Optional isCustomerResolvable = default; + Optional summary = default; + Optional message = default; + Optional causes = default; + Optional recommendation = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("affectedResourceType"u8)) + { + affectedResourceType = property.Value.GetString(); + continue; + } + if (property.NameEquals("affectedResourceCorrelationIds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + affectedResourceCorrelationIds = array; + continue; + } + if (property.NameEquals("childErrors"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DataReplicationInnerHealthErrorInfo.DeserializeDataReplicationInnerHealthErrorInfo(item)); + } + childErrors = array; + continue; + } + if (property.NameEquals("code"u8)) + { + code = property.Value.GetString(); + continue; + } + if (property.NameEquals("healthCategory"u8)) + { + healthCategory = property.Value.GetString(); + continue; + } + if (property.NameEquals("category"u8)) + { + category = property.Value.GetString(); + continue; + } + if (property.NameEquals("severity"u8)) + { + severity = property.Value.GetString(); + continue; + } + if (property.NameEquals("source"u8)) + { + source = property.Value.GetString(); + continue; + } + if (property.NameEquals("creationTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + creationTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("isCustomerResolvable"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isCustomerResolvable = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("summary"u8)) + { + summary = property.Value.GetString(); + continue; + } + if (property.NameEquals("message"u8)) + { + message = property.Value.GetString(); + continue; + } + if (property.NameEquals("causes"u8)) + { + causes = property.Value.GetString(); + continue; + } + if (property.NameEquals("recommendation"u8)) + { + recommendation = property.Value.GetString(); + continue; + } + } + return new DataReplicationHealthErrorInfo(affectedResourceType.Value, Optional.ToList(affectedResourceCorrelationIds), Optional.ToList(childErrors), code.Value, healthCategory.Value, category.Value, severity.Value, source.Value, Optional.ToNullable(creationTime), Optional.ToNullable(isCustomerResolvable), summary.Value, message.Value, causes.Value, recommendation.Value); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationHealthErrorInfo.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationHealthErrorInfo.cs new file mode 100644 index 000000000000..e055252c25d0 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationHealthErrorInfo.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// Health error model. + public partial class DataReplicationHealthErrorInfo + { + /// Initializes a new instance of DataReplicationHealthErrorInfo. + internal DataReplicationHealthErrorInfo() + { + AffectedResourceCorrelationIds = new ChangeTrackingList(); + ChildErrors = new ChangeTrackingList(); + } + + /// Initializes a new instance of DataReplicationHealthErrorInfo. + /// Gets or sets the type of affected resource type. + /// + /// Gets or sets the list of affected resource correlation Ids. This can be used to + /// uniquely identify the count of items affected by a specific category and severity + /// as well as count of item affected by an specific issue. + /// + /// Gets or sets a list of child health errors associated with this error. + /// Gets or sets the error code. + /// Gets or sets the health category. + /// Gets or sets the error category. + /// Gets or sets the error severity. + /// Gets or sets the error source. + /// Gets or sets the error creation time. + /// Gets or sets a value indicating whether the error is customer resolvable. + /// Gets or sets the error summary. + /// Gets or sets the error message. + /// Gets or sets possible causes of the error. + /// Gets or sets recommended action to resolve the error. + internal DataReplicationHealthErrorInfo(string affectedResourceType, IReadOnlyList affectedResourceCorrelationIds, IReadOnlyList childErrors, string code, string healthCategory, string category, string severity, string source, DateTimeOffset? createdOn, bool? isCustomerResolvable, string summary, string message, string causes, string recommendation) + { + AffectedResourceType = affectedResourceType; + AffectedResourceCorrelationIds = affectedResourceCorrelationIds; + ChildErrors = childErrors; + Code = code; + HealthCategory = healthCategory; + Category = category; + Severity = severity; + Source = source; + CreatedOn = createdOn; + IsCustomerResolvable = isCustomerResolvable; + Summary = summary; + Message = message; + Causes = causes; + Recommendation = recommendation; + } + + /// Gets or sets the type of affected resource type. + public string AffectedResourceType { get; } + /// + /// Gets or sets the list of affected resource correlation Ids. This can be used to + /// uniquely identify the count of items affected by a specific category and severity + /// as well as count of item affected by an specific issue. + /// + public IReadOnlyList AffectedResourceCorrelationIds { get; } + /// Gets or sets a list of child health errors associated with this error. + public IReadOnlyList ChildErrors { get; } + /// Gets or sets the error code. + public string Code { get; } + /// Gets or sets the health category. + public string HealthCategory { get; } + /// Gets or sets the error category. + public string Category { get; } + /// Gets or sets the error severity. + public string Severity { get; } + /// Gets or sets the error source. + public string Source { get; } + /// Gets or sets the error creation time. + public DateTimeOffset? CreatedOn { get; } + /// Gets or sets a value indicating whether the error is customer resolvable. + public bool? IsCustomerResolvable { get; } + /// Gets or sets the error summary. + public string Summary { get; } + /// Gets or sets the error message. + public string Message { get; } + /// Gets or sets possible causes of the error. + public string Causes { get; } + /// Gets or sets recommended action to resolve the error. + public string Recommendation { get; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationHealthStatus.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationHealthStatus.cs new file mode 100644 index 000000000000..2049a1874627 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationHealthStatus.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.RecoveryServicesDataReplication.Models +{ + /// Gets or sets the fabric health. + public readonly partial struct DataReplicationHealthStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DataReplicationHealthStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NormalValue = "Normal"; + private const string WarningValue = "Warning"; + private const string CriticalValue = "Critical"; + + /// Normal. + public static DataReplicationHealthStatus Normal { get; } = new DataReplicationHealthStatus(NormalValue); + /// Warning. + public static DataReplicationHealthStatus Warning { get; } = new DataReplicationHealthStatus(WarningValue); + /// Critical. + public static DataReplicationHealthStatus Critical { get; } = new DataReplicationHealthStatus(CriticalValue); + /// Determines if two values are the same. + public static bool operator ==(DataReplicationHealthStatus left, DataReplicationHealthStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DataReplicationHealthStatus left, DataReplicationHealthStatus right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DataReplicationHealthStatus(string value) => new DataReplicationHealthStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DataReplicationHealthStatus other && Equals(other); + /// + public bool Equals(DataReplicationHealthStatus 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/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationIdentity.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationIdentity.Serialization.cs new file mode 100644 index 000000000000..34bc34af4cb9 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationIdentity.Serialization.cs @@ -0,0 +1,74 @@ +// 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.RecoveryServicesDataReplication.Models +{ + public partial class DataReplicationIdentity : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("tenantId"u8); + writer.WriteStringValue(TenantId); + writer.WritePropertyName("applicationId"u8); + writer.WriteStringValue(ApplicationId); + writer.WritePropertyName("objectId"u8); + writer.WriteStringValue(ObjectId); + writer.WritePropertyName("audience"u8); + writer.WriteStringValue(Audience); + writer.WritePropertyName("aadAuthority"u8); + writer.WriteStringValue(AadAuthority); + writer.WriteEndObject(); + } + + internal static DataReplicationIdentity DeserializeDataReplicationIdentity(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Guid tenantId = default; + string applicationId = default; + string objectId = default; + string audience = default; + string aadAuthority = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tenantId"u8)) + { + tenantId = property.Value.GetGuid(); + continue; + } + if (property.NameEquals("applicationId"u8)) + { + applicationId = property.Value.GetString(); + continue; + } + if (property.NameEquals("objectId"u8)) + { + objectId = property.Value.GetString(); + continue; + } + if (property.NameEquals("audience"u8)) + { + audience = property.Value.GetString(); + continue; + } + if (property.NameEquals("aadAuthority"u8)) + { + aadAuthority = property.Value.GetString(); + continue; + } + } + return new DataReplicationIdentity(tenantId, applicationId, objectId, audience, aadAuthority); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationIdentity.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationIdentity.cs new file mode 100644 index 000000000000..1b8f1fefd831 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationIdentity.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// Identity model. + public partial class DataReplicationIdentity + { + /// Initializes a new instance of DataReplicationIdentity. + /// Gets or sets the tenant Id of the SPN with which Dra communicates to service. + /// + /// Gets or sets the client/application Id of the SPN with which Dra communicates to + /// service. + /// + /// Gets or sets the object Id of the SPN with which Dra communicates to service. + /// Gets or sets the audience of the SPN with which Dra communicates to service. + /// Gets or sets the authority of the SPN with which Dra communicates to service. + /// , , or is null. + public DataReplicationIdentity(Guid tenantId, string applicationId, string objectId, string audience, string aadAuthority) + { + Argument.AssertNotNull(applicationId, nameof(applicationId)); + Argument.AssertNotNull(objectId, nameof(objectId)); + Argument.AssertNotNull(audience, nameof(audience)); + Argument.AssertNotNull(aadAuthority, nameof(aadAuthority)); + + TenantId = tenantId; + ApplicationId = applicationId; + ObjectId = objectId; + Audience = audience; + AadAuthority = aadAuthority; + } + + /// Gets or sets the tenant Id of the SPN with which Dra communicates to service. + public Guid TenantId { get; set; } + /// + /// Gets or sets the client/application Id of the SPN with which Dra communicates to + /// service. + /// + public string ApplicationId { get; set; } + /// Gets or sets the object Id of the SPN with which Dra communicates to service. + public string ObjectId { get; set; } + /// Gets or sets the audience of the SPN with which Dra communicates to service. + public string Audience { get; set; } + /// Gets or sets the authority of the SPN with which Dra communicates to service. + public string AadAuthority { get; set; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationInnerHealthErrorInfo.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationInnerHealthErrorInfo.Serialization.cs new file mode 100644 index 000000000000..48b8176ff59e --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationInnerHealthErrorInfo.Serialization.cs @@ -0,0 +1,102 @@ +// 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.RecoveryServicesDataReplication.Models +{ + public partial class DataReplicationInnerHealthErrorInfo + { + internal static DataReplicationInnerHealthErrorInfo DeserializeDataReplicationInnerHealthErrorInfo(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional code = default; + Optional healthCategory = default; + Optional category = default; + Optional severity = default; + Optional source = default; + Optional creationTime = default; + Optional isCustomerResolvable = default; + Optional summary = default; + Optional message = default; + Optional causes = default; + Optional recommendation = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("code"u8)) + { + code = property.Value.GetString(); + continue; + } + if (property.NameEquals("healthCategory"u8)) + { + healthCategory = property.Value.GetString(); + continue; + } + if (property.NameEquals("category"u8)) + { + category = property.Value.GetString(); + continue; + } + if (property.NameEquals("severity"u8)) + { + severity = property.Value.GetString(); + continue; + } + if (property.NameEquals("source"u8)) + { + source = property.Value.GetString(); + continue; + } + if (property.NameEquals("creationTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + creationTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("isCustomerResolvable"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isCustomerResolvable = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("summary"u8)) + { + summary = property.Value.GetString(); + continue; + } + if (property.NameEquals("message"u8)) + { + message = property.Value.GetString(); + continue; + } + if (property.NameEquals("causes"u8)) + { + causes = property.Value.GetString(); + continue; + } + if (property.NameEquals("recommendation"u8)) + { + recommendation = property.Value.GetString(); + continue; + } + } + return new DataReplicationInnerHealthErrorInfo(code.Value, healthCategory.Value, category.Value, severity.Value, source.Value, Optional.ToNullable(creationTime), Optional.ToNullable(isCustomerResolvable), summary.Value, message.Value, causes.Value, recommendation.Value); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationInnerHealthErrorInfo.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationInnerHealthErrorInfo.cs new file mode 100644 index 000000000000..fddaa303b43b --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationInnerHealthErrorInfo.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// Inner health error model. + public partial class DataReplicationInnerHealthErrorInfo + { + /// Initializes a new instance of DataReplicationInnerHealthErrorInfo. + internal DataReplicationInnerHealthErrorInfo() + { + } + + /// Initializes a new instance of DataReplicationInnerHealthErrorInfo. + /// Gets or sets the error code. + /// Gets or sets the health category. + /// Gets or sets the error category. + /// Gets or sets the error severity. + /// Gets or sets the error source. + /// Gets or sets the error creation time. + /// Gets or sets a value indicating whether the error is customer resolvable. + /// Gets or sets the error summary. + /// Gets or sets the error message. + /// Gets or sets possible causes of the error. + /// Gets or sets recommended action to resolve the error. + internal DataReplicationInnerHealthErrorInfo(string code, string healthCategory, string category, string severity, string source, DateTimeOffset? createdOn, bool? isCustomerResolvable, string summary, string message, string causes, string recommendation) + { + Code = code; + HealthCategory = healthCategory; + Category = category; + Severity = severity; + Source = source; + CreatedOn = createdOn; + IsCustomerResolvable = isCustomerResolvable; + Summary = summary; + Message = message; + Causes = causes; + Recommendation = recommendation; + } + + /// Gets or sets the error code. + public string Code { get; } + /// Gets or sets the health category. + public string HealthCategory { get; } + /// Gets or sets the error category. + public string Category { get; } + /// Gets or sets the error severity. + public string Severity { get; } + /// Gets or sets the error source. + public string Source { get; } + /// Gets or sets the error creation time. + public DateTimeOffset? CreatedOn { get; } + /// Gets or sets a value indicating whether the error is customer resolvable. + public bool? IsCustomerResolvable { get; } + /// Gets or sets the error summary. + public string Summary { get; } + /// Gets or sets the error message. + public string Message { get; } + /// Gets or sets possible causes of the error. + public string Causes { get; } + /// Gets or sets recommended action to resolve the error. + public string Recommendation { get; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationNameAvailabilityContent.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationNameAvailabilityContent.Serialization.cs new file mode 100644 index 000000000000..be9a3c5ded2e --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationNameAvailabilityContent.Serialization.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + public partial class DataReplicationNameAvailabilityContent : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(ResourceType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ResourceType.Value); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationNameAvailabilityContent.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationNameAvailabilityContent.cs new file mode 100644 index 000000000000..37cf181763f4 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationNameAvailabilityContent.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// Check name availability model. + public partial class DataReplicationNameAvailabilityContent + { + /// Initializes a new instance of DataReplicationNameAvailabilityContent. + public DataReplicationNameAvailabilityContent() + { + } + + /// Gets or sets the resource name. + public string Name { get; set; } + /// Gets or sets the resource type. + public ResourceType? ResourceType { get; set; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationNameAvailabilityResult.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationNameAvailabilityResult.Serialization.cs new file mode 100644 index 000000000000..b598fa4908a2 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationNameAvailabilityResult.Serialization.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + public partial class DataReplicationNameAvailabilityResult + { + internal static DataReplicationNameAvailabilityResult DeserializeDataReplicationNameAvailabilityResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional nameAvailable = default; + Optional reason = default; + Optional message = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("nameAvailable"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nameAvailable = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("reason"u8)) + { + reason = property.Value.GetString(); + continue; + } + if (property.NameEquals("message"u8)) + { + message = property.Value.GetString(); + continue; + } + } + return new DataReplicationNameAvailabilityResult(Optional.ToNullable(nameAvailable), reason.Value, message.Value); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationNameAvailabilityResult.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationNameAvailabilityResult.cs new file mode 100644 index 000000000000..90f45add4769 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationNameAvailabilityResult.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// Check name availability response model. + public partial class DataReplicationNameAvailabilityResult + { + /// Initializes a new instance of DataReplicationNameAvailabilityResult. + internal DataReplicationNameAvailabilityResult() + { + } + + /// Initializes a new instance of DataReplicationNameAvailabilityResult. + /// Gets or sets a value indicating whether resource name is available or not. + /// Gets or sets the reason for resource name unavailability. + /// Gets or sets the message for resource name unavailability. + internal DataReplicationNameAvailabilityResult(bool? isNameAvailable, string reason, string message) + { + IsNameAvailable = isNameAvailable; + Reason = reason; + Message = message; + } + + /// Gets or sets a value indicating whether resource name is available or not. + public bool? IsNameAvailable { get; } + /// Gets or sets the reason for resource name unavailability. + public string Reason { get; } + /// Gets or sets the message for resource name unavailability. + public string Message { get; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationPolicyData.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationPolicyData.Serialization.cs new file mode 100644 index 000000000000..8b3d11ba867a --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationPolicyData.Serialization.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication +{ + public partial class DataReplicationPolicyData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + writer.WriteEndObject(); + } + + internal static DataReplicationPolicyData DeserializeDataReplicationPolicyData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DataReplicationPolicyProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + properties = DataReplicationPolicyProperties.DeserializeDataReplicationPolicyProperties(property.Value); + 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; + } + } + return new DataReplicationPolicyData(id, name, type, systemData.Value, properties); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationPolicyListResult.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationPolicyListResult.Serialization.cs new file mode 100644 index 000000000000..434e68d8f6db --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationPolicyListResult.Serialization.cs @@ -0,0 +1,50 @@ +// 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; +using Azure.ResourceManager.RecoveryServicesDataReplication; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + internal partial class DataReplicationPolicyListResult + { + internal static DataReplicationPolicyListResult DeserializeDataReplicationPolicyListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DataReplicationPolicyData.DeserializeDataReplicationPolicyData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new DataReplicationPolicyListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationPolicyListResult.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationPolicyListResult.cs new file mode 100644 index 000000000000..26d44f068bcd --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationPolicyListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.RecoveryServicesDataReplication; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// Policy model collection. + internal partial class DataReplicationPolicyListResult + { + /// Initializes a new instance of DataReplicationPolicyListResult. + internal DataReplicationPolicyListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of DataReplicationPolicyListResult. + /// Gets or sets the list of policies. + /// Gets or sets the value of next link. + internal DataReplicationPolicyListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Gets or sets the list of policies. + public IReadOnlyList Value { get; } + /// Gets or sets the value of next link. + public string NextLink { get; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationPolicyProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationPolicyProperties.Serialization.cs new file mode 100644 index 000000000000..32e9c40c3cd2 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationPolicyProperties.Serialization.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + public partial class DataReplicationPolicyProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("customProperties"u8); + writer.WriteObjectValue(CustomProperties); + writer.WriteEndObject(); + } + + internal static DataReplicationPolicyProperties DeserializeDataReplicationPolicyProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional provisioningState = default; + PolicyModelCustomProperties customProperties = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new DataReplicationProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("customProperties"u8)) + { + customProperties = PolicyModelCustomProperties.DeserializePolicyModelCustomProperties(property.Value); + continue; + } + } + return new DataReplicationPolicyProperties(Optional.ToNullable(provisioningState), customProperties); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationPolicyProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationPolicyProperties.cs new file mode 100644 index 000000000000..9fac73a3dcfe --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationPolicyProperties.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// Policy model properties. + public partial class DataReplicationPolicyProperties + { + /// Initializes a new instance of DataReplicationPolicyProperties. + /// + /// Policy model custom properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + /// is null. + public DataReplicationPolicyProperties(PolicyModelCustomProperties customProperties) + { + Argument.AssertNotNull(customProperties, nameof(customProperties)); + + CustomProperties = customProperties; + } + + /// Initializes a new instance of DataReplicationPolicyProperties. + /// Gets or sets the provisioning state of the policy. + /// + /// Policy model custom properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + internal DataReplicationPolicyProperties(DataReplicationProvisioningState? provisioningState, PolicyModelCustomProperties customProperties) + { + ProvisioningState = provisioningState; + CustomProperties = customProperties; + } + + /// Gets or sets the provisioning state of the policy. + public DataReplicationProvisioningState? ProvisioningState { get; } + /// + /// Policy model custom properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + public PolicyModelCustomProperties CustomProperties { get; set; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationProtectedItemData.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationProtectedItemData.Serialization.cs new file mode 100644 index 000000000000..11efe660aea6 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationProtectedItemData.Serialization.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication +{ + public partial class DataReplicationProtectedItemData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + writer.WriteEndObject(); + } + + internal static DataReplicationProtectedItemData DeserializeDataReplicationProtectedItemData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DataReplicationProtectedItemProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + properties = DataReplicationProtectedItemProperties.DeserializeDataReplicationProtectedItemProperties(property.Value); + 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; + } + } + return new DataReplicationProtectedItemData(id, name, type, systemData.Value, properties); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationProtectedItemListResult.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationProtectedItemListResult.Serialization.cs new file mode 100644 index 000000000000..629048c3229a --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationProtectedItemListResult.Serialization.cs @@ -0,0 +1,50 @@ +// 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; +using Azure.ResourceManager.RecoveryServicesDataReplication; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + internal partial class DataReplicationProtectedItemListResult + { + internal static DataReplicationProtectedItemListResult DeserializeDataReplicationProtectedItemListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DataReplicationProtectedItemData.DeserializeDataReplicationProtectedItemData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new DataReplicationProtectedItemListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationProtectedItemListResult.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationProtectedItemListResult.cs new file mode 100644 index 000000000000..ee9d886acd02 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationProtectedItemListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.RecoveryServicesDataReplication; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// Protected item model collection. + internal partial class DataReplicationProtectedItemListResult + { + /// Initializes a new instance of DataReplicationProtectedItemListResult. + internal DataReplicationProtectedItemListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of DataReplicationProtectedItemListResult. + /// Gets or sets the list of protected items. + /// Gets or sets the value of next link. + internal DataReplicationProtectedItemListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Gets or sets the list of protected items. + public IReadOnlyList Value { get; } + /// Gets or sets the value of next link. + public string NextLink { get; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationProtectedItemProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationProtectedItemProperties.Serialization.cs new file mode 100644 index 000000000000..b0a4ecd3e84b --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationProtectedItemProperties.Serialization.cs @@ -0,0 +1,285 @@ +// 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; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + public partial class DataReplicationProtectedItemProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("policyName"u8); + writer.WriteStringValue(PolicyName); + writer.WritePropertyName("replicationExtensionName"u8); + writer.WriteStringValue(ReplicationExtensionName); + writer.WritePropertyName("customProperties"u8); + writer.WriteObjectValue(CustomProperties); + writer.WriteEndObject(); + } + + internal static DataReplicationProtectedItemProperties DeserializeDataReplicationProtectedItemProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string policyName = default; + string replicationExtensionName = default; + Optional correlationId = default; + Optional provisioningState = default; + Optional protectionState = default; + Optional protectionStateDescription = default; + Optional testFailoverState = default; + Optional testFailoverStateDescription = default; + Optional resynchronizationState = default; + Optional fabricObjectId = default; + Optional fabricObjectName = default; + Optional sourceFabricProviderId = default; + Optional targetFabricProviderId = default; + Optional fabricId = default; + Optional targetFabricId = default; + Optional draId = default; + Optional targetDraId = default; + Optional resyncRequired = default; + Optional lastSuccessfulPlannedFailoverTime = default; + Optional lastSuccessfulUnplannedFailoverTime = default; + Optional lastSuccessfulTestFailoverTime = default; + Optional currentJob = default; + Optional> allowedJobs = default; + Optional lastFailedEnableProtectionJob = default; + Optional lastFailedPlannedFailoverJob = default; + Optional lastTestFailoverJob = default; + Optional replicationHealth = default; + Optional> healthErrors = default; + ProtectedItemModelCustomProperties customProperties = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("policyName"u8)) + { + policyName = property.Value.GetString(); + continue; + } + if (property.NameEquals("replicationExtensionName"u8)) + { + replicationExtensionName = property.Value.GetString(); + continue; + } + if (property.NameEquals("correlationId"u8)) + { + correlationId = property.Value.GetString(); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new DataReplicationProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("protectionState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + protectionState = new DataReplicationProtectionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("protectionStateDescription"u8)) + { + protectionStateDescription = property.Value.GetString(); + continue; + } + if (property.NameEquals("testFailoverState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + testFailoverState = new DataReplicationTestFailoverState(property.Value.GetString()); + continue; + } + if (property.NameEquals("testFailoverStateDescription"u8)) + { + testFailoverStateDescription = property.Value.GetString(); + continue; + } + if (property.NameEquals("resynchronizationState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resynchronizationState = new DataReplicationResynchronizationState(property.Value.GetString()); + continue; + } + if (property.NameEquals("fabricObjectId"u8)) + { + fabricObjectId = property.Value.GetString(); + continue; + } + if (property.NameEquals("fabricObjectName"u8)) + { + fabricObjectName = property.Value.GetString(); + continue; + } + if (property.NameEquals("sourceFabricProviderId"u8)) + { + sourceFabricProviderId = property.Value.GetString(); + continue; + } + if (property.NameEquals("targetFabricProviderId"u8)) + { + targetFabricProviderId = property.Value.GetString(); + continue; + } + if (property.NameEquals("fabricId"u8)) + { + fabricId = property.Value.GetString(); + continue; + } + if (property.NameEquals("targetFabricId"u8)) + { + targetFabricId = property.Value.GetString(); + continue; + } + if (property.NameEquals("draId"u8)) + { + draId = property.Value.GetString(); + continue; + } + if (property.NameEquals("targetDraId"u8)) + { + targetDraId = property.Value.GetString(); + continue; + } + if (property.NameEquals("resyncRequired"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resyncRequired = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("lastSuccessfulPlannedFailoverTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastSuccessfulPlannedFailoverTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastSuccessfulUnplannedFailoverTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastSuccessfulUnplannedFailoverTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastSuccessfulTestFailoverTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastSuccessfulTestFailoverTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("currentJob"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + currentJob = ProtectedItemJobProperties.DeserializeProtectedItemJobProperties(property.Value); + continue; + } + if (property.NameEquals("allowedJobs"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + allowedJobs = array; + continue; + } + if (property.NameEquals("lastFailedEnableProtectionJob"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastFailedEnableProtectionJob = ProtectedItemJobProperties.DeserializeProtectedItemJobProperties(property.Value); + continue; + } + if (property.NameEquals("lastFailedPlannedFailoverJob"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastFailedPlannedFailoverJob = ProtectedItemJobProperties.DeserializeProtectedItemJobProperties(property.Value); + continue; + } + if (property.NameEquals("lastTestFailoverJob"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastTestFailoverJob = ProtectedItemJobProperties.DeserializeProtectedItemJobProperties(property.Value); + continue; + } + if (property.NameEquals("replicationHealth"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + replicationHealth = new DataReplicationHealthStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("healthErrors"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DataReplicationHealthErrorInfo.DeserializeDataReplicationHealthErrorInfo(item)); + } + healthErrors = array; + continue; + } + if (property.NameEquals("customProperties"u8)) + { + customProperties = ProtectedItemModelCustomProperties.DeserializeProtectedItemModelCustomProperties(property.Value); + continue; + } + } + return new DataReplicationProtectedItemProperties(policyName, replicationExtensionName, correlationId.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(protectionState), protectionStateDescription.Value, Optional.ToNullable(testFailoverState), testFailoverStateDescription.Value, Optional.ToNullable(resynchronizationState), fabricObjectId.Value, fabricObjectName.Value, sourceFabricProviderId.Value, targetFabricProviderId.Value, fabricId.Value, targetFabricId.Value, draId.Value, targetDraId.Value, Optional.ToNullable(resyncRequired), Optional.ToNullable(lastSuccessfulPlannedFailoverTime), Optional.ToNullable(lastSuccessfulUnplannedFailoverTime), Optional.ToNullable(lastSuccessfulTestFailoverTime), currentJob.Value, Optional.ToList(allowedJobs), lastFailedEnableProtectionJob.Value, lastFailedPlannedFailoverJob.Value, lastTestFailoverJob.Value, Optional.ToNullable(replicationHealth), Optional.ToList(healthErrors), customProperties); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationProtectedItemProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationProtectedItemProperties.cs new file mode 100644 index 000000000000..1aa4b6ca9d33 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationProtectedItemProperties.cs @@ -0,0 +1,169 @@ +// 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.RecoveryServicesDataReplication.Models +{ + /// Protected item model properties. + public partial class DataReplicationProtectedItemProperties + { + /// Initializes a new instance of DataReplicationProtectedItemProperties. + /// Gets or sets the policy name. + /// Gets or sets the replication extension name. + /// + /// Protected item model custom properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + /// , or is null. + public DataReplicationProtectedItemProperties(string policyName, string replicationExtensionName, ProtectedItemModelCustomProperties customProperties) + { + Argument.AssertNotNull(policyName, nameof(policyName)); + Argument.AssertNotNull(replicationExtensionName, nameof(replicationExtensionName)); + Argument.AssertNotNull(customProperties, nameof(customProperties)); + + PolicyName = policyName; + ReplicationExtensionName = replicationExtensionName; + AllowedJobs = new ChangeTrackingList(); + HealthErrors = new ChangeTrackingList(); + CustomProperties = customProperties; + } + + /// Initializes a new instance of DataReplicationProtectedItemProperties. + /// Gets or sets the policy name. + /// Gets or sets the replication extension name. + /// Gets or sets the protected item correlation Id. + /// Gets or sets the provisioning state of the Dra. + /// Gets or sets the protection state. + /// Gets or sets the protection state description. + /// Gets or sets the test failover state. + /// Gets or sets the Test failover state description. + /// Gets or sets the resynchronization state. + /// Gets or sets the fabric object Id. + /// Gets or sets the fabric object name. + /// Gets or sets the source fabric provider Id. + /// Gets or sets the target fabric provider Id. + /// Gets or sets the fabric Id. + /// Gets or sets the target fabric Id. + /// Gets or sets the DRA Id. + /// Gets or sets the target DRA Id. + /// Gets or sets a value indicating whether resynchronization is required or not. + /// Gets or sets the Last successful planned failover time. + /// Gets or sets the Last successful unplanned failover time. + /// Gets or sets the Last successful test failover time. + /// Protected item job properties. + /// Gets or sets the allowed scenarios on the protected item. + /// Protected item job properties. + /// Protected item job properties. + /// Protected item job properties. + /// Gets or sets protected item replication health. + /// Gets or sets the list of health errors. + /// + /// Protected item model custom properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + internal DataReplicationProtectedItemProperties(string policyName, string replicationExtensionName, string correlationId, DataReplicationProvisioningState? provisioningState, DataReplicationProtectionState? protectionState, string protectionStateDescription, DataReplicationTestFailoverState? testFailoverState, string testFailoverStateDescription, DataReplicationResynchronizationState? resynchronizationState, string fabricObjectId, string fabricObjectName, string sourceFabricProviderId, string targetFabricProviderId, string fabricId, string targetFabricId, string draId, string targetDraId, bool? isResyncRequired, DateTimeOffset? lastSuccessfulPlannedFailoverOn, DateTimeOffset? lastSuccessfulUnplannedFailoverOn, DateTimeOffset? lastSuccessfulTestFailoverOn, ProtectedItemJobProperties currentJob, IReadOnlyList allowedJobs, ProtectedItemJobProperties lastFailedEnableProtectionJob, ProtectedItemJobProperties lastFailedPlannedFailoverJob, ProtectedItemJobProperties lastTestFailoverJob, DataReplicationHealthStatus? replicationHealth, IReadOnlyList healthErrors, ProtectedItemModelCustomProperties customProperties) + { + PolicyName = policyName; + ReplicationExtensionName = replicationExtensionName; + CorrelationId = correlationId; + ProvisioningState = provisioningState; + ProtectionState = protectionState; + ProtectionStateDescription = protectionStateDescription; + TestFailoverState = testFailoverState; + TestFailoverStateDescription = testFailoverStateDescription; + ResynchronizationState = resynchronizationState; + FabricObjectId = fabricObjectId; + FabricObjectName = fabricObjectName; + SourceFabricProviderId = sourceFabricProviderId; + TargetFabricProviderId = targetFabricProviderId; + FabricId = fabricId; + TargetFabricId = targetFabricId; + DraId = draId; + TargetDraId = targetDraId; + IsResyncRequired = isResyncRequired; + LastSuccessfulPlannedFailoverOn = lastSuccessfulPlannedFailoverOn; + LastSuccessfulUnplannedFailoverOn = lastSuccessfulUnplannedFailoverOn; + LastSuccessfulTestFailoverOn = lastSuccessfulTestFailoverOn; + CurrentJob = currentJob; + AllowedJobs = allowedJobs; + LastFailedEnableProtectionJob = lastFailedEnableProtectionJob; + LastFailedPlannedFailoverJob = lastFailedPlannedFailoverJob; + LastTestFailoverJob = lastTestFailoverJob; + ReplicationHealth = replicationHealth; + HealthErrors = healthErrors; + CustomProperties = customProperties; + } + + /// Gets or sets the policy name. + public string PolicyName { get; set; } + /// Gets or sets the replication extension name. + public string ReplicationExtensionName { get; set; } + /// Gets or sets the protected item correlation Id. + public string CorrelationId { get; } + /// Gets or sets the provisioning state of the Dra. + public DataReplicationProvisioningState? ProvisioningState { get; } + /// Gets or sets the protection state. + public DataReplicationProtectionState? ProtectionState { get; } + /// Gets or sets the protection state description. + public string ProtectionStateDescription { get; } + /// Gets or sets the test failover state. + public DataReplicationTestFailoverState? TestFailoverState { get; } + /// Gets or sets the Test failover state description. + public string TestFailoverStateDescription { get; } + /// Gets or sets the resynchronization state. + public DataReplicationResynchronizationState? ResynchronizationState { get; } + /// Gets or sets the fabric object Id. + public string FabricObjectId { get; } + /// Gets or sets the fabric object name. + public string FabricObjectName { get; } + /// Gets or sets the source fabric provider Id. + public string SourceFabricProviderId { get; } + /// Gets or sets the target fabric provider Id. + public string TargetFabricProviderId { get; } + /// Gets or sets the fabric Id. + public string FabricId { get; } + /// Gets or sets the target fabric Id. + public string TargetFabricId { get; } + /// Gets or sets the DRA Id. + public string DraId { get; } + /// Gets or sets the target DRA Id. + public string TargetDraId { get; } + /// Gets or sets a value indicating whether resynchronization is required or not. + public bool? IsResyncRequired { get; } + /// Gets or sets the Last successful planned failover time. + public DateTimeOffset? LastSuccessfulPlannedFailoverOn { get; } + /// Gets or sets the Last successful unplanned failover time. + public DateTimeOffset? LastSuccessfulUnplannedFailoverOn { get; } + /// Gets or sets the Last successful test failover time. + public DateTimeOffset? LastSuccessfulTestFailoverOn { get; } + /// Protected item job properties. + public ProtectedItemJobProperties CurrentJob { get; } + /// Gets or sets the allowed scenarios on the protected item. + public IReadOnlyList AllowedJobs { get; } + /// Protected item job properties. + public ProtectedItemJobProperties LastFailedEnableProtectionJob { get; } + /// Protected item job properties. + public ProtectedItemJobProperties LastFailedPlannedFailoverJob { get; } + /// Protected item job properties. + public ProtectedItemJobProperties LastTestFailoverJob { get; } + /// Gets or sets protected item replication health. + public DataReplicationHealthStatus? ReplicationHealth { get; } + /// Gets or sets the list of health errors. + public IReadOnlyList HealthErrors { get; } + /// + /// Protected item model custom properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + public ProtectedItemModelCustomProperties CustomProperties { get; set; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationProtectionState.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationProtectionState.cs new file mode 100644 index 000000000000..391466c703cf --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationProtectionState.cs @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// Gets or sets the protection state. + public readonly partial struct DataReplicationProtectionState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DataReplicationProtectionState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnprotectedStatesBeginValue = "UnprotectedStatesBegin"; + private const string EnablingProtectionValue = "EnablingProtection"; + private const string EnablingFailedValue = "EnablingFailed"; + private const string DisablingProtectionValue = "DisablingProtection"; + private const string MarkedForDeletionValue = "MarkedForDeletion"; + private const string DisablingFailedValue = "DisablingFailed"; + private const string UnprotectedStatesEndValue = "UnprotectedStatesEnd"; + private const string InitialReplicationStatesBeginValue = "InitialReplicationStatesBegin"; + private const string InitialReplicationInProgressValue = "InitialReplicationInProgress"; + private const string InitialReplicationCompletedOnPrimaryValue = "InitialReplicationCompletedOnPrimary"; + private const string InitialReplicationCompletedOnRecoveryValue = "InitialReplicationCompletedOnRecovery"; + private const string InitialReplicationFailedValue = "InitialReplicationFailed"; + private const string InitialReplicationStatesEndValue = "InitialReplicationStatesEnd"; + private const string ProtectedStatesBeginValue = "ProtectedStatesBegin"; + private const string ProtectedValue = "Protected"; + private const string ProtectedStatesEndValue = "ProtectedStatesEnd"; + private const string PlannedFailoverTransitionStatesBeginValue = "PlannedFailoverTransitionStatesBegin"; + private const string PlannedFailoverInitiatedValue = "PlannedFailoverInitiated"; + private const string PlannedFailoverCompletingValue = "PlannedFailoverCompleting"; + private const string PlannedFailoverCompletedValue = "PlannedFailoverCompleted"; + private const string PlannedFailoverFailedValue = "PlannedFailoverFailed"; + private const string PlannedFailoverCompletionFailedValue = "PlannedFailoverCompletionFailed"; + private const string PlannedFailoverTransitionStatesEndValue = "PlannedFailoverTransitionStatesEnd"; + private const string UnplannedFailoverTransitionStatesBeginValue = "UnplannedFailoverTransitionStatesBegin"; + private const string UnplannedFailoverInitiatedValue = "UnplannedFailoverInitiated"; + private const string UnplannedFailoverCompletingValue = "UnplannedFailoverCompleting"; + private const string UnplannedFailoverCompletedValue = "UnplannedFailoverCompleted"; + private const string UnplannedFailoverFailedValue = "UnplannedFailoverFailed"; + private const string UnplannedFailoverCompletionFailedValue = "UnplannedFailoverCompletionFailed"; + private const string UnplannedFailoverTransitionStatesEndValue = "UnplannedFailoverTransitionStatesEnd"; + private const string CommitFailoverStatesBeginValue = "CommitFailoverStatesBegin"; + private const string CommitFailoverInProgressOnPrimaryValue = "CommitFailoverInProgressOnPrimary"; + private const string CommitFailoverInProgressOnRecoveryValue = "CommitFailoverInProgressOnRecovery"; + private const string CommitFailoverCompletedValue = "CommitFailoverCompleted"; + private const string CommitFailoverFailedOnPrimaryValue = "CommitFailoverFailedOnPrimary"; + private const string CommitFailoverFailedOnRecoveryValue = "CommitFailoverFailedOnRecovery"; + private const string CommitFailoverStatesEndValue = "CommitFailoverStatesEnd"; + private const string CancelFailoverStatesBeginValue = "CancelFailoverStatesBegin"; + private const string CancelFailoverInProgressOnPrimaryValue = "CancelFailoverInProgressOnPrimary"; + private const string CancelFailoverInProgressOnRecoveryValue = "CancelFailoverInProgressOnRecovery"; + private const string CancelFailoverFailedOnPrimaryValue = "CancelFailoverFailedOnPrimary"; + private const string CancelFailoverFailedOnRecoveryValue = "CancelFailoverFailedOnRecovery"; + private const string CancelFailoverStatesEndValue = "CancelFailoverStatesEnd"; + private const string ChangeRecoveryPointStatesBeginValue = "ChangeRecoveryPointStatesBegin"; + private const string ChangeRecoveryPointInitiatedValue = "ChangeRecoveryPointInitiated"; + private const string ChangeRecoveryPointCompletedValue = "ChangeRecoveryPointCompleted"; + private const string ChangeRecoveryPointFailedValue = "ChangeRecoveryPointFailed"; + private const string ChangeRecoveryPointStatesEndValue = "ChangeRecoveryPointStatesEnd"; + private const string ReprotectStatesBeginValue = "ReprotectStatesBegin"; + private const string ReprotectInitiatedValue = "ReprotectInitiated"; + private const string ReprotectFailedValue = "ReprotectFailed"; + private const string ReprotectStatesEndValue = "ReprotectStatesEnd"; + + /// UnprotectedStatesBegin. + public static DataReplicationProtectionState UnprotectedStatesBegin { get; } = new DataReplicationProtectionState(UnprotectedStatesBeginValue); + /// EnablingProtection. + public static DataReplicationProtectionState EnablingProtection { get; } = new DataReplicationProtectionState(EnablingProtectionValue); + /// EnablingFailed. + public static DataReplicationProtectionState EnablingFailed { get; } = new DataReplicationProtectionState(EnablingFailedValue); + /// DisablingProtection. + public static DataReplicationProtectionState DisablingProtection { get; } = new DataReplicationProtectionState(DisablingProtectionValue); + /// MarkedForDeletion. + public static DataReplicationProtectionState MarkedForDeletion { get; } = new DataReplicationProtectionState(MarkedForDeletionValue); + /// DisablingFailed. + public static DataReplicationProtectionState DisablingFailed { get; } = new DataReplicationProtectionState(DisablingFailedValue); + /// UnprotectedStatesEnd. + public static DataReplicationProtectionState UnprotectedStatesEnd { get; } = new DataReplicationProtectionState(UnprotectedStatesEndValue); + /// InitialReplicationStatesBegin. + public static DataReplicationProtectionState InitialReplicationStatesBegin { get; } = new DataReplicationProtectionState(InitialReplicationStatesBeginValue); + /// InitialReplicationInProgress. + public static DataReplicationProtectionState InitialReplicationInProgress { get; } = new DataReplicationProtectionState(InitialReplicationInProgressValue); + /// InitialReplicationCompletedOnPrimary. + public static DataReplicationProtectionState InitialReplicationCompletedOnPrimary { get; } = new DataReplicationProtectionState(InitialReplicationCompletedOnPrimaryValue); + /// InitialReplicationCompletedOnRecovery. + public static DataReplicationProtectionState InitialReplicationCompletedOnRecovery { get; } = new DataReplicationProtectionState(InitialReplicationCompletedOnRecoveryValue); + /// InitialReplicationFailed. + public static DataReplicationProtectionState InitialReplicationFailed { get; } = new DataReplicationProtectionState(InitialReplicationFailedValue); + /// InitialReplicationStatesEnd. + public static DataReplicationProtectionState InitialReplicationStatesEnd { get; } = new DataReplicationProtectionState(InitialReplicationStatesEndValue); + /// ProtectedStatesBegin. + public static DataReplicationProtectionState ProtectedStatesBegin { get; } = new DataReplicationProtectionState(ProtectedStatesBeginValue); + /// Protected. + public static DataReplicationProtectionState Protected { get; } = new DataReplicationProtectionState(ProtectedValue); + /// ProtectedStatesEnd. + public static DataReplicationProtectionState ProtectedStatesEnd { get; } = new DataReplicationProtectionState(ProtectedStatesEndValue); + /// PlannedFailoverTransitionStatesBegin. + public static DataReplicationProtectionState PlannedFailoverTransitionStatesBegin { get; } = new DataReplicationProtectionState(PlannedFailoverTransitionStatesBeginValue); + /// PlannedFailoverInitiated. + public static DataReplicationProtectionState PlannedFailoverInitiated { get; } = new DataReplicationProtectionState(PlannedFailoverInitiatedValue); + /// PlannedFailoverCompleting. + public static DataReplicationProtectionState PlannedFailoverCompleting { get; } = new DataReplicationProtectionState(PlannedFailoverCompletingValue); + /// PlannedFailoverCompleted. + public static DataReplicationProtectionState PlannedFailoverCompleted { get; } = new DataReplicationProtectionState(PlannedFailoverCompletedValue); + /// PlannedFailoverFailed. + public static DataReplicationProtectionState PlannedFailoverFailed { get; } = new DataReplicationProtectionState(PlannedFailoverFailedValue); + /// PlannedFailoverCompletionFailed. + public static DataReplicationProtectionState PlannedFailoverCompletionFailed { get; } = new DataReplicationProtectionState(PlannedFailoverCompletionFailedValue); + /// PlannedFailoverTransitionStatesEnd. + public static DataReplicationProtectionState PlannedFailoverTransitionStatesEnd { get; } = new DataReplicationProtectionState(PlannedFailoverTransitionStatesEndValue); + /// UnplannedFailoverTransitionStatesBegin. + public static DataReplicationProtectionState UnplannedFailoverTransitionStatesBegin { get; } = new DataReplicationProtectionState(UnplannedFailoverTransitionStatesBeginValue); + /// UnplannedFailoverInitiated. + public static DataReplicationProtectionState UnplannedFailoverInitiated { get; } = new DataReplicationProtectionState(UnplannedFailoverInitiatedValue); + /// UnplannedFailoverCompleting. + public static DataReplicationProtectionState UnplannedFailoverCompleting { get; } = new DataReplicationProtectionState(UnplannedFailoverCompletingValue); + /// UnplannedFailoverCompleted. + public static DataReplicationProtectionState UnplannedFailoverCompleted { get; } = new DataReplicationProtectionState(UnplannedFailoverCompletedValue); + /// UnplannedFailoverFailed. + public static DataReplicationProtectionState UnplannedFailoverFailed { get; } = new DataReplicationProtectionState(UnplannedFailoverFailedValue); + /// UnplannedFailoverCompletionFailed. + public static DataReplicationProtectionState UnplannedFailoverCompletionFailed { get; } = new DataReplicationProtectionState(UnplannedFailoverCompletionFailedValue); + /// UnplannedFailoverTransitionStatesEnd. + public static DataReplicationProtectionState UnplannedFailoverTransitionStatesEnd { get; } = new DataReplicationProtectionState(UnplannedFailoverTransitionStatesEndValue); + /// CommitFailoverStatesBegin. + public static DataReplicationProtectionState CommitFailoverStatesBegin { get; } = new DataReplicationProtectionState(CommitFailoverStatesBeginValue); + /// CommitFailoverInProgressOnPrimary. + public static DataReplicationProtectionState CommitFailoverInProgressOnPrimary { get; } = new DataReplicationProtectionState(CommitFailoverInProgressOnPrimaryValue); + /// CommitFailoverInProgressOnRecovery. + public static DataReplicationProtectionState CommitFailoverInProgressOnRecovery { get; } = new DataReplicationProtectionState(CommitFailoverInProgressOnRecoveryValue); + /// CommitFailoverCompleted. + public static DataReplicationProtectionState CommitFailoverCompleted { get; } = new DataReplicationProtectionState(CommitFailoverCompletedValue); + /// CommitFailoverFailedOnPrimary. + public static DataReplicationProtectionState CommitFailoverFailedOnPrimary { get; } = new DataReplicationProtectionState(CommitFailoverFailedOnPrimaryValue); + /// CommitFailoverFailedOnRecovery. + public static DataReplicationProtectionState CommitFailoverFailedOnRecovery { get; } = new DataReplicationProtectionState(CommitFailoverFailedOnRecoveryValue); + /// CommitFailoverStatesEnd. + public static DataReplicationProtectionState CommitFailoverStatesEnd { get; } = new DataReplicationProtectionState(CommitFailoverStatesEndValue); + /// CancelFailoverStatesBegin. + public static DataReplicationProtectionState CancelFailoverStatesBegin { get; } = new DataReplicationProtectionState(CancelFailoverStatesBeginValue); + /// CancelFailoverInProgressOnPrimary. + public static DataReplicationProtectionState CancelFailoverInProgressOnPrimary { get; } = new DataReplicationProtectionState(CancelFailoverInProgressOnPrimaryValue); + /// CancelFailoverInProgressOnRecovery. + public static DataReplicationProtectionState CancelFailoverInProgressOnRecovery { get; } = new DataReplicationProtectionState(CancelFailoverInProgressOnRecoveryValue); + /// CancelFailoverFailedOnPrimary. + public static DataReplicationProtectionState CancelFailoverFailedOnPrimary { get; } = new DataReplicationProtectionState(CancelFailoverFailedOnPrimaryValue); + /// CancelFailoverFailedOnRecovery. + public static DataReplicationProtectionState CancelFailoverFailedOnRecovery { get; } = new DataReplicationProtectionState(CancelFailoverFailedOnRecoveryValue); + /// CancelFailoverStatesEnd. + public static DataReplicationProtectionState CancelFailoverStatesEnd { get; } = new DataReplicationProtectionState(CancelFailoverStatesEndValue); + /// ChangeRecoveryPointStatesBegin. + public static DataReplicationProtectionState ChangeRecoveryPointStatesBegin { get; } = new DataReplicationProtectionState(ChangeRecoveryPointStatesBeginValue); + /// ChangeRecoveryPointInitiated. + public static DataReplicationProtectionState ChangeRecoveryPointInitiated { get; } = new DataReplicationProtectionState(ChangeRecoveryPointInitiatedValue); + /// ChangeRecoveryPointCompleted. + public static DataReplicationProtectionState ChangeRecoveryPointCompleted { get; } = new DataReplicationProtectionState(ChangeRecoveryPointCompletedValue); + /// ChangeRecoveryPointFailed. + public static DataReplicationProtectionState ChangeRecoveryPointFailed { get; } = new DataReplicationProtectionState(ChangeRecoveryPointFailedValue); + /// ChangeRecoveryPointStatesEnd. + public static DataReplicationProtectionState ChangeRecoveryPointStatesEnd { get; } = new DataReplicationProtectionState(ChangeRecoveryPointStatesEndValue); + /// ReprotectStatesBegin. + public static DataReplicationProtectionState ReprotectStatesBegin { get; } = new DataReplicationProtectionState(ReprotectStatesBeginValue); + /// ReprotectInitiated. + public static DataReplicationProtectionState ReprotectInitiated { get; } = new DataReplicationProtectionState(ReprotectInitiatedValue); + /// ReprotectFailed. + public static DataReplicationProtectionState ReprotectFailed { get; } = new DataReplicationProtectionState(ReprotectFailedValue); + /// ReprotectStatesEnd. + public static DataReplicationProtectionState ReprotectStatesEnd { get; } = new DataReplicationProtectionState(ReprotectStatesEndValue); + /// Determines if two values are the same. + public static bool operator ==(DataReplicationProtectionState left, DataReplicationProtectionState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DataReplicationProtectionState left, DataReplicationProtectionState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DataReplicationProtectionState(string value) => new DataReplicationProtectionState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DataReplicationProtectionState other && Equals(other); + /// + public bool Equals(DataReplicationProtectionState 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/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationProvisioningState.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationProvisioningState.cs new file mode 100644 index 000000000000..4bc9d31b38d0 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationProvisioningState.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.RecoveryServicesDataReplication.Models +{ + /// Gets or sets the provisioning state of the Dra. + public readonly partial struct DataReplicationProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DataReplicationProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CanceledValue = "Canceled"; + private const string CreatingValue = "Creating"; + private const string DeletingValue = "Deleting"; + private const string DeletedValue = "Deleted"; + private const string FailedValue = "Failed"; + private const string SucceededValue = "Succeeded"; + private const string UpdatingValue = "Updating"; + + /// Canceled. + public static DataReplicationProvisioningState Canceled { get; } = new DataReplicationProvisioningState(CanceledValue); + /// Creating. + public static DataReplicationProvisioningState Creating { get; } = new DataReplicationProvisioningState(CreatingValue); + /// Deleting. + public static DataReplicationProvisioningState Deleting { get; } = new DataReplicationProvisioningState(DeletingValue); + /// Deleted. + public static DataReplicationProvisioningState Deleted { get; } = new DataReplicationProvisioningState(DeletedValue); + /// Failed. + public static DataReplicationProvisioningState Failed { get; } = new DataReplicationProvisioningState(FailedValue); + /// Succeeded. + public static DataReplicationProvisioningState Succeeded { get; } = new DataReplicationProvisioningState(SucceededValue); + /// Updating. + public static DataReplicationProvisioningState Updating { get; } = new DataReplicationProvisioningState(UpdatingValue); + /// Determines if two values are the same. + public static bool operator ==(DataReplicationProvisioningState left, DataReplicationProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DataReplicationProvisioningState left, DataReplicationProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DataReplicationProvisioningState(string value) => new DataReplicationProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DataReplicationProvisioningState other && Equals(other); + /// + public bool Equals(DataReplicationProvisioningState 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/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationRecoveryPointData.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationRecoveryPointData.Serialization.cs new file mode 100644 index 000000000000..af756ebbaf8e --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationRecoveryPointData.Serialization.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication +{ + public partial class DataReplicationRecoveryPointData + { + internal static DataReplicationRecoveryPointData DeserializeDataReplicationRecoveryPointData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DataReplicationRecoveryPointProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + properties = DataReplicationRecoveryPointProperties.DeserializeDataReplicationRecoveryPointProperties(property.Value); + 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; + } + } + return new DataReplicationRecoveryPointData(id, name, type, systemData.Value, properties); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationRecoveryPointListResult.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationRecoveryPointListResult.Serialization.cs new file mode 100644 index 000000000000..6b518cc1ec22 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationRecoveryPointListResult.Serialization.cs @@ -0,0 +1,50 @@ +// 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; +using Azure.ResourceManager.RecoveryServicesDataReplication; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + internal partial class DataReplicationRecoveryPointListResult + { + internal static DataReplicationRecoveryPointListResult DeserializeDataReplicationRecoveryPointListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DataReplicationRecoveryPointData.DeserializeDataReplicationRecoveryPointData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new DataReplicationRecoveryPointListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationRecoveryPointListResult.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationRecoveryPointListResult.cs new file mode 100644 index 000000000000..9b4a6dc52369 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationRecoveryPointListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.RecoveryServicesDataReplication; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// Recovery point model collection. + internal partial class DataReplicationRecoveryPointListResult + { + /// Initializes a new instance of DataReplicationRecoveryPointListResult. + internal DataReplicationRecoveryPointListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of DataReplicationRecoveryPointListResult. + /// Gets or sets the list of recovery points. + /// Gets or sets the value of next link. + internal DataReplicationRecoveryPointListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Gets or sets the list of recovery points. + public IReadOnlyList Value { get; } + /// Gets or sets the value of next link. + public string NextLink { get; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationRecoveryPointProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationRecoveryPointProperties.Serialization.cs new file mode 100644 index 000000000000..02917ebccd7f --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationRecoveryPointProperties.Serialization.cs @@ -0,0 +1,46 @@ +// 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.RecoveryServicesDataReplication.Models +{ + public partial class DataReplicationRecoveryPointProperties + { + internal static DataReplicationRecoveryPointProperties DeserializeDataReplicationRecoveryPointProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DateTimeOffset recoveryPointTime = default; + DataReplicationRecoveryPointType recoveryPointType = default; + RecoveryPointModelCustomProperties customProperties = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("recoveryPointTime"u8)) + { + recoveryPointTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("recoveryPointType"u8)) + { + recoveryPointType = new DataReplicationRecoveryPointType(property.Value.GetString()); + continue; + } + if (property.NameEquals("customProperties"u8)) + { + customProperties = RecoveryPointModelCustomProperties.DeserializeRecoveryPointModelCustomProperties(property.Value); + continue; + } + } + return new DataReplicationRecoveryPointProperties(recoveryPointTime, recoveryPointType, customProperties); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationRecoveryPointProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationRecoveryPointProperties.cs new file mode 100644 index 000000000000..8964b9be74c1 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationRecoveryPointProperties.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// Recovery point model properties. + public partial class DataReplicationRecoveryPointProperties + { + /// Initializes a new instance of DataReplicationRecoveryPointProperties. + /// Gets or sets the recovery point time. + /// Gets or sets the recovery point type. + /// + /// Recovery point model custom properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + /// is null. + internal DataReplicationRecoveryPointProperties(DateTimeOffset recoveryPointOn, DataReplicationRecoveryPointType recoveryPointType, RecoveryPointModelCustomProperties customProperties) + { + Argument.AssertNotNull(customProperties, nameof(customProperties)); + + RecoveryPointOn = recoveryPointOn; + RecoveryPointType = recoveryPointType; + CustomProperties = customProperties; + } + + /// Gets or sets the recovery point time. + public DateTimeOffset RecoveryPointOn { get; } + /// Gets or sets the recovery point type. + public DataReplicationRecoveryPointType RecoveryPointType { get; } + /// + /// Recovery point model custom properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + public RecoveryPointModelCustomProperties CustomProperties { get; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationRecoveryPointType.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationRecoveryPointType.cs new file mode 100644 index 000000000000..9dc03d5ec6f1 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationRecoveryPointType.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.RecoveryServicesDataReplication.Models +{ + /// Gets or sets the recovery point type. + public readonly partial struct DataReplicationRecoveryPointType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DataReplicationRecoveryPointType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ApplicationConsistentValue = "ApplicationConsistent"; + private const string CrashConsistentValue = "CrashConsistent"; + + /// ApplicationConsistent. + public static DataReplicationRecoveryPointType ApplicationConsistent { get; } = new DataReplicationRecoveryPointType(ApplicationConsistentValue); + /// CrashConsistent. + public static DataReplicationRecoveryPointType CrashConsistent { get; } = new DataReplicationRecoveryPointType(CrashConsistentValue); + /// Determines if two values are the same. + public static bool operator ==(DataReplicationRecoveryPointType left, DataReplicationRecoveryPointType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DataReplicationRecoveryPointType left, DataReplicationRecoveryPointType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DataReplicationRecoveryPointType(string value) => new DataReplicationRecoveryPointType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DataReplicationRecoveryPointType other && Equals(other); + /// + public bool Equals(DataReplicationRecoveryPointType 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/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationReplicationExtensionData.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationReplicationExtensionData.Serialization.cs new file mode 100644 index 000000000000..6943f57935f6 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationReplicationExtensionData.Serialization.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication +{ + public partial class DataReplicationReplicationExtensionData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + writer.WriteEndObject(); + } + + internal static DataReplicationReplicationExtensionData DeserializeDataReplicationReplicationExtensionData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DataReplicationReplicationExtensionProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + properties = DataReplicationReplicationExtensionProperties.DeserializeDataReplicationReplicationExtensionProperties(property.Value); + 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; + } + } + return new DataReplicationReplicationExtensionData(id, name, type, systemData.Value, properties); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationReplicationExtensionListResult.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationReplicationExtensionListResult.Serialization.cs new file mode 100644 index 000000000000..bc832efa8709 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationReplicationExtensionListResult.Serialization.cs @@ -0,0 +1,50 @@ +// 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; +using Azure.ResourceManager.RecoveryServicesDataReplication; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + internal partial class DataReplicationReplicationExtensionListResult + { + internal static DataReplicationReplicationExtensionListResult DeserializeDataReplicationReplicationExtensionListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DataReplicationReplicationExtensionData.DeserializeDataReplicationReplicationExtensionData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new DataReplicationReplicationExtensionListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationReplicationExtensionListResult.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationReplicationExtensionListResult.cs new file mode 100644 index 000000000000..bbbe20cbdae5 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationReplicationExtensionListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.RecoveryServicesDataReplication; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// Replication extension model collection. + internal partial class DataReplicationReplicationExtensionListResult + { + /// Initializes a new instance of DataReplicationReplicationExtensionListResult. + internal DataReplicationReplicationExtensionListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of DataReplicationReplicationExtensionListResult. + /// Gets or sets the list of replication extensions. + /// Gets or sets the value of next link. + internal DataReplicationReplicationExtensionListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Gets or sets the list of replication extensions. + public IReadOnlyList Value { get; } + /// Gets or sets the value of next link. + public string NextLink { get; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationReplicationExtensionProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationReplicationExtensionProperties.Serialization.cs new file mode 100644 index 000000000000..26d958fe79e7 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationReplicationExtensionProperties.Serialization.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + public partial class DataReplicationReplicationExtensionProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("customProperties"u8); + writer.WriteObjectValue(CustomProperties); + writer.WriteEndObject(); + } + + internal static DataReplicationReplicationExtensionProperties DeserializeDataReplicationReplicationExtensionProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional provisioningState = default; + ReplicationExtensionModelCustomProperties customProperties = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new DataReplicationProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("customProperties"u8)) + { + customProperties = ReplicationExtensionModelCustomProperties.DeserializeReplicationExtensionModelCustomProperties(property.Value); + continue; + } + } + return new DataReplicationReplicationExtensionProperties(Optional.ToNullable(provisioningState), customProperties); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationReplicationExtensionProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationReplicationExtensionProperties.cs new file mode 100644 index 000000000000..f59628391072 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationReplicationExtensionProperties.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// Replication extension model properties. + public partial class DataReplicationReplicationExtensionProperties + { + /// Initializes a new instance of DataReplicationReplicationExtensionProperties. + /// + /// Replication extension model custom properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + /// is null. + public DataReplicationReplicationExtensionProperties(ReplicationExtensionModelCustomProperties customProperties) + { + Argument.AssertNotNull(customProperties, nameof(customProperties)); + + CustomProperties = customProperties; + } + + /// Initializes a new instance of DataReplicationReplicationExtensionProperties. + /// Gets or sets the provisioning state of the replication extension. + /// + /// Replication extension model custom properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + internal DataReplicationReplicationExtensionProperties(DataReplicationProvisioningState? provisioningState, ReplicationExtensionModelCustomProperties customProperties) + { + ProvisioningState = provisioningState; + CustomProperties = customProperties; + } + + /// Gets or sets the provisioning state of the replication extension. + public DataReplicationProvisioningState? ProvisioningState { get; } + /// + /// Replication extension model custom properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + public ReplicationExtensionModelCustomProperties CustomProperties { get; set; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationReplicationVaultType.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationReplicationVaultType.cs new file mode 100644 index 000000000000..77f7214ad5b0 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationReplicationVaultType.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.RecoveryServicesDataReplication.Models +{ + /// Gets or sets the type of vault. + public readonly partial struct DataReplicationReplicationVaultType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DataReplicationReplicationVaultType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DisasterRecoveryValue = "DisasterRecovery"; + private const string MigrateValue = "Migrate"; + + /// DisasterRecovery. + public static DataReplicationReplicationVaultType DisasterRecovery { get; } = new DataReplicationReplicationVaultType(DisasterRecoveryValue); + /// Migrate. + public static DataReplicationReplicationVaultType Migrate { get; } = new DataReplicationReplicationVaultType(MigrateValue); + /// Determines if two values are the same. + public static bool operator ==(DataReplicationReplicationVaultType left, DataReplicationReplicationVaultType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DataReplicationReplicationVaultType left, DataReplicationReplicationVaultType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DataReplicationReplicationVaultType(string value) => new DataReplicationReplicationVaultType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DataReplicationReplicationVaultType other && Equals(other); + /// + public bool Equals(DataReplicationReplicationVaultType 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/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationResynchronizationState.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationResynchronizationState.cs new file mode 100644 index 000000000000..f025b50a239c --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationResynchronizationState.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// Gets or sets the resynchronization state. + public readonly partial struct DataReplicationResynchronizationState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DataReplicationResynchronizationState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NoneValue = "None"; + private const string ResynchronizationInitiatedValue = "ResynchronizationInitiated"; + private const string ResynchronizationCompletedValue = "ResynchronizationCompleted"; + private const string ResynchronizationFailedValue = "ResynchronizationFailed"; + + /// None. + public static DataReplicationResynchronizationState None { get; } = new DataReplicationResynchronizationState(NoneValue); + /// ResynchronizationInitiated. + public static DataReplicationResynchronizationState ResynchronizationInitiated { get; } = new DataReplicationResynchronizationState(ResynchronizationInitiatedValue); + /// ResynchronizationCompleted. + public static DataReplicationResynchronizationState ResynchronizationCompleted { get; } = new DataReplicationResynchronizationState(ResynchronizationCompletedValue); + /// ResynchronizationFailed. + public static DataReplicationResynchronizationState ResynchronizationFailed { get; } = new DataReplicationResynchronizationState(ResynchronizationFailedValue); + /// Determines if two values are the same. + public static bool operator ==(DataReplicationResynchronizationState left, DataReplicationResynchronizationState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DataReplicationResynchronizationState left, DataReplicationResynchronizationState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DataReplicationResynchronizationState(string value) => new DataReplicationResynchronizationState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DataReplicationResynchronizationState other && Equals(other); + /// + public bool Equals(DataReplicationResynchronizationState 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/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationTask.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationTask.Serialization.cs new file mode 100644 index 000000000000..afe4f856b3ae --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationTask.Serialization.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.RecoveryServicesDataReplication; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + public partial class DataReplicationTask + { + internal static DataReplicationTask DeserializeDataReplicationTask(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional taskName = default; + Optional state = default; + Optional startTime = default; + Optional endTime = default; + Optional customProperties = default; + Optional> childrenWorkflows = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("state"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + state = new DataReplicationTaskState(property.Value.GetString()); + continue; + } + if (property.NameEquals("startTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + startTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("endTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("customProperties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + customProperties = TaskModelCustomProperties.DeserializeTaskModelCustomProperties(property.Value); + continue; + } + if (property.NameEquals("childrenWorkflows"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DataReplicationWorkflowData.DeserializeDataReplicationWorkflowData(item)); + } + childrenWorkflows = array; + continue; + } + } + return new DataReplicationTask(taskName.Value, Optional.ToNullable(state), Optional.ToNullable(startTime), Optional.ToNullable(endTime), customProperties.Value, Optional.ToList(childrenWorkflows)); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationTask.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationTask.cs new file mode 100644 index 000000000000..a824a1bf9f8c --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationTask.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.RecoveryServicesDataReplication; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// Task model. + public partial class DataReplicationTask + { + /// Initializes a new instance of DataReplicationTask. + internal DataReplicationTask() + { + ChildrenWorkflows = new ChangeTrackingList(); + } + + /// Initializes a new instance of DataReplicationTask. + /// Gets or sets the task name. + /// Gets or sets the task state. + /// Gets or sets the start time. + /// Gets or sets the end time. + /// Task model custom properties. + /// Gets or sets the list of children workflow models. + internal DataReplicationTask(string taskName, DataReplicationTaskState? state, DateTimeOffset? startOn, DateTimeOffset? endOn, TaskModelCustomProperties customProperties, IReadOnlyList childrenWorkflows) + { + TaskName = taskName; + State = state; + StartOn = startOn; + EndOn = endOn; + CustomProperties = customProperties; + ChildrenWorkflows = childrenWorkflows; + } + + /// Gets or sets the task name. + public string TaskName { get; } + /// Gets or sets the task state. + public DataReplicationTaskState? State { get; } + /// Gets or sets the start time. + public DateTimeOffset? StartOn { get; } + /// Gets or sets the end time. + public DateTimeOffset? EndOn { get; } + /// Task model custom properties. + internal TaskModelCustomProperties CustomProperties { get; } + /// Gets or sets the instance type. + public string CustomInstanceType + { + get => CustomProperties?.InstanceType; + } + + /// Gets or sets the list of children workflow models. + public IReadOnlyList ChildrenWorkflows { get; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationTaskState.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationTaskState.cs new file mode 100644 index 000000000000..d1f97da0192e --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationTaskState.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.RecoveryServicesDataReplication.Models +{ + /// Gets or sets the task state. + public readonly partial struct DataReplicationTaskState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DataReplicationTaskState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PendingValue = "Pending"; + private const string StartedValue = "Started"; + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CancelledValue = "Cancelled"; + private const string SkippedValue = "Skipped"; + + /// Pending. + public static DataReplicationTaskState Pending { get; } = new DataReplicationTaskState(PendingValue); + /// Started. + public static DataReplicationTaskState Started { get; } = new DataReplicationTaskState(StartedValue); + /// Succeeded. + public static DataReplicationTaskState Succeeded { get; } = new DataReplicationTaskState(SucceededValue); + /// Failed. + public static DataReplicationTaskState Failed { get; } = new DataReplicationTaskState(FailedValue); + /// Cancelled. + public static DataReplicationTaskState Cancelled { get; } = new DataReplicationTaskState(CancelledValue); + /// Skipped. + public static DataReplicationTaskState Skipped { get; } = new DataReplicationTaskState(SkippedValue); + /// Determines if two values are the same. + public static bool operator ==(DataReplicationTaskState left, DataReplicationTaskState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DataReplicationTaskState left, DataReplicationTaskState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DataReplicationTaskState(string value) => new DataReplicationTaskState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DataReplicationTaskState other && Equals(other); + /// + public bool Equals(DataReplicationTaskState 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/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationTestFailoverState.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationTestFailoverState.cs new file mode 100644 index 000000000000..8391efcb9470 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationTestFailoverState.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// Gets or sets the test failover state. + public readonly partial struct DataReplicationTestFailoverState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DataReplicationTestFailoverState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NoneValue = "None"; + private const string TestFailoverInitiatedValue = "TestFailoverInitiated"; + private const string TestFailoverCompletingValue = "TestFailoverCompleting"; + private const string TestFailoverCompletedValue = "TestFailoverCompleted"; + private const string TestFailoverFailedValue = "TestFailoverFailed"; + private const string TestFailoverCompletionFailedValue = "TestFailoverCompletionFailed"; + private const string TestFailoverCleanupInitiatedValue = "TestFailoverCleanupInitiated"; + private const string TestFailoverCleanupCompletingValue = "TestFailoverCleanupCompleting"; + private const string MarkedForDeletionValue = "MarkedForDeletion"; + + /// None. + public static DataReplicationTestFailoverState None { get; } = new DataReplicationTestFailoverState(NoneValue); + /// TestFailoverInitiated. + public static DataReplicationTestFailoverState TestFailoverInitiated { get; } = new DataReplicationTestFailoverState(TestFailoverInitiatedValue); + /// TestFailoverCompleting. + public static DataReplicationTestFailoverState TestFailoverCompleting { get; } = new DataReplicationTestFailoverState(TestFailoverCompletingValue); + /// TestFailoverCompleted. + public static DataReplicationTestFailoverState TestFailoverCompleted { get; } = new DataReplicationTestFailoverState(TestFailoverCompletedValue); + /// TestFailoverFailed. + public static DataReplicationTestFailoverState TestFailoverFailed { get; } = new DataReplicationTestFailoverState(TestFailoverFailedValue); + /// TestFailoverCompletionFailed. + public static DataReplicationTestFailoverState TestFailoverCompletionFailed { get; } = new DataReplicationTestFailoverState(TestFailoverCompletionFailedValue); + /// TestFailoverCleanupInitiated. + public static DataReplicationTestFailoverState TestFailoverCleanupInitiated { get; } = new DataReplicationTestFailoverState(TestFailoverCleanupInitiatedValue); + /// TestFailoverCleanupCompleting. + public static DataReplicationTestFailoverState TestFailoverCleanupCompleting { get; } = new DataReplicationTestFailoverState(TestFailoverCleanupCompletingValue); + /// MarkedForDeletion. + public static DataReplicationTestFailoverState MarkedForDeletion { get; } = new DataReplicationTestFailoverState(MarkedForDeletionValue); + /// Determines if two values are the same. + public static bool operator ==(DataReplicationTestFailoverState left, DataReplicationTestFailoverState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DataReplicationTestFailoverState left, DataReplicationTestFailoverState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DataReplicationTestFailoverState(string value) => new DataReplicationTestFailoverState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DataReplicationTestFailoverState other && Equals(other); + /// + public bool Equals(DataReplicationTestFailoverState 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/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationVaultData.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationVaultData.Serialization.cs new file mode 100644 index 000000000000..808b24c984eb --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationVaultData.Serialization.cs @@ -0,0 +1,113 @@ +// 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; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication +{ + public partial class DataReplicationVaultData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + 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.WriteEndObject(); + } + + internal static DataReplicationVaultData DeserializeDataReplicationVaultData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional properties = default; + Optional> tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = DataReplicationVaultProperties.DeserializeDataReplicationVaultProperties(property.Value); + 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; + } + } + return new DataReplicationVaultData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, properties.Value); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationVaultListResult.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationVaultListResult.Serialization.cs new file mode 100644 index 000000000000..ad83b44df9ab --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationVaultListResult.Serialization.cs @@ -0,0 +1,50 @@ +// 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; +using Azure.ResourceManager.RecoveryServicesDataReplication; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + internal partial class DataReplicationVaultListResult + { + internal static DataReplicationVaultListResult DeserializeDataReplicationVaultListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DataReplicationVaultData.DeserializeDataReplicationVaultData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new DataReplicationVaultListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationVaultListResult.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationVaultListResult.cs new file mode 100644 index 000000000000..ca450dc8629a --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationVaultListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.RecoveryServicesDataReplication; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// Vault model collection. + internal partial class DataReplicationVaultListResult + { + /// Initializes a new instance of DataReplicationVaultListResult. + internal DataReplicationVaultListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of DataReplicationVaultListResult. + /// Gets or sets the list of vaults. + /// Gets or sets the value of next link. + internal DataReplicationVaultListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Gets or sets the list of vaults. + public IReadOnlyList Value { get; } + /// Gets or sets the value of next link. + public string NextLink { get; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationVaultPatch.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationVaultPatch.Serialization.cs new file mode 100644 index 000000000000..7e156ee1fe4c --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationVaultPatch.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.RecoveryServicesDataReplication.Models +{ + public partial class DataReplicationVaultPatch : 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(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationVaultPatch.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationVaultPatch.cs new file mode 100644 index 000000000000..ccbee59486b9 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationVaultPatch.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.RecoveryServicesDataReplication.Models +{ + /// Vault model for update. + public partial class DataReplicationVaultPatch : ResourceData + { + /// Initializes a new instance of DataReplicationVaultPatch. + public DataReplicationVaultPatch() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Gets or sets the resource tags. + public IDictionary Tags { get; } + /// Vault properties. + public DataReplicationVaultProperties Properties { get; set; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationVaultProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationVaultProperties.Serialization.cs new file mode 100644 index 000000000000..34ce80d2df1a --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationVaultProperties.Serialization.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + public partial class DataReplicationVaultProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(VaultType)) + { + writer.WritePropertyName("vaultType"u8); + writer.WriteStringValue(VaultType.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static DataReplicationVaultProperties DeserializeDataReplicationVaultProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional provisioningState = default; + Optional serviceResourceId = default; + Optional vaultType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new DataReplicationProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("serviceResourceId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + serviceResourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("vaultType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + vaultType = new DataReplicationReplicationVaultType(property.Value.GetString()); + continue; + } + } + return new DataReplicationVaultProperties(Optional.ToNullable(provisioningState), serviceResourceId.Value, Optional.ToNullable(vaultType)); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationVaultProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationVaultProperties.cs new file mode 100644 index 000000000000..8a4260e6d3e3 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationVaultProperties.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.RecoveryServicesDataReplication.Models +{ + /// Vault properties. + public partial class DataReplicationVaultProperties + { + /// Initializes a new instance of DataReplicationVaultProperties. + public DataReplicationVaultProperties() + { + } + + /// Initializes a new instance of DataReplicationVaultProperties. + /// Gets or sets the provisioning state of the vault. + /// Gets or sets the service resource Id. + /// Gets or sets the type of vault. + internal DataReplicationVaultProperties(DataReplicationProvisioningState? provisioningState, ResourceIdentifier serviceResourceId, DataReplicationReplicationVaultType? vaultType) + { + ProvisioningState = provisioningState; + ServiceResourceId = serviceResourceId; + VaultType = vaultType; + } + + /// Gets or sets the provisioning state of the vault. + public DataReplicationProvisioningState? ProvisioningState { get; } + /// Gets or sets the service resource Id. + public ResourceIdentifier ServiceResourceId { get; } + /// Gets or sets the type of vault. + public DataReplicationReplicationVaultType? VaultType { get; set; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationWorkflowData.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationWorkflowData.Serialization.cs new file mode 100644 index 000000000000..80a128100a2f --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationWorkflowData.Serialization.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication +{ + public partial class DataReplicationWorkflowData + { + internal static DataReplicationWorkflowData DeserializeDataReplicationWorkflowData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DataReplicationWorkflowProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + properties = DataReplicationWorkflowProperties.DeserializeDataReplicationWorkflowProperties(property.Value); + 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; + } + } + return new DataReplicationWorkflowData(id, name, type, systemData.Value, properties); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationWorkflowListResult.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationWorkflowListResult.Serialization.cs new file mode 100644 index 000000000000..79a1550174e8 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationWorkflowListResult.Serialization.cs @@ -0,0 +1,50 @@ +// 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; +using Azure.ResourceManager.RecoveryServicesDataReplication; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + internal partial class DataReplicationWorkflowListResult + { + internal static DataReplicationWorkflowListResult DeserializeDataReplicationWorkflowListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DataReplicationWorkflowData.DeserializeDataReplicationWorkflowData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new DataReplicationWorkflowListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationWorkflowListResult.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationWorkflowListResult.cs new file mode 100644 index 000000000000..fbd47a611486 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationWorkflowListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.RecoveryServicesDataReplication; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// Workflow model collection. + internal partial class DataReplicationWorkflowListResult + { + /// Initializes a new instance of DataReplicationWorkflowListResult. + internal DataReplicationWorkflowListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of DataReplicationWorkflowListResult. + /// Gets or sets the list of workflows. + /// Gets or sets the value of next link. + internal DataReplicationWorkflowListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Gets or sets the list of workflows. + public IReadOnlyList Value { get; } + /// Gets or sets the value of next link. + public string NextLink { get; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationWorkflowProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationWorkflowProperties.Serialization.cs new file mode 100644 index 000000000000..e2650d6b12b2 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationWorkflowProperties.Serialization.cs @@ -0,0 +1,174 @@ +// 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; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + public partial class DataReplicationWorkflowProperties + { + internal static DataReplicationWorkflowProperties DeserializeDataReplicationWorkflowProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional displayName = default; + Optional state = default; + Optional startTime = default; + Optional endTime = default; + Optional objectId = default; + Optional objectName = default; + Optional objectInternalId = default; + Optional objectInternalName = default; + Optional objectType = default; + Optional replicationProviderId = default; + Optional sourceFabricProviderId = default; + Optional targetFabricProviderId = default; + Optional> allowedActions = default; + Optional activityId = default; + Optional> tasks = default; + Optional> errors = default; + WorkflowModelCustomProperties customProperties = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("state"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + state = new DataReplicationWorkflowState(property.Value.GetString()); + continue; + } + if (property.NameEquals("startTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + startTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("endTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("objectId"u8)) + { + objectId = property.Value.GetString(); + continue; + } + if (property.NameEquals("objectName"u8)) + { + objectName = property.Value.GetString(); + continue; + } + if (property.NameEquals("objectInternalId"u8)) + { + objectInternalId = property.Value.GetString(); + continue; + } + if (property.NameEquals("objectInternalName"u8)) + { + objectInternalName = property.Value.GetString(); + continue; + } + if (property.NameEquals("objectType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + objectType = new WorkflowObjectType(property.Value.GetString()); + continue; + } + if (property.NameEquals("replicationProviderId"u8)) + { + replicationProviderId = property.Value.GetString(); + continue; + } + if (property.NameEquals("sourceFabricProviderId"u8)) + { + sourceFabricProviderId = property.Value.GetString(); + continue; + } + if (property.NameEquals("targetFabricProviderId"u8)) + { + targetFabricProviderId = property.Value.GetString(); + continue; + } + if (property.NameEquals("allowedActions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + allowedActions = array; + continue; + } + if (property.NameEquals("activityId"u8)) + { + activityId = property.Value.GetString(); + continue; + } + if (property.NameEquals("tasks"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DataReplicationTask.DeserializeDataReplicationTask(item)); + } + tasks = array; + continue; + } + if (property.NameEquals("errors"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DataReplicationErrorInfo.DeserializeDataReplicationErrorInfo(item)); + } + errors = array; + continue; + } + if (property.NameEquals("customProperties"u8)) + { + customProperties = WorkflowModelCustomProperties.DeserializeWorkflowModelCustomProperties(property.Value); + continue; + } + } + return new DataReplicationWorkflowProperties(displayName.Value, Optional.ToNullable(state), Optional.ToNullable(startTime), Optional.ToNullable(endTime), objectId.Value, objectName.Value, objectInternalId.Value, objectInternalName.Value, Optional.ToNullable(objectType), replicationProviderId.Value, sourceFabricProviderId.Value, targetFabricProviderId.Value, Optional.ToList(allowedActions), activityId.Value, Optional.ToList(tasks), Optional.ToList(errors), customProperties); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationWorkflowProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationWorkflowProperties.cs new file mode 100644 index 000000000000..ef4880804420 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationWorkflowProperties.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// Workflow model properties. + public partial class DataReplicationWorkflowProperties + { + /// Initializes a new instance of DataReplicationWorkflowProperties. + /// + /// Workflow model custom properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + /// is null. + internal DataReplicationWorkflowProperties(WorkflowModelCustomProperties customProperties) + { + Argument.AssertNotNull(customProperties, nameof(customProperties)); + + AllowedActions = new ChangeTrackingList(); + Tasks = new ChangeTrackingList(); + Errors = new ChangeTrackingList(); + CustomProperties = customProperties; + } + + /// Initializes a new instance of DataReplicationWorkflowProperties. + /// Gets or sets the friendly display name. + /// Gets or sets the workflow state. + /// Gets or sets the start time. + /// Gets or sets the end time. + /// Gets or sets the affected object Id. + /// Gets or sets the affected object name. + /// Gets or sets the affected object internal Id. + /// Gets or sets the affected object internal name. + /// Gets or sets the object type. + /// Gets or sets the replication provider. + /// Gets or sets the source fabric provider. + /// Gets or sets the target fabric provider. + /// Gets or sets the list of allowed actions on the workflow. + /// Gets or sets the workflow activity id. + /// Gets or sets the list of tasks. + /// Gets or sets the list of errors. + /// + /// Workflow model custom properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + internal DataReplicationWorkflowProperties(string displayName, DataReplicationWorkflowState? state, DateTimeOffset? startOn, DateTimeOffset? endOn, string objectId, string objectName, string objectInternalId, string objectInternalName, WorkflowObjectType? objectType, string replicationProviderId, string sourceFabricProviderId, string targetFabricProviderId, IReadOnlyList allowedActions, string activityId, IReadOnlyList tasks, IReadOnlyList errors, WorkflowModelCustomProperties customProperties) + { + DisplayName = displayName; + State = state; + StartOn = startOn; + EndOn = endOn; + ObjectId = objectId; + ObjectName = objectName; + ObjectInternalId = objectInternalId; + ObjectInternalName = objectInternalName; + ObjectType = objectType; + ReplicationProviderId = replicationProviderId; + SourceFabricProviderId = sourceFabricProviderId; + TargetFabricProviderId = targetFabricProviderId; + AllowedActions = allowedActions; + ActivityId = activityId; + Tasks = tasks; + Errors = errors; + CustomProperties = customProperties; + } + + /// Gets or sets the friendly display name. + public string DisplayName { get; } + /// Gets or sets the workflow state. + public DataReplicationWorkflowState? State { get; } + /// Gets or sets the start time. + public DateTimeOffset? StartOn { get; } + /// Gets or sets the end time. + public DateTimeOffset? EndOn { get; } + /// Gets or sets the affected object Id. + public string ObjectId { get; } + /// Gets or sets the affected object name. + public string ObjectName { get; } + /// Gets or sets the affected object internal Id. + public string ObjectInternalId { get; } + /// Gets or sets the affected object internal name. + public string ObjectInternalName { get; } + /// Gets or sets the object type. + public WorkflowObjectType? ObjectType { get; } + /// Gets or sets the replication provider. + public string ReplicationProviderId { get; } + /// Gets or sets the source fabric provider. + public string SourceFabricProviderId { get; } + /// Gets or sets the target fabric provider. + public string TargetFabricProviderId { get; } + /// Gets or sets the list of allowed actions on the workflow. + public IReadOnlyList AllowedActions { get; } + /// Gets or sets the workflow activity id. + public string ActivityId { get; } + /// Gets or sets the list of tasks. + public IReadOnlyList Tasks { get; } + /// Gets or sets the list of errors. + public IReadOnlyList Errors { get; } + /// + /// Workflow model custom properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + public WorkflowModelCustomProperties CustomProperties { get; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationWorkflowState.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationWorkflowState.cs new file mode 100644 index 000000000000..bad418c9c9a5 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DataReplicationWorkflowState.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// Gets or sets the workflow state. + public readonly partial struct DataReplicationWorkflowState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DataReplicationWorkflowState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PendingValue = "Pending"; + private const string StartedValue = "Started"; + private const string CancellingValue = "Cancelling"; + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CancelledValue = "Cancelled"; + private const string CompletedWithInformationValue = "CompletedWithInformation"; + private const string CompletedWithWarningsValue = "CompletedWithWarnings"; + private const string CompletedWithErrorsValue = "CompletedWithErrors"; + + /// Pending. + public static DataReplicationWorkflowState Pending { get; } = new DataReplicationWorkflowState(PendingValue); + /// Started. + public static DataReplicationWorkflowState Started { get; } = new DataReplicationWorkflowState(StartedValue); + /// Cancelling. + public static DataReplicationWorkflowState Cancelling { get; } = new DataReplicationWorkflowState(CancellingValue); + /// Succeeded. + public static DataReplicationWorkflowState Succeeded { get; } = new DataReplicationWorkflowState(SucceededValue); + /// Failed. + public static DataReplicationWorkflowState Failed { get; } = new DataReplicationWorkflowState(FailedValue); + /// Cancelled. + public static DataReplicationWorkflowState Cancelled { get; } = new DataReplicationWorkflowState(CancelledValue); + /// CompletedWithInformation. + public static DataReplicationWorkflowState CompletedWithInformation { get; } = new DataReplicationWorkflowState(CompletedWithInformationValue); + /// CompletedWithWarnings. + public static DataReplicationWorkflowState CompletedWithWarnings { get; } = new DataReplicationWorkflowState(CompletedWithWarningsValue); + /// CompletedWithErrors. + public static DataReplicationWorkflowState CompletedWithErrors { get; } = new DataReplicationWorkflowState(CompletedWithErrorsValue); + /// Determines if two values are the same. + public static bool operator ==(DataReplicationWorkflowState left, DataReplicationWorkflowState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DataReplicationWorkflowState left, DataReplicationWorkflowState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DataReplicationWorkflowState(string value) => new DataReplicationWorkflowState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DataReplicationWorkflowState other && Equals(other); + /// + public bool Equals(DataReplicationWorkflowState 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/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DeploymentPreflightModel.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DeploymentPreflightModel.Serialization.cs new file mode 100644 index 000000000000..103c7a0d18ef --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DeploymentPreflightModel.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.RecoveryServicesDataReplication.Models +{ + public partial class DeploymentPreflightModel : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Resources)) + { + writer.WritePropertyName("resources"u8); + writer.WriteStartArray(); + foreach (var item in Resources) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static DeploymentPreflightModel DeserializeDeploymentPreflightModel(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> resources = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("resources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DeploymentPreflightResource.DeserializeDeploymentPreflightResource(item)); + } + resources = array; + continue; + } + } + return new DeploymentPreflightModel(Optional.ToList(resources)); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DeploymentPreflightModel.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DeploymentPreflightModel.cs new file mode 100644 index 000000000000..fb28f4b1e420 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DeploymentPreflightModel.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.RecoveryServicesDataReplication.Models +{ + /// Deployment preflight model. + public partial class DeploymentPreflightModel + { + /// Initializes a new instance of DeploymentPreflightModel. + public DeploymentPreflightModel() + { + Resources = new ChangeTrackingList(); + } + + /// Initializes a new instance of DeploymentPreflightModel. + /// Gets or sets the list of resources. + internal DeploymentPreflightModel(IList resources) + { + Resources = resources; + } + + /// Gets or sets the list of resources. + public IList Resources { get; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DeploymentPreflightResource.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DeploymentPreflightResource.Serialization.cs new file mode 100644 index 000000000000..bef4433732c4 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DeploymentPreflightResource.Serialization.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + public partial class DeploymentPreflightResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(DeploymentPreflightResourceType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(DeploymentPreflightResourceType.Value); + } + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location.Value); + } + if (Optional.IsDefined(ApiVersion)) + { + writer.WritePropertyName("apiVersion"u8); + writer.WriteStringValue(ApiVersion); + } + writer.WriteEndObject(); + } + + internal static DeploymentPreflightResource DeserializeDeploymentPreflightResource(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional type = default; + Optional location = default; + Optional apiVersion = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("location"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("apiVersion"u8)) + { + apiVersion = property.Value.GetString(); + continue; + } + } + return new DeploymentPreflightResource(name.Value, Optional.ToNullable(type), Optional.ToNullable(location), apiVersion.Value); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DeploymentPreflightResource.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DeploymentPreflightResource.cs new file mode 100644 index 000000000000..eced01b5f2b9 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DeploymentPreflightResource.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// Deployment preflight resource. + public partial class DeploymentPreflightResource + { + /// Initializes a new instance of DeploymentPreflightResource. + public DeploymentPreflightResource() + { + } + + /// Initializes a new instance of DeploymentPreflightResource. + /// Gets or sets the resource name. + /// Gets or sets the resource type. + /// Gets or sets the location of the resource. + /// Gets or sets the Api version. + internal DeploymentPreflightResource(string name, ResourceType? deploymentPreflightResourceType, AzureLocation? location, string apiVersion) + { + Name = name; + DeploymentPreflightResourceType = deploymentPreflightResourceType; + Location = location; + ApiVersion = apiVersion; + } + + /// Gets or sets the resource name. + public string Name { get; set; } + /// Gets or sets the resource type. + public ResourceType? DeploymentPreflightResourceType { get; set; } + /// Gets or sets the location of the resource. + public AzureLocation? Location { get; set; } + /// Gets or sets the Api version. + public string ApiVersion { get; set; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DraModelCustomProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DraModelCustomProperties.Serialization.cs new file mode 100644 index 000000000000..a50c48a55706 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DraModelCustomProperties.Serialization.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + public partial class DraModelCustomProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("instanceType"u8); + writer.WriteStringValue(InstanceType); + writer.WriteEndObject(); + } + + internal static DraModelCustomProperties DeserializeDraModelCustomProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("instanceType", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "DraModelCustomProperties": return GeneralDraModelCustomProperties.DeserializeGeneralDraModelCustomProperties(element); + case "VMware": return VMwareDraModelCustomProperties.DeserializeVMwareDraModelCustomProperties(element); + } + } + return UnknownDraModelCustomProperties.DeserializeUnknownDraModelCustomProperties(element); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DraModelCustomProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DraModelCustomProperties.cs new file mode 100644 index 000000000000..b13e5ad3d3a6 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/DraModelCustomProperties.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// + /// Dra model custom properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public abstract partial class DraModelCustomProperties + { + /// Initializes a new instance of DraModelCustomProperties. + protected DraModelCustomProperties() + { + } + + /// Initializes a new instance of DraModelCustomProperties. + /// Gets or sets the instance type. + internal DraModelCustomProperties(string instanceType) + { + InstanceType = instanceType; + } + + /// Gets or sets the instance type. + internal string InstanceType { get; set; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/EventModelCustomProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/EventModelCustomProperties.Serialization.cs new file mode 100644 index 000000000000..96b5f19544c6 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/EventModelCustomProperties.Serialization.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + public partial class EventModelCustomProperties + { + internal static EventModelCustomProperties DeserializeEventModelCustomProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("instanceType", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "HyperVToAzStackHCI": return HyperVToAzStackHciEventModelCustomProperties.DeserializeHyperVToAzStackHciEventModelCustomProperties(element); + } + } + return UnknownEventModelCustomProperties.DeserializeUnknownEventModelCustomProperties(element); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/EventModelCustomProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/EventModelCustomProperties.cs new file mode 100644 index 000000000000..d7e708a77f12 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/EventModelCustomProperties.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// + /// Event model custom properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + public abstract partial class EventModelCustomProperties + { + /// Initializes a new instance of EventModelCustomProperties. + protected EventModelCustomProperties() + { + } + + /// Initializes a new instance of EventModelCustomProperties. + /// Gets or sets the instance type. + internal EventModelCustomProperties(string instanceType) + { + InstanceType = instanceType; + } + + /// Gets or sets the instance type. + internal string InstanceType { get; set; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/FabricModelCustomProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/FabricModelCustomProperties.Serialization.cs new file mode 100644 index 000000000000..764dc931068c --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/FabricModelCustomProperties.Serialization.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + public partial class FabricModelCustomProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("instanceType"u8); + writer.WriteStringValue(InstanceType); + writer.WriteEndObject(); + } + + internal static FabricModelCustomProperties DeserializeFabricModelCustomProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("instanceType", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "AzStackHCI": return AzStackHciFabricModelCustomProperties.DeserializeAzStackHciFabricModelCustomProperties(element); + case "FabricModelCustomProperties": return GeneralFabricModelCustomProperties.DeserializeGeneralFabricModelCustomProperties(element); + case "HyperVMigrate": return HyperVMigrateFabricModelCustomProperties.DeserializeHyperVMigrateFabricModelCustomProperties(element); + case "VMwareMigrate": return VMwareMigrateFabricModelCustomProperties.DeserializeVMwareMigrateFabricModelCustomProperties(element); + } + } + return UnknownFabricModelCustomProperties.DeserializeUnknownFabricModelCustomProperties(element); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/FabricModelCustomProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/FabricModelCustomProperties.cs new file mode 100644 index 000000000000..d5f1e9ab4fcf --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/FabricModelCustomProperties.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// + /// Fabric model custom properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , and . + /// + public abstract partial class FabricModelCustomProperties + { + /// Initializes a new instance of FabricModelCustomProperties. + protected FabricModelCustomProperties() + { + } + + /// Initializes a new instance of FabricModelCustomProperties. + /// Gets or sets the instance type. + internal FabricModelCustomProperties(string instanceType) + { + InstanceType = instanceType; + } + + /// Gets or sets the instance type. + internal string InstanceType { get; set; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/FailoverProtectedItemProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/FailoverProtectedItemProperties.Serialization.cs new file mode 100644 index 000000000000..f5727695d291 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/FailoverProtectedItemProperties.Serialization.cs @@ -0,0 +1,74 @@ +// 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.RecoveryServicesDataReplication.Models +{ + public partial class FailoverProtectedItemProperties + { + internal static FailoverProtectedItemProperties DeserializeFailoverProtectedItemProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional protectedItemName = default; + Optional vmName = default; + Optional testVmName = default; + Optional recoveryPointId = default; + Optional recoveryPointTime = default; + Optional networkName = default; + Optional subnet = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("protectedItemName"u8)) + { + protectedItemName = property.Value.GetString(); + continue; + } + if (property.NameEquals("vmName"u8)) + { + vmName = property.Value.GetString(); + continue; + } + if (property.NameEquals("testVmName"u8)) + { + testVmName = property.Value.GetString(); + continue; + } + if (property.NameEquals("recoveryPointId"u8)) + { + recoveryPointId = property.Value.GetString(); + continue; + } + if (property.NameEquals("recoveryPointTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + recoveryPointTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("networkName"u8)) + { + networkName = property.Value.GetString(); + continue; + } + if (property.NameEquals("subnet"u8)) + { + subnet = property.Value.GetString(); + continue; + } + } + return new FailoverProtectedItemProperties(protectedItemName.Value, vmName.Value, testVmName.Value, recoveryPointId.Value, Optional.ToNullable(recoveryPointTime), networkName.Value, subnet.Value); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/FailoverProtectedItemProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/FailoverProtectedItemProperties.cs new file mode 100644 index 000000000000..1718766f41d1 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/FailoverProtectedItemProperties.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// Failover properties of the protected item. + public partial class FailoverProtectedItemProperties + { + /// Initializes a new instance of FailoverProtectedItemProperties. + internal FailoverProtectedItemProperties() + { + } + + /// Initializes a new instance of FailoverProtectedItemProperties. + /// Gets or sets the protected item name. + /// Gets or sets the VM name. + /// Gets or sets the test VM name. + /// Gets or sets the recovery point Id. + /// Gets or sets the recovery point time. + /// Gets or sets the network name. + /// Gets or sets the network subnet. + internal FailoverProtectedItemProperties(string protectedItemName, string vmName, string testVmName, string recoveryPointId, DateTimeOffset? recoveryPointOn, string networkName, string subnet) + { + ProtectedItemName = protectedItemName; + VmName = vmName; + TestVmName = testVmName; + RecoveryPointId = recoveryPointId; + RecoveryPointOn = recoveryPointOn; + NetworkName = networkName; + Subnet = subnet; + } + + /// Gets or sets the protected item name. + public string ProtectedItemName { get; } + /// Gets or sets the VM name. + public string VmName { get; } + /// Gets or sets the test VM name. + public string TestVmName { get; } + /// Gets or sets the recovery point Id. + public string RecoveryPointId { get; } + /// Gets or sets the recovery point time. + public DateTimeOffset? RecoveryPointOn { get; } + /// Gets or sets the network name. + public string NetworkName { get; } + /// Gets or sets the network subnet. + public string Subnet { get; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/FailoverWorkflowModelCustomProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/FailoverWorkflowModelCustomProperties.Serialization.cs new file mode 100644 index 000000000000..5edfb49e62b6 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/FailoverWorkflowModelCustomProperties.Serialization.cs @@ -0,0 +1,64 @@ +// 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.RecoveryServicesDataReplication.Models +{ + public partial class FailoverWorkflowModelCustomProperties + { + internal static FailoverWorkflowModelCustomProperties DeserializeFailoverWorkflowModelCustomProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> protectedItemDetails = default; + string instanceType = default; + Optional> affectedObjectDetails = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("protectedItemDetails"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(FailoverProtectedItemProperties.DeserializeFailoverProtectedItemProperties(item)); + } + protectedItemDetails = array; + continue; + } + if (property.NameEquals("instanceType"u8)) + { + instanceType = property.Value.GetString(); + continue; + } + if (property.NameEquals("affectedObjectDetails"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()); + } + affectedObjectDetails = dictionary; + continue; + } + } + return new FailoverWorkflowModelCustomProperties(instanceType, Optional.ToDictionary(affectedObjectDetails), Optional.ToList(protectedItemDetails)); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/FailoverWorkflowModelCustomProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/FailoverWorkflowModelCustomProperties.cs new file mode 100644 index 000000000000..94bfe5c4203b --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/FailoverWorkflowModelCustomProperties.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// Failover workflow model custom properties. + public partial class FailoverWorkflowModelCustomProperties : WorkflowModelCustomProperties + { + /// Initializes a new instance of FailoverWorkflowModelCustomProperties. + internal FailoverWorkflowModelCustomProperties() + { + ProtectedItemDetails = new ChangeTrackingList(); + InstanceType = "FailoverWorkflowDetails"; + } + + /// Initializes a new instance of FailoverWorkflowModelCustomProperties. + /// Gets or sets the instance type. + /// Gets or sets any custom properties of the affected object. + /// Gets or sets the failed over protected item details. + internal FailoverWorkflowModelCustomProperties(string instanceType, IReadOnlyDictionary affectedObjectDetails, IReadOnlyList protectedItemDetails) : base(instanceType, affectedObjectDetails) + { + ProtectedItemDetails = protectedItemDetails; + InstanceType = instanceType ?? "FailoverWorkflowDetails"; + } + + /// Gets or sets the failed over protected item details. + public IReadOnlyList ProtectedItemDetails { get; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/GeneralDraModelCustomProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/GeneralDraModelCustomProperties.Serialization.cs new file mode 100644 index 000000000000..9bba016751d5 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/GeneralDraModelCustomProperties.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.RecoveryServicesDataReplication.Models +{ + public partial class GeneralDraModelCustomProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("instanceType"u8); + writer.WriteStringValue(InstanceType); + writer.WriteEndObject(); + } + + internal static GeneralDraModelCustomProperties DeserializeGeneralDraModelCustomProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string instanceType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("instanceType"u8)) + { + instanceType = property.Value.GetString(); + continue; + } + } + return new GeneralDraModelCustomProperties(instanceType); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/GeneralDraModelCustomProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/GeneralDraModelCustomProperties.cs new file mode 100644 index 000000000000..5adc113dbd83 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/GeneralDraModelCustomProperties.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// General DRA model custom properties. + public partial class GeneralDraModelCustomProperties : DraModelCustomProperties + { + /// Initializes a new instance of GeneralDraModelCustomProperties. + public GeneralDraModelCustomProperties() + { + InstanceType = "DraModelCustomProperties"; + } + + /// Initializes a new instance of GeneralDraModelCustomProperties. + /// Gets or sets the instance type. + internal GeneralDraModelCustomProperties(string instanceType) : base(instanceType) + { + InstanceType = instanceType ?? "DraModelCustomProperties"; + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/GeneralFabricModelCustomProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/GeneralFabricModelCustomProperties.Serialization.cs new file mode 100644 index 000000000000..727e52449549 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/GeneralFabricModelCustomProperties.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.RecoveryServicesDataReplication.Models +{ + public partial class GeneralFabricModelCustomProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("instanceType"u8); + writer.WriteStringValue(InstanceType); + writer.WriteEndObject(); + } + + internal static GeneralFabricModelCustomProperties DeserializeGeneralFabricModelCustomProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string instanceType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("instanceType"u8)) + { + instanceType = property.Value.GetString(); + continue; + } + } + return new GeneralFabricModelCustomProperties(instanceType); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/GeneralFabricModelCustomProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/GeneralFabricModelCustomProperties.cs new file mode 100644 index 000000000000..9029d9e341d6 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/GeneralFabricModelCustomProperties.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// General fabric model custom properties. + public partial class GeneralFabricModelCustomProperties : FabricModelCustomProperties + { + /// Initializes a new instance of GeneralFabricModelCustomProperties. + public GeneralFabricModelCustomProperties() + { + InstanceType = "FabricModelCustomProperties"; + } + + /// Initializes a new instance of GeneralFabricModelCustomProperties. + /// Gets or sets the instance type. + internal GeneralFabricModelCustomProperties(string instanceType) : base(instanceType) + { + InstanceType = instanceType ?? "FabricModelCustomProperties"; + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/GeneralPlannedFailoverModelCustomProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/GeneralPlannedFailoverModelCustomProperties.Serialization.cs new file mode 100644 index 000000000000..b72f28c2ca45 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/GeneralPlannedFailoverModelCustomProperties.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.RecoveryServicesDataReplication.Models +{ + public partial class GeneralPlannedFailoverModelCustomProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("instanceType"u8); + writer.WriteStringValue(InstanceType); + writer.WriteEndObject(); + } + + internal static GeneralPlannedFailoverModelCustomProperties DeserializeGeneralPlannedFailoverModelCustomProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string instanceType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("instanceType"u8)) + { + instanceType = property.Value.GetString(); + continue; + } + } + return new GeneralPlannedFailoverModelCustomProperties(instanceType); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/GeneralPlannedFailoverModelCustomProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/GeneralPlannedFailoverModelCustomProperties.cs new file mode 100644 index 000000000000..f866cdb6e0a3 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/GeneralPlannedFailoverModelCustomProperties.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// General planned failover model custom properties. + public partial class GeneralPlannedFailoverModelCustomProperties : PlannedFailoverModelCustomProperties + { + /// Initializes a new instance of GeneralPlannedFailoverModelCustomProperties. + public GeneralPlannedFailoverModelCustomProperties() + { + InstanceType = "PlannedFailoverModelCustomProperties"; + } + + /// Initializes a new instance of GeneralPlannedFailoverModelCustomProperties. + /// Gets or sets the instance type. + internal GeneralPlannedFailoverModelCustomProperties(string instanceType) : base(instanceType) + { + InstanceType = instanceType ?? "PlannedFailoverModelCustomProperties"; + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/GeneralPolicyModelCustomProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/GeneralPolicyModelCustomProperties.Serialization.cs new file mode 100644 index 000000000000..bf7dd2a9c03d --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/GeneralPolicyModelCustomProperties.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.RecoveryServicesDataReplication.Models +{ + public partial class GeneralPolicyModelCustomProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("instanceType"u8); + writer.WriteStringValue(InstanceType); + writer.WriteEndObject(); + } + + internal static GeneralPolicyModelCustomProperties DeserializeGeneralPolicyModelCustomProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string instanceType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("instanceType"u8)) + { + instanceType = property.Value.GetString(); + continue; + } + } + return new GeneralPolicyModelCustomProperties(instanceType); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/GeneralPolicyModelCustomProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/GeneralPolicyModelCustomProperties.cs new file mode 100644 index 000000000000..aef17e83507f --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/GeneralPolicyModelCustomProperties.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// General Policy model custom properties. + public partial class GeneralPolicyModelCustomProperties : PolicyModelCustomProperties + { + /// Initializes a new instance of GeneralPolicyModelCustomProperties. + public GeneralPolicyModelCustomProperties() + { + InstanceType = "PolicyModelCustomProperties"; + } + + /// Initializes a new instance of GeneralPolicyModelCustomProperties. + /// Gets or sets the instance type. + internal GeneralPolicyModelCustomProperties(string instanceType) : base(instanceType) + { + InstanceType = instanceType ?? "PolicyModelCustomProperties"; + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/GeneralProtectedItemModelCustomProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/GeneralProtectedItemModelCustomProperties.Serialization.cs new file mode 100644 index 000000000000..e7ef91c51471 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/GeneralProtectedItemModelCustomProperties.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.RecoveryServicesDataReplication.Models +{ + public partial class GeneralProtectedItemModelCustomProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("instanceType"u8); + writer.WriteStringValue(InstanceType); + writer.WriteEndObject(); + } + + internal static GeneralProtectedItemModelCustomProperties DeserializeGeneralProtectedItemModelCustomProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string instanceType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("instanceType"u8)) + { + instanceType = property.Value.GetString(); + continue; + } + } + return new GeneralProtectedItemModelCustomProperties(instanceType); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/GeneralProtectedItemModelCustomProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/GeneralProtectedItemModelCustomProperties.cs new file mode 100644 index 000000000000..4f697a6364db --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/GeneralProtectedItemModelCustomProperties.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// General Protected item model custom properties. + public partial class GeneralProtectedItemModelCustomProperties : ProtectedItemModelCustomProperties + { + /// Initializes a new instance of GeneralProtectedItemModelCustomProperties. + public GeneralProtectedItemModelCustomProperties() + { + InstanceType = "ProtectedItemModelCustomProperties"; + } + + /// Initializes a new instance of GeneralProtectedItemModelCustomProperties. + /// Gets or sets the instance type. + internal GeneralProtectedItemModelCustomProperties(string instanceType) : base(instanceType) + { + InstanceType = instanceType ?? "ProtectedItemModelCustomProperties"; + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/GeneralReplicationExtensionModelCustomProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/GeneralReplicationExtensionModelCustomProperties.Serialization.cs new file mode 100644 index 000000000000..e0af8ed36465 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/GeneralReplicationExtensionModelCustomProperties.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.RecoveryServicesDataReplication.Models +{ + public partial class GeneralReplicationExtensionModelCustomProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("instanceType"u8); + writer.WriteStringValue(InstanceType); + writer.WriteEndObject(); + } + + internal static GeneralReplicationExtensionModelCustomProperties DeserializeGeneralReplicationExtensionModelCustomProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string instanceType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("instanceType"u8)) + { + instanceType = property.Value.GetString(); + continue; + } + } + return new GeneralReplicationExtensionModelCustomProperties(instanceType); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/GeneralReplicationExtensionModelCustomProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/GeneralReplicationExtensionModelCustomProperties.cs new file mode 100644 index 000000000000..8bce73013a9e --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/GeneralReplicationExtensionModelCustomProperties.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// General Replication extension model custom properties. + public partial class GeneralReplicationExtensionModelCustomProperties : ReplicationExtensionModelCustomProperties + { + /// Initializes a new instance of GeneralReplicationExtensionModelCustomProperties. + public GeneralReplicationExtensionModelCustomProperties() + { + InstanceType = "ReplicationExtensionModelCustomProperties"; + } + + /// Initializes a new instance of GeneralReplicationExtensionModelCustomProperties. + /// Gets or sets the instance type. + internal GeneralReplicationExtensionModelCustomProperties(string instanceType) : base(instanceType) + { + InstanceType = instanceType ?? "ReplicationExtensionModelCustomProperties"; + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVMigrateFabricModelCustomProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVMigrateFabricModelCustomProperties.Serialization.cs new file mode 100644 index 000000000000..5a8b43a9ab1c --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVMigrateFabricModelCustomProperties.Serialization.cs @@ -0,0 +1,84 @@ +// 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.RecoveryServicesDataReplication.Models +{ + public partial class HyperVMigrateFabricModelCustomProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("hyperVSiteId"u8); + writer.WriteStringValue(HyperVSiteId); + writer.WritePropertyName("migrationSolutionId"u8); + writer.WriteStringValue(MigrationSolutionId); + writer.WritePropertyName("instanceType"u8); + writer.WriteStringValue(InstanceType); + writer.WriteEndObject(); + } + + internal static HyperVMigrateFabricModelCustomProperties DeserializeHyperVMigrateFabricModelCustomProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier hyperVSiteId = default; + Optional fabricResourceId = default; + Optional fabricContainerId = default; + ResourceIdentifier migrationSolutionId = default; + Optional migrationHubUri = default; + string instanceType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("hyperVSiteId"u8)) + { + hyperVSiteId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("fabricResourceId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + fabricResourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("fabricContainerId"u8)) + { + fabricContainerId = property.Value.GetString(); + continue; + } + if (property.NameEquals("migrationSolutionId"u8)) + { + migrationSolutionId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("migrationHubUri"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + migrationHubUri = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("instanceType"u8)) + { + instanceType = property.Value.GetString(); + continue; + } + } + return new HyperVMigrateFabricModelCustomProperties(instanceType, hyperVSiteId, fabricResourceId.Value, fabricContainerId.Value, migrationSolutionId, migrationHubUri.Value); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVMigrateFabricModelCustomProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVMigrateFabricModelCustomProperties.cs new file mode 100644 index 000000000000..01a0fabf603b --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVMigrateFabricModelCustomProperties.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// HyperV migrate fabric model custom properties. + public partial class HyperVMigrateFabricModelCustomProperties : FabricModelCustomProperties + { + /// Initializes a new instance of HyperVMigrateFabricModelCustomProperties. + /// Gets or sets the ARM Id of the HyperV site. + /// Gets or sets the migration solution ARM Id. + /// or is null. + public HyperVMigrateFabricModelCustomProperties(ResourceIdentifier hyperVSiteId, ResourceIdentifier migrationSolutionId) + { + Argument.AssertNotNull(hyperVSiteId, nameof(hyperVSiteId)); + Argument.AssertNotNull(migrationSolutionId, nameof(migrationSolutionId)); + + HyperVSiteId = hyperVSiteId; + MigrationSolutionId = migrationSolutionId; + InstanceType = "HyperVMigrate"; + } + + /// Initializes a new instance of HyperVMigrateFabricModelCustomProperties. + /// Gets or sets the instance type. + /// Gets or sets the ARM Id of the HyperV site. + /// Gets or sets the fabric resource Id. + /// Gets or sets the fabric container Id. + /// Gets or sets the migration solution ARM Id. + /// Gets or sets the migration hub Uri. + internal HyperVMigrateFabricModelCustomProperties(string instanceType, ResourceIdentifier hyperVSiteId, ResourceIdentifier fabricResourceId, string fabricContainerId, ResourceIdentifier migrationSolutionId, Uri migrationHubUri) : base(instanceType) + { + HyperVSiteId = hyperVSiteId; + FabricResourceId = fabricResourceId; + FabricContainerId = fabricContainerId; + MigrationSolutionId = migrationSolutionId; + MigrationHubUri = migrationHubUri; + InstanceType = instanceType ?? "HyperVMigrate"; + } + + /// Gets or sets the ARM Id of the HyperV site. + public ResourceIdentifier HyperVSiteId { get; set; } + /// Gets or sets the fabric resource Id. + public ResourceIdentifier FabricResourceId { get; } + /// Gets or sets the fabric container Id. + public string FabricContainerId { get; } + /// Gets or sets the migration solution ARM Id. + public ResourceIdentifier MigrationSolutionId { get; set; } + /// Gets or sets the migration hub Uri. + public Uri MigrationHubUri { get; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciDiskInput.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciDiskInput.Serialization.cs new file mode 100644 index 000000000000..859dce241069 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciDiskInput.Serialization.cs @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + public partial class HyperVToAzStackHciDiskInput : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("diskId"u8); + writer.WriteStringValue(DiskId); + if (Optional.IsDefined(StorageContainerId)) + { + writer.WritePropertyName("storageContainerId"u8); + writer.WriteStringValue(StorageContainerId); + } + if (Optional.IsDefined(IsDynamic)) + { + writer.WritePropertyName("isDynamic"u8); + writer.WriteBooleanValue(IsDynamic.Value); + } + writer.WritePropertyName("diskSizeGB"u8); + writer.WriteNumberValue(DiskSizeGB); + writer.WritePropertyName("diskFileFormat"u8); + writer.WriteStringValue(DiskFileFormat); + writer.WritePropertyName("isOsDisk"u8); + writer.WriteBooleanValue(IsOSDisk); + writer.WriteEndObject(); + } + + internal static HyperVToAzStackHciDiskInput DeserializeHyperVToAzStackHciDiskInput(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string diskId = default; + Optional storageContainerId = default; + Optional isDynamic = default; + long diskSizeGB = default; + string diskFileFormat = default; + bool isOSDisk = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("diskId"u8)) + { + diskId = property.Value.GetString(); + continue; + } + if (property.NameEquals("storageContainerId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + storageContainerId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("isDynamic"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isDynamic = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("diskSizeGB"u8)) + { + diskSizeGB = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("diskFileFormat"u8)) + { + diskFileFormat = property.Value.GetString(); + continue; + } + if (property.NameEquals("isOsDisk"u8)) + { + isOSDisk = property.Value.GetBoolean(); + continue; + } + } + return new HyperVToAzStackHciDiskInput(diskId, storageContainerId.Value, Optional.ToNullable(isDynamic), diskSizeGB, diskFileFormat, isOSDisk); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciDiskInput.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciDiskInput.cs new file mode 100644 index 000000000000..f4e74f1ebe27 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciDiskInput.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// HyperVToAzStack disk input. + public partial class HyperVToAzStackHciDiskInput + { + /// Initializes a new instance of HyperVToAzStackHciDiskInput. + /// Gets or sets the disk Id. + /// Gets or sets the disk size in GB. + /// Gets or sets the type of the virtual hard disk, vhd or vhdx. + /// Gets or sets a value indicating whether disk is os disk. + /// or is null. + public HyperVToAzStackHciDiskInput(string diskId, long diskSizeGB, string diskFileFormat, bool isOSDisk) + { + Argument.AssertNotNull(diskId, nameof(diskId)); + Argument.AssertNotNull(diskFileFormat, nameof(diskFileFormat)); + + DiskId = diskId; + DiskSizeGB = diskSizeGB; + DiskFileFormat = diskFileFormat; + IsOSDisk = isOSDisk; + } + + /// Initializes a new instance of HyperVToAzStackHciDiskInput. + /// Gets or sets the disk Id. + /// Gets or sets the target storage account ARM Id. + /// + /// Gets or sets a value indicating whether dynamic sizing is enabled on the virtual hard + /// disk. + /// + /// Gets or sets the disk size in GB. + /// Gets or sets the type of the virtual hard disk, vhd or vhdx. + /// Gets or sets a value indicating whether disk is os disk. + internal HyperVToAzStackHciDiskInput(string diskId, ResourceIdentifier storageContainerId, bool? isDynamic, long diskSizeGB, string diskFileFormat, bool isOSDisk) + { + DiskId = diskId; + StorageContainerId = storageContainerId; + IsDynamic = isDynamic; + DiskSizeGB = diskSizeGB; + DiskFileFormat = diskFileFormat; + IsOSDisk = isOSDisk; + } + + /// Gets or sets the disk Id. + public string DiskId { get; set; } + /// Gets or sets the target storage account ARM Id. + public ResourceIdentifier StorageContainerId { get; set; } + /// + /// Gets or sets a value indicating whether dynamic sizing is enabled on the virtual hard + /// disk. + /// + public bool? IsDynamic { get; set; } + /// Gets or sets the disk size in GB. + public long DiskSizeGB { get; set; } + /// Gets or sets the type of the virtual hard disk, vhd or vhdx. + public string DiskFileFormat { get; set; } + /// Gets or sets a value indicating whether disk is os disk. + public bool IsOSDisk { get; set; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciEventModelCustomProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciEventModelCustomProperties.Serialization.cs new file mode 100644 index 000000000000..e4747b0a34fc --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciEventModelCustomProperties.Serialization.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + public partial class HyperVToAzStackHciEventModelCustomProperties + { + internal static HyperVToAzStackHciEventModelCustomProperties DeserializeHyperVToAzStackHciEventModelCustomProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional eventSourceFriendlyName = default; + Optional protectedItemFriendlyName = default; + Optional sourceApplianceName = default; + Optional targetApplianceName = default; + Optional serverType = default; + string instanceType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("eventSourceFriendlyName"u8)) + { + eventSourceFriendlyName = property.Value.GetString(); + continue; + } + if (property.NameEquals("protectedItemFriendlyName"u8)) + { + protectedItemFriendlyName = property.Value.GetString(); + continue; + } + if (property.NameEquals("sourceApplianceName"u8)) + { + sourceApplianceName = property.Value.GetString(); + continue; + } + if (property.NameEquals("targetApplianceName"u8)) + { + targetApplianceName = property.Value.GetString(); + continue; + } + if (property.NameEquals("serverType"u8)) + { + serverType = property.Value.GetString(); + continue; + } + if (property.NameEquals("instanceType"u8)) + { + instanceType = property.Value.GetString(); + continue; + } + } + return new HyperVToAzStackHciEventModelCustomProperties(instanceType, eventSourceFriendlyName.Value, protectedItemFriendlyName.Value, sourceApplianceName.Value, targetApplianceName.Value, serverType.Value); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciEventModelCustomProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciEventModelCustomProperties.cs new file mode 100644 index 000000000000..b52350893cd5 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciEventModelCustomProperties.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// + /// HyperV to AzStackHCI event model custom properties. This class provides provider specific + /// details for events of type DataContract.HealthEvents.HealthEventType.ProtectedItemHealth and + /// DataContract.HealthEvents.HealthEventType.AgentHealth. + /// + public partial class HyperVToAzStackHciEventModelCustomProperties : EventModelCustomProperties + { + /// Initializes a new instance of HyperVToAzStackHciEventModelCustomProperties. + internal HyperVToAzStackHciEventModelCustomProperties() + { + InstanceType = "HyperVToAzStackHCI"; + } + + /// Initializes a new instance of HyperVToAzStackHciEventModelCustomProperties. + /// Gets or sets the instance type. + /// Gets or sets the friendly name of the source which has raised this health event. + /// Gets or sets the protected item friendly name. + /// Gets or sets the source appliance name. + /// Gets or sets the source target name. + /// Gets or sets the server type. + internal HyperVToAzStackHciEventModelCustomProperties(string instanceType, string eventSourceFriendlyName, string protectedItemFriendlyName, string sourceApplianceName, string targetApplianceName, string serverType) : base(instanceType) + { + EventSourceFriendlyName = eventSourceFriendlyName; + ProtectedItemFriendlyName = protectedItemFriendlyName; + SourceApplianceName = sourceApplianceName; + TargetApplianceName = targetApplianceName; + ServerType = serverType; + InstanceType = instanceType ?? "HyperVToAzStackHCI"; + } + + /// Gets or sets the friendly name of the source which has raised this health event. + public string EventSourceFriendlyName { get; } + /// Gets or sets the protected item friendly name. + public string ProtectedItemFriendlyName { get; } + /// Gets or sets the source appliance name. + public string SourceApplianceName { get; } + /// Gets or sets the source target name. + public string TargetApplianceName { get; } + /// Gets or sets the server type. + public string ServerType { get; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciNicInput.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciNicInput.Serialization.cs new file mode 100644 index 000000000000..5df44e2e52ee --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciNicInput.Serialization.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + public partial class HyperVToAzStackHciNicInput : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("nicId"u8); + writer.WriteStringValue(NicId); + writer.WritePropertyName("targetNetworkId"u8); + writer.WriteStringValue(TargetNetworkId); + writer.WritePropertyName("testNetworkId"u8); + writer.WriteStringValue(TestNetworkId); + writer.WritePropertyName("selectionTypeForFailover"u8); + writer.WriteStringValue(SelectionTypeForFailover.ToString()); + writer.WriteEndObject(); + } + + internal static HyperVToAzStackHciNicInput DeserializeHyperVToAzStackHciNicInput(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string nicId = default; + Optional networkName = default; + string targetNetworkId = default; + string testNetworkId = default; + VmNicSelection selectionTypeForFailover = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("nicId"u8)) + { + nicId = property.Value.GetString(); + continue; + } + if (property.NameEquals("networkName"u8)) + { + networkName = property.Value.GetString(); + continue; + } + if (property.NameEquals("targetNetworkId"u8)) + { + targetNetworkId = property.Value.GetString(); + continue; + } + if (property.NameEquals("testNetworkId"u8)) + { + testNetworkId = property.Value.GetString(); + continue; + } + if (property.NameEquals("selectionTypeForFailover"u8)) + { + selectionTypeForFailover = new VmNicSelection(property.Value.GetString()); + continue; + } + } + return new HyperVToAzStackHciNicInput(nicId, networkName.Value, targetNetworkId, testNetworkId, selectionTypeForFailover); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciNicInput.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciNicInput.cs new file mode 100644 index 000000000000..90d9f0516902 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciNicInput.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// HyperVToAzStackHCI NIC properties. + public partial class HyperVToAzStackHciNicInput + { + /// Initializes a new instance of HyperVToAzStackHciNicInput. + /// Gets or sets the NIC Id. + /// Gets or sets the target network Id within AzStackHCI Cluster. + /// Gets or sets the target test network Id within AzStackHCI Cluster. + /// Gets or sets the selection type of the NIC. + /// , or is null. + public HyperVToAzStackHciNicInput(string nicId, string targetNetworkId, string testNetworkId, VmNicSelection selectionTypeForFailover) + { + Argument.AssertNotNull(nicId, nameof(nicId)); + Argument.AssertNotNull(targetNetworkId, nameof(targetNetworkId)); + Argument.AssertNotNull(testNetworkId, nameof(testNetworkId)); + + NicId = nicId; + TargetNetworkId = targetNetworkId; + TestNetworkId = testNetworkId; + SelectionTypeForFailover = selectionTypeForFailover; + } + + /// Initializes a new instance of HyperVToAzStackHciNicInput. + /// Gets or sets the NIC Id. + /// Gets or sets the network name. + /// Gets or sets the target network Id within AzStackHCI Cluster. + /// Gets or sets the target test network Id within AzStackHCI Cluster. + /// Gets or sets the selection type of the NIC. + internal HyperVToAzStackHciNicInput(string nicId, string networkName, string targetNetworkId, string testNetworkId, VmNicSelection selectionTypeForFailover) + { + NicId = nicId; + NetworkName = networkName; + TargetNetworkId = targetNetworkId; + TestNetworkId = testNetworkId; + SelectionTypeForFailover = selectionTypeForFailover; + } + + /// Gets or sets the NIC Id. + public string NicId { get; set; } + /// Gets or sets the network name. + public string NetworkName { get; } + /// Gets or sets the target network Id within AzStackHCI Cluster. + public string TargetNetworkId { get; set; } + /// Gets or sets the target test network Id within AzStackHCI Cluster. + public string TestNetworkId { get; set; } + /// Gets or sets the selection type of the NIC. + public VmNicSelection SelectionTypeForFailover { get; set; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciPlannedFailoverModelCustomProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciPlannedFailoverModelCustomProperties.Serialization.cs new file mode 100644 index 000000000000..d7ad4f435027 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciPlannedFailoverModelCustomProperties.Serialization.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + public partial class HyperVToAzStackHciPlannedFailoverModelCustomProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("shutdownSourceVM"u8); + writer.WriteBooleanValue(ShutdownSourceVm); + writer.WritePropertyName("instanceType"u8); + writer.WriteStringValue(InstanceType); + writer.WriteEndObject(); + } + + internal static HyperVToAzStackHciPlannedFailoverModelCustomProperties DeserializeHyperVToAzStackHciPlannedFailoverModelCustomProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool shutdownSourceVm = default; + string instanceType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("shutdownSourceVM"u8)) + { + shutdownSourceVm = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("instanceType"u8)) + { + instanceType = property.Value.GetString(); + continue; + } + } + return new HyperVToAzStackHciPlannedFailoverModelCustomProperties(instanceType, shutdownSourceVm); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciPlannedFailoverModelCustomProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciPlannedFailoverModelCustomProperties.cs new file mode 100644 index 000000000000..ad74861ddf35 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciPlannedFailoverModelCustomProperties.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// HyperV to AzStackHCI planned failover model custom properties. + public partial class HyperVToAzStackHciPlannedFailoverModelCustomProperties : PlannedFailoverModelCustomProperties + { + /// Initializes a new instance of HyperVToAzStackHciPlannedFailoverModelCustomProperties. + /// Gets or sets a value indicating whether VM needs to be shut down. + public HyperVToAzStackHciPlannedFailoverModelCustomProperties(bool shutdownSourceVm) + { + ShutdownSourceVm = shutdownSourceVm; + InstanceType = "HyperVToAzStackHCI"; + } + + /// Initializes a new instance of HyperVToAzStackHciPlannedFailoverModelCustomProperties. + /// Gets or sets the instance type. + /// Gets or sets a value indicating whether VM needs to be shut down. + internal HyperVToAzStackHciPlannedFailoverModelCustomProperties(string instanceType, bool shutdownSourceVm) : base(instanceType) + { + ShutdownSourceVm = shutdownSourceVm; + InstanceType = instanceType ?? "HyperVToAzStackHCI"; + } + + /// Gets or sets a value indicating whether VM needs to be shut down. + public bool ShutdownSourceVm { get; set; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciPolicyModelCustomProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciPolicyModelCustomProperties.Serialization.cs new file mode 100644 index 000000000000..98c4b07b25e0 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciPolicyModelCustomProperties.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.RecoveryServicesDataReplication.Models +{ + public partial class HyperVToAzStackHciPolicyModelCustomProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("recoveryPointHistoryInMinutes"u8); + writer.WriteNumberValue(RecoveryPointHistoryInMinutes); + writer.WritePropertyName("crashConsistentFrequencyInMinutes"u8); + writer.WriteNumberValue(CrashConsistentFrequencyInMinutes); + writer.WritePropertyName("appConsistentFrequencyInMinutes"u8); + writer.WriteNumberValue(AppConsistentFrequencyInMinutes); + writer.WritePropertyName("instanceType"u8); + writer.WriteStringValue(InstanceType); + writer.WriteEndObject(); + } + + internal static HyperVToAzStackHciPolicyModelCustomProperties DeserializeHyperVToAzStackHciPolicyModelCustomProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int recoveryPointHistoryInMinutes = default; + int crashConsistentFrequencyInMinutes = default; + int appConsistentFrequencyInMinutes = default; + string instanceType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("recoveryPointHistoryInMinutes"u8)) + { + recoveryPointHistoryInMinutes = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("crashConsistentFrequencyInMinutes"u8)) + { + crashConsistentFrequencyInMinutes = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("appConsistentFrequencyInMinutes"u8)) + { + appConsistentFrequencyInMinutes = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("instanceType"u8)) + { + instanceType = property.Value.GetString(); + continue; + } + } + return new HyperVToAzStackHciPolicyModelCustomProperties(instanceType, recoveryPointHistoryInMinutes, crashConsistentFrequencyInMinutes, appConsistentFrequencyInMinutes); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciPolicyModelCustomProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciPolicyModelCustomProperties.cs new file mode 100644 index 000000000000..6784ce452d5f --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciPolicyModelCustomProperties.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// HyperV To AzStackHCI Policy model custom properties. + public partial class HyperVToAzStackHciPolicyModelCustomProperties : PolicyModelCustomProperties + { + /// Initializes a new instance of HyperVToAzStackHciPolicyModelCustomProperties. + /// + /// Gets or sets the duration in minutes until which the recovery points need to be + /// stored. + /// + /// Gets or sets the crash consistent snapshot frequency (in minutes). + /// Gets or sets the app consistent snapshot frequency (in minutes). + public HyperVToAzStackHciPolicyModelCustomProperties(int recoveryPointHistoryInMinutes, int crashConsistentFrequencyInMinutes, int appConsistentFrequencyInMinutes) + { + RecoveryPointHistoryInMinutes = recoveryPointHistoryInMinutes; + CrashConsistentFrequencyInMinutes = crashConsistentFrequencyInMinutes; + AppConsistentFrequencyInMinutes = appConsistentFrequencyInMinutes; + InstanceType = "HyperVToAzStackHCI"; + } + + /// Initializes a new instance of HyperVToAzStackHciPolicyModelCustomProperties. + /// Gets or sets the instance type. + /// + /// Gets or sets the duration in minutes until which the recovery points need to be + /// stored. + /// + /// Gets or sets the crash consistent snapshot frequency (in minutes). + /// Gets or sets the app consistent snapshot frequency (in minutes). + internal HyperVToAzStackHciPolicyModelCustomProperties(string instanceType, int recoveryPointHistoryInMinutes, int crashConsistentFrequencyInMinutes, int appConsistentFrequencyInMinutes) : base(instanceType) + { + RecoveryPointHistoryInMinutes = recoveryPointHistoryInMinutes; + CrashConsistentFrequencyInMinutes = crashConsistentFrequencyInMinutes; + AppConsistentFrequencyInMinutes = appConsistentFrequencyInMinutes; + InstanceType = instanceType ?? "HyperVToAzStackHCI"; + } + + /// + /// Gets or sets the duration in minutes until which the recovery points need to be + /// stored. + /// + public int RecoveryPointHistoryInMinutes { get; set; } + /// Gets or sets the crash consistent snapshot frequency (in minutes). + public int CrashConsistentFrequencyInMinutes { get; set; } + /// Gets or sets the app consistent snapshot frequency (in minutes). + public int AppConsistentFrequencyInMinutes { get; set; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciProtectedDiskProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciProtectedDiskProperties.Serialization.cs new file mode 100644 index 000000000000..df4e73ab211f --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciProtectedDiskProperties.Serialization.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + public partial class HyperVToAzStackHciProtectedDiskProperties + { + internal static HyperVToAzStackHciProtectedDiskProperties DeserializeHyperVToAzStackHciProtectedDiskProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional storageContainerId = default; + Optional storageContainerLocalPath = default; + Optional sourceDiskId = default; + Optional sourceDiskName = default; + Optional seedDiskName = default; + Optional testMigrateDiskName = default; + Optional migrateDiskName = default; + Optional isOSDisk = default; + Optional capacityInBytes = default; + Optional isDynamic = default; + Optional diskType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("storageContainerId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + storageContainerId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("storageContainerLocalPath"u8)) + { + storageContainerLocalPath = property.Value.GetString(); + continue; + } + if (property.NameEquals("sourceDiskId"u8)) + { + sourceDiskId = property.Value.GetString(); + continue; + } + if (property.NameEquals("sourceDiskName"u8)) + { + sourceDiskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("seedDiskName"u8)) + { + seedDiskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("testMigrateDiskName"u8)) + { + testMigrateDiskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("migrateDiskName"u8)) + { + migrateDiskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("isOsDisk"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isOSDisk = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("capacityInBytes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + capacityInBytes = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("isDynamic"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isDynamic = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("diskType"u8)) + { + diskType = property.Value.GetString(); + continue; + } + } + return new HyperVToAzStackHciProtectedDiskProperties(storageContainerId.Value, storageContainerLocalPath.Value, sourceDiskId.Value, sourceDiskName.Value, seedDiskName.Value, testMigrateDiskName.Value, migrateDiskName.Value, Optional.ToNullable(isOSDisk), Optional.ToNullable(capacityInBytes), Optional.ToNullable(isDynamic), diskType.Value); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciProtectedDiskProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciProtectedDiskProperties.cs new file mode 100644 index 000000000000..fd87e0eaa1f9 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciProtectedDiskProperties.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// HyperVToAzStackHCI protected disk properties. + public partial class HyperVToAzStackHciProtectedDiskProperties + { + /// Initializes a new instance of HyperVToAzStackHciProtectedDiskProperties. + internal HyperVToAzStackHciProtectedDiskProperties() + { + } + + /// Initializes a new instance of HyperVToAzStackHciProtectedDiskProperties. + /// Gets or sets the ARM Id of the storage container. + /// Gets or sets the local path of the storage container. + /// Gets or sets the source disk Id. + /// Gets or sets the source disk Name. + /// Gets or sets the seed disk name. + /// Gets or sets the test failover clone disk. + /// Gets or sets the failover clone disk. + /// Gets or sets a value indicating whether the disk is the OS disk. + /// Gets or sets the disk capacity in bytes. + /// + /// Gets or sets a value indicating whether dynamic sizing is enabled on the virtual hard + /// disk. + /// + /// Gets or sets the disk type. + internal HyperVToAzStackHciProtectedDiskProperties(ResourceIdentifier storageContainerId, string storageContainerLocalPath, string sourceDiskId, string sourceDiskName, string seedDiskName, string testMigrateDiskName, string migrateDiskName, bool? isOSDisk, long? capacityInBytes, bool? isDynamic, string diskType) + { + StorageContainerId = storageContainerId; + StorageContainerLocalPath = storageContainerLocalPath; + SourceDiskId = sourceDiskId; + SourceDiskName = sourceDiskName; + SeedDiskName = seedDiskName; + TestMigrateDiskName = testMigrateDiskName; + MigrateDiskName = migrateDiskName; + IsOSDisk = isOSDisk; + CapacityInBytes = capacityInBytes; + IsDynamic = isDynamic; + DiskType = diskType; + } + + /// Gets or sets the ARM Id of the storage container. + public ResourceIdentifier StorageContainerId { get; } + /// Gets or sets the local path of the storage container. + public string StorageContainerLocalPath { get; } + /// Gets or sets the source disk Id. + public string SourceDiskId { get; } + /// Gets or sets the source disk Name. + public string SourceDiskName { get; } + /// Gets or sets the seed disk name. + public string SeedDiskName { get; } + /// Gets or sets the test failover clone disk. + public string TestMigrateDiskName { get; } + /// Gets or sets the failover clone disk. + public string MigrateDiskName { get; } + /// Gets or sets a value indicating whether the disk is the OS disk. + public bool? IsOSDisk { get; } + /// Gets or sets the disk capacity in bytes. + public long? CapacityInBytes { get; } + /// + /// Gets or sets a value indicating whether dynamic sizing is enabled on the virtual hard + /// disk. + /// + public bool? IsDynamic { get; } + /// Gets or sets the disk type. + public string DiskType { get; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciProtectedItemModelCustomProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciProtectedItemModelCustomProperties.Serialization.cs new file mode 100644 index 000000000000..1c1f089f1b13 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciProtectedItemModelCustomProperties.Serialization.cs @@ -0,0 +1,418 @@ +// 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; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + public partial class HyperVToAzStackHciProtectedItemModelCustomProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("targetHciClusterId"u8); + writer.WriteStringValue(TargetHciClusterId); + writer.WritePropertyName("targetArcClusterCustomLocationId"u8); + writer.WriteStringValue(TargetArcClusterCustomLocationId); + writer.WritePropertyName("fabricDiscoveryMachineId"u8); + writer.WriteStringValue(FabricDiscoveryMachineId); + writer.WritePropertyName("disksToInclude"u8); + writer.WriteStartArray(); + foreach (var item in DisksToInclude) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + writer.WritePropertyName("nicsToInclude"u8); + writer.WriteStartArray(); + foreach (var item in NicsToInclude) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + if (Optional.IsDefined(TargetVmName)) + { + writer.WritePropertyName("targetVmName"u8); + writer.WriteStringValue(TargetVmName); + } + writer.WritePropertyName("targetResourceGroupId"u8); + writer.WriteStringValue(TargetResourceGroupId); + writer.WritePropertyName("storageContainerId"u8); + writer.WriteStringValue(StorageContainerId); + writer.WritePropertyName("hyperVGeneration"u8); + writer.WriteStringValue(HyperVGeneration); + if (Optional.IsDefined(TargetNetworkId)) + { + writer.WritePropertyName("targetNetworkId"u8); + writer.WriteStringValue(TargetNetworkId); + } + if (Optional.IsDefined(TestNetworkId)) + { + writer.WritePropertyName("testNetworkId"u8); + writer.WriteStringValue(TestNetworkId); + } + if (Optional.IsDefined(TargetCpuCores)) + { + writer.WritePropertyName("targetCpuCores"u8); + writer.WriteNumberValue(TargetCpuCores.Value); + } + if (Optional.IsDefined(IsDynamicRam)) + { + writer.WritePropertyName("isDynamicRam"u8); + writer.WriteBooleanValue(IsDynamicRam.Value); + } + if (Optional.IsDefined(DynamicMemoryConfig)) + { + writer.WritePropertyName("dynamicMemoryConfig"u8); + writer.WriteObjectValue(DynamicMemoryConfig); + } + if (Optional.IsDefined(TargetMemoryInMegaBytes)) + { + writer.WritePropertyName("targetMemoryInMegaBytes"u8); + writer.WriteNumberValue(TargetMemoryInMegaBytes.Value); + } + writer.WritePropertyName("runAsAccountId"u8); + writer.WriteStringValue(RunAsAccountId); + writer.WritePropertyName("sourceDraName"u8); + writer.WriteStringValue(SourceDraName); + writer.WritePropertyName("targetDraName"u8); + writer.WriteStringValue(TargetDraName); + writer.WritePropertyName("customLocationRegion"u8); + writer.WriteStringValue(CustomLocationRegion); + writer.WritePropertyName("instanceType"u8); + writer.WriteStringValue(InstanceType); + writer.WriteEndObject(); + } + + internal static HyperVToAzStackHciProtectedItemModelCustomProperties DeserializeHyperVToAzStackHciProtectedItemModelCustomProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional activeLocation = default; + ResourceIdentifier targetHciClusterId = default; + ResourceIdentifier targetArcClusterCustomLocationId = default; + Optional targetAzStackHciClusterName = default; + ResourceIdentifier fabricDiscoveryMachineId = default; + IList disksToInclude = default; + IList nicsToInclude = default; + Optional sourceVmName = default; + Optional sourceCpuCores = default; + Optional sourceMemoryInMegaBytes = default; + Optional targetVmName = default; + ResourceIdentifier targetResourceGroupId = default; + ResourceIdentifier storageContainerId = default; + string hyperVGeneration = default; + Optional targetNetworkId = default; + Optional testNetworkId = default; + Optional targetCpuCores = default; + Optional isDynamicRam = default; + Optional dynamicMemoryConfig = default; + Optional targetMemoryInMegaBytes = default; + string runAsAccountId = default; + string sourceDraName = default; + string targetDraName = default; + Optional sourceApplianceName = default; + Optional targetApplianceName = default; + Optional osType = default; + Optional osName = default; + Optional firmwareType = default; + Optional targetLocation = default; + string customLocationRegion = default; + Optional failoverRecoveryPointId = default; + Optional lastRecoveryPointReceived = default; + Optional lastRecoveryPointId = default; + Optional initialReplicationProgressPercentage = default; + Optional resyncProgressPercentage = default; + Optional> protectedDisks = default; + Optional> protectedNics = default; + Optional targetVmBiosId = default; + Optional lastReplicationUpdateTime = default; + string instanceType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("activeLocation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + activeLocation = new ProtectedItemActiveLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("targetHciClusterId"u8)) + { + targetHciClusterId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("targetArcClusterCustomLocationId"u8)) + { + targetArcClusterCustomLocationId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("targetAzStackHciClusterName"u8)) + { + targetAzStackHciClusterName = property.Value.GetString(); + continue; + } + if (property.NameEquals("fabricDiscoveryMachineId"u8)) + { + fabricDiscoveryMachineId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("disksToInclude"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(HyperVToAzStackHciDiskInput.DeserializeHyperVToAzStackHciDiskInput(item)); + } + disksToInclude = array; + continue; + } + if (property.NameEquals("nicsToInclude"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(HyperVToAzStackHciNicInput.DeserializeHyperVToAzStackHciNicInput(item)); + } + nicsToInclude = array; + continue; + } + if (property.NameEquals("sourceVmName"u8)) + { + sourceVmName = property.Value.GetString(); + continue; + } + if (property.NameEquals("sourceCpuCores"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sourceCpuCores = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("sourceMemoryInMegaBytes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sourceMemoryInMegaBytes = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("targetVmName"u8)) + { + targetVmName = property.Value.GetString(); + continue; + } + if (property.NameEquals("targetResourceGroupId"u8)) + { + targetResourceGroupId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("storageContainerId"u8)) + { + storageContainerId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("hyperVGeneration"u8)) + { + hyperVGeneration = property.Value.GetString(); + continue; + } + if (property.NameEquals("targetNetworkId"u8)) + { + targetNetworkId = property.Value.GetString(); + continue; + } + if (property.NameEquals("testNetworkId"u8)) + { + testNetworkId = property.Value.GetString(); + continue; + } + if (property.NameEquals("targetCpuCores"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + targetCpuCores = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("isDynamicRam"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isDynamicRam = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("dynamicMemoryConfig"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dynamicMemoryConfig = ProtectedItemDynamicMemoryConfig.DeserializeProtectedItemDynamicMemoryConfig(property.Value); + continue; + } + if (property.NameEquals("targetMemoryInMegaBytes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + targetMemoryInMegaBytes = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("runAsAccountId"u8)) + { + runAsAccountId = property.Value.GetString(); + continue; + } + if (property.NameEquals("sourceDraName"u8)) + { + sourceDraName = property.Value.GetString(); + continue; + } + if (property.NameEquals("targetDraName"u8)) + { + targetDraName = property.Value.GetString(); + continue; + } + if (property.NameEquals("sourceApplianceName"u8)) + { + sourceApplianceName = property.Value.GetString(); + continue; + } + if (property.NameEquals("targetApplianceName"u8)) + { + targetApplianceName = property.Value.GetString(); + continue; + } + if (property.NameEquals("osType"u8)) + { + osType = property.Value.GetString(); + continue; + } + if (property.NameEquals("osName"u8)) + { + osName = property.Value.GetString(); + continue; + } + if (property.NameEquals("firmwareType"u8)) + { + firmwareType = property.Value.GetString(); + continue; + } + if (property.NameEquals("targetLocation"u8)) + { + targetLocation = property.Value.GetString(); + continue; + } + if (property.NameEquals("customLocationRegion"u8)) + { + customLocationRegion = property.Value.GetString(); + continue; + } + if (property.NameEquals("failoverRecoveryPointId"u8)) + { + failoverRecoveryPointId = property.Value.GetString(); + continue; + } + if (property.NameEquals("lastRecoveryPointReceived"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastRecoveryPointReceived = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastRecoveryPointId"u8)) + { + lastRecoveryPointId = property.Value.GetString(); + continue; + } + if (property.NameEquals("initialReplicationProgressPercentage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + initialReplicationProgressPercentage = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("resyncProgressPercentage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resyncProgressPercentage = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("protectedDisks"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(HyperVToAzStackHciProtectedDiskProperties.DeserializeHyperVToAzStackHciProtectedDiskProperties(item)); + } + protectedDisks = array; + continue; + } + if (property.NameEquals("protectedNics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(HyperVToAzStackHciProtectedNicProperties.DeserializeHyperVToAzStackHciProtectedNicProperties(item)); + } + protectedNics = array; + continue; + } + if (property.NameEquals("targetVmBiosId"u8)) + { + targetVmBiosId = property.Value.GetString(); + continue; + } + if (property.NameEquals("lastReplicationUpdateTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastReplicationUpdateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("instanceType"u8)) + { + instanceType = property.Value.GetString(); + continue; + } + } + return new HyperVToAzStackHciProtectedItemModelCustomProperties(instanceType, Optional.ToNullable(activeLocation), targetHciClusterId, targetArcClusterCustomLocationId, targetAzStackHciClusterName.Value, fabricDiscoveryMachineId, disksToInclude, nicsToInclude, sourceVmName.Value, Optional.ToNullable(sourceCpuCores), Optional.ToNullable(sourceMemoryInMegaBytes), targetVmName.Value, targetResourceGroupId, storageContainerId, hyperVGeneration, targetNetworkId.Value, testNetworkId.Value, Optional.ToNullable(targetCpuCores), Optional.ToNullable(isDynamicRam), dynamicMemoryConfig.Value, Optional.ToNullable(targetMemoryInMegaBytes), runAsAccountId, sourceDraName, targetDraName, sourceApplianceName.Value, targetApplianceName.Value, osType.Value, osName.Value, firmwareType.Value, targetLocation.Value, customLocationRegion, failoverRecoveryPointId.Value, Optional.ToNullable(lastRecoveryPointReceived), lastRecoveryPointId.Value, Optional.ToNullable(initialReplicationProgressPercentage), Optional.ToNullable(resyncProgressPercentage), Optional.ToList(protectedDisks), Optional.ToList(protectedNics), targetVmBiosId.Value, Optional.ToNullable(lastReplicationUpdateTime)); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciProtectedItemModelCustomProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciProtectedItemModelCustomProperties.cs new file mode 100644 index 000000000000..2395ed308ebc --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciProtectedItemModelCustomProperties.cs @@ -0,0 +1,240 @@ +// 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.RecoveryServicesDataReplication.Models +{ + /// HyperV to AzStackHCI Protected item model custom properties. + public partial class HyperVToAzStackHciProtectedItemModelCustomProperties : ProtectedItemModelCustomProperties + { + /// Initializes a new instance of HyperVToAzStackHciProtectedItemModelCustomProperties. + /// Gets or sets the Target HCI Cluster ARM Id. + /// Gets or sets the Target Arc Cluster Custom Location ARM Id. + /// Gets or sets the ARM Id of the discovered machine. + /// Gets or sets the list of disks to replicate. + /// Gets or sets the list of VM NIC to replicate. + /// Gets or sets the target resource group ARM Id. + /// Gets or sets the target storage container ARM Id. + /// Gets or sets the hypervisor generation of the virtual machine. + /// Gets or sets the Run As account Id. + /// Gets or sets the source DRA name. + /// Gets or sets the target DRA name. + /// Gets or sets the location of Azure Arc HCI custom location resource. + /// , , , , , , , , , , or is null. + public HyperVToAzStackHciProtectedItemModelCustomProperties(ResourceIdentifier targetHciClusterId, ResourceIdentifier targetArcClusterCustomLocationId, ResourceIdentifier fabricDiscoveryMachineId, IEnumerable disksToInclude, IEnumerable nicsToInclude, ResourceIdentifier targetResourceGroupId, ResourceIdentifier storageContainerId, string hyperVGeneration, string runAsAccountId, string sourceDraName, string targetDraName, string customLocationRegion) + { + Argument.AssertNotNull(targetHciClusterId, nameof(targetHciClusterId)); + Argument.AssertNotNull(targetArcClusterCustomLocationId, nameof(targetArcClusterCustomLocationId)); + Argument.AssertNotNull(fabricDiscoveryMachineId, nameof(fabricDiscoveryMachineId)); + Argument.AssertNotNull(disksToInclude, nameof(disksToInclude)); + Argument.AssertNotNull(nicsToInclude, nameof(nicsToInclude)); + Argument.AssertNotNull(targetResourceGroupId, nameof(targetResourceGroupId)); + Argument.AssertNotNull(storageContainerId, nameof(storageContainerId)); + Argument.AssertNotNull(hyperVGeneration, nameof(hyperVGeneration)); + Argument.AssertNotNull(runAsAccountId, nameof(runAsAccountId)); + Argument.AssertNotNull(sourceDraName, nameof(sourceDraName)); + Argument.AssertNotNull(targetDraName, nameof(targetDraName)); + Argument.AssertNotNull(customLocationRegion, nameof(customLocationRegion)); + + TargetHciClusterId = targetHciClusterId; + TargetArcClusterCustomLocationId = targetArcClusterCustomLocationId; + FabricDiscoveryMachineId = fabricDiscoveryMachineId; + DisksToInclude = disksToInclude.ToList(); + NicsToInclude = nicsToInclude.ToList(); + TargetResourceGroupId = targetResourceGroupId; + StorageContainerId = storageContainerId; + HyperVGeneration = hyperVGeneration; + RunAsAccountId = runAsAccountId; + SourceDraName = sourceDraName; + TargetDraName = targetDraName; + CustomLocationRegion = customLocationRegion; + ProtectedDisks = new ChangeTrackingList(); + ProtectedNics = new ChangeTrackingList(); + InstanceType = "HyperVToAzStackHCI"; + } + + /// Initializes a new instance of HyperVToAzStackHciProtectedItemModelCustomProperties. + /// Gets or sets the instance type. + /// Gets or sets the location of the protected item. + /// Gets or sets the Target HCI Cluster ARM Id. + /// Gets or sets the Target Arc Cluster Custom Location ARM Id. + /// Gets or sets the Target AzStackHCI cluster name. + /// Gets or sets the ARM Id of the discovered machine. + /// Gets or sets the list of disks to replicate. + /// Gets or sets the list of VM NIC to replicate. + /// Gets or sets the source VM display name. + /// Gets or sets the source VM CPU cores. + /// Gets or sets the source VM ram memory size in megabytes. + /// Gets or sets the target VM display name. + /// Gets or sets the target resource group ARM Id. + /// Gets or sets the target storage container ARM Id. + /// Gets or sets the hypervisor generation of the virtual machine. + /// Gets or sets the target network Id within AzStackHCI Cluster. + /// Gets or sets the target test network Id within AzStackHCI Cluster. + /// Gets or sets the target CPU cores. + /// Gets or sets a value indicating whether memory is dynamical. + /// Protected item dynamic memory config. + /// Gets or sets the target memory in mega-bytes. + /// Gets or sets the Run As account Id. + /// Gets or sets the source DRA name. + /// Gets or sets the target DRA name. + /// Gets or sets the source appliance name. + /// Gets or sets the target appliance name. + /// Gets or sets the type of the OS. + /// Gets or sets the name of the OS. + /// Gets or sets the firmware type. + /// Gets or sets the target location. + /// Gets or sets the location of Azure Arc HCI custom location resource. + /// Gets or sets the recovery point Id to which the VM was failed over. + /// Gets or sets the last recovery point received time. + /// Gets or sets the last recovery point Id. + /// + /// Gets or sets the initial replication progress percentage. This is calculated based on + /// total bytes processed for all disks in the source VM. + /// + /// + /// Gets or sets the resync progress percentage. This is calculated based on total bytes + /// processed for all disks in the source VM. + /// + /// Gets or sets the list of protected disks. + /// Gets or sets the VM NIC details. + /// Gets or sets the BIOS Id of the target AzStackHCI VM. + /// Gets or sets the latest timestamp that replication status is updated. + internal HyperVToAzStackHciProtectedItemModelCustomProperties(string instanceType, ProtectedItemActiveLocation? activeLocation, ResourceIdentifier targetHciClusterId, ResourceIdentifier targetArcClusterCustomLocationId, string targetAzStackHciClusterName, ResourceIdentifier fabricDiscoveryMachineId, IList disksToInclude, IList nicsToInclude, string sourceVmName, int? sourceCpuCores, double? sourceMemoryInMegaBytes, string targetVmName, ResourceIdentifier targetResourceGroupId, ResourceIdentifier storageContainerId, string hyperVGeneration, string targetNetworkId, string testNetworkId, int? targetCpuCores, bool? isDynamicRam, ProtectedItemDynamicMemoryConfig dynamicMemoryConfig, int? targetMemoryInMegaBytes, string runAsAccountId, string sourceDraName, string targetDraName, string sourceApplianceName, string targetApplianceName, string osType, string osName, string firmwareType, string targetLocation, string customLocationRegion, string failoverRecoveryPointId, DateTimeOffset? lastRecoveryPointReceived, string lastRecoveryPointId, int? initialReplicationProgressPercentage, int? resyncProgressPercentage, IReadOnlyList protectedDisks, IReadOnlyList protectedNics, string targetVmBiosId, DateTimeOffset? lastReplicationUpdateOn) : base(instanceType) + { + ActiveLocation = activeLocation; + TargetHciClusterId = targetHciClusterId; + TargetArcClusterCustomLocationId = targetArcClusterCustomLocationId; + TargetAzStackHciClusterName = targetAzStackHciClusterName; + FabricDiscoveryMachineId = fabricDiscoveryMachineId; + DisksToInclude = disksToInclude; + NicsToInclude = nicsToInclude; + SourceVmName = sourceVmName; + SourceCpuCores = sourceCpuCores; + SourceMemoryInMegaBytes = sourceMemoryInMegaBytes; + TargetVmName = targetVmName; + TargetResourceGroupId = targetResourceGroupId; + StorageContainerId = storageContainerId; + HyperVGeneration = hyperVGeneration; + TargetNetworkId = targetNetworkId; + TestNetworkId = testNetworkId; + TargetCpuCores = targetCpuCores; + IsDynamicRam = isDynamicRam; + DynamicMemoryConfig = dynamicMemoryConfig; + TargetMemoryInMegaBytes = targetMemoryInMegaBytes; + RunAsAccountId = runAsAccountId; + SourceDraName = sourceDraName; + TargetDraName = targetDraName; + SourceApplianceName = sourceApplianceName; + TargetApplianceName = targetApplianceName; + OSType = osType; + OSName = osName; + FirmwareType = firmwareType; + TargetLocation = targetLocation; + CustomLocationRegion = customLocationRegion; + FailoverRecoveryPointId = failoverRecoveryPointId; + LastRecoveryPointReceived = lastRecoveryPointReceived; + LastRecoveryPointId = lastRecoveryPointId; + InitialReplicationProgressPercentage = initialReplicationProgressPercentage; + ResyncProgressPercentage = resyncProgressPercentage; + ProtectedDisks = protectedDisks; + ProtectedNics = protectedNics; + TargetVmBiosId = targetVmBiosId; + LastReplicationUpdateOn = lastReplicationUpdateOn; + InstanceType = instanceType ?? "HyperVToAzStackHCI"; + } + + /// Gets or sets the location of the protected item. + public ProtectedItemActiveLocation? ActiveLocation { get; } + /// Gets or sets the Target HCI Cluster ARM Id. + public ResourceIdentifier TargetHciClusterId { get; set; } + /// Gets or sets the Target Arc Cluster Custom Location ARM Id. + public ResourceIdentifier TargetArcClusterCustomLocationId { get; set; } + /// Gets or sets the Target AzStackHCI cluster name. + public string TargetAzStackHciClusterName { get; } + /// Gets or sets the ARM Id of the discovered machine. + public ResourceIdentifier FabricDiscoveryMachineId { get; set; } + /// Gets or sets the list of disks to replicate. + public IList DisksToInclude { get; } + /// Gets or sets the list of VM NIC to replicate. + public IList NicsToInclude { get; } + /// Gets or sets the source VM display name. + public string SourceVmName { get; } + /// Gets or sets the source VM CPU cores. + public int? SourceCpuCores { get; } + /// Gets or sets the source VM ram memory size in megabytes. + public double? SourceMemoryInMegaBytes { get; } + /// Gets or sets the target VM display name. + public string TargetVmName { get; set; } + /// Gets or sets the target resource group ARM Id. + public ResourceIdentifier TargetResourceGroupId { get; set; } + /// Gets or sets the target storage container ARM Id. + public ResourceIdentifier StorageContainerId { get; set; } + /// Gets or sets the hypervisor generation of the virtual machine. + public string HyperVGeneration { get; set; } + /// Gets or sets the target network Id within AzStackHCI Cluster. + public string TargetNetworkId { get; set; } + /// Gets or sets the target test network Id within AzStackHCI Cluster. + public string TestNetworkId { get; set; } + /// Gets or sets the target CPU cores. + public int? TargetCpuCores { get; set; } + /// Gets or sets a value indicating whether memory is dynamical. + public bool? IsDynamicRam { get; set; } + /// Protected item dynamic memory config. + public ProtectedItemDynamicMemoryConfig DynamicMemoryConfig { get; set; } + /// Gets or sets the target memory in mega-bytes. + public int? TargetMemoryInMegaBytes { get; set; } + /// Gets or sets the Run As account Id. + public string RunAsAccountId { get; set; } + /// Gets or sets the source DRA name. + public string SourceDraName { get; set; } + /// Gets or sets the target DRA name. + public string TargetDraName { get; set; } + /// Gets or sets the source appliance name. + public string SourceApplianceName { get; } + /// Gets or sets the target appliance name. + public string TargetApplianceName { get; } + /// Gets or sets the type of the OS. + public string OSType { get; } + /// Gets or sets the name of the OS. + public string OSName { get; } + /// Gets or sets the firmware type. + public string FirmwareType { get; } + /// Gets or sets the target location. + public string TargetLocation { get; } + /// Gets or sets the location of Azure Arc HCI custom location resource. + public string CustomLocationRegion { get; set; } + /// Gets or sets the recovery point Id to which the VM was failed over. + public string FailoverRecoveryPointId { get; } + /// Gets or sets the last recovery point received time. + public DateTimeOffset? LastRecoveryPointReceived { get; } + /// Gets or sets the last recovery point Id. + public string LastRecoveryPointId { get; } + /// + /// Gets or sets the initial replication progress percentage. This is calculated based on + /// total bytes processed for all disks in the source VM. + /// + public int? InitialReplicationProgressPercentage { get; } + /// + /// Gets or sets the resync progress percentage. This is calculated based on total bytes + /// processed for all disks in the source VM. + /// + public int? ResyncProgressPercentage { get; } + /// Gets or sets the list of protected disks. + public IReadOnlyList ProtectedDisks { get; } + /// Gets or sets the VM NIC details. + public IReadOnlyList ProtectedNics { get; } + /// Gets or sets the BIOS Id of the target AzStackHCI VM. + public string TargetVmBiosId { get; } + /// Gets or sets the latest timestamp that replication status is updated. + public DateTimeOffset? LastReplicationUpdateOn { get; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciProtectedNicProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciProtectedNicProperties.Serialization.cs new file mode 100644 index 000000000000..ad46daa9fcf9 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciProtectedNicProperties.Serialization.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + public partial class HyperVToAzStackHciProtectedNicProperties + { + internal static HyperVToAzStackHciProtectedNicProperties DeserializeHyperVToAzStackHciProtectedNicProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional nicId = default; + Optional macAddress = default; + Optional networkName = default; + Optional targetNetworkId = default; + Optional testNetworkId = default; + Optional selectionTypeForFailover = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("nicId"u8)) + { + nicId = property.Value.GetString(); + continue; + } + if (property.NameEquals("macAddress"u8)) + { + macAddress = property.Value.GetString(); + continue; + } + if (property.NameEquals("networkName"u8)) + { + networkName = property.Value.GetString(); + continue; + } + if (property.NameEquals("targetNetworkId"u8)) + { + targetNetworkId = property.Value.GetString(); + continue; + } + if (property.NameEquals("testNetworkId"u8)) + { + testNetworkId = property.Value.GetString(); + continue; + } + if (property.NameEquals("selectionTypeForFailover"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + selectionTypeForFailover = new VmNicSelection(property.Value.GetString()); + continue; + } + } + return new HyperVToAzStackHciProtectedNicProperties(nicId.Value, macAddress.Value, networkName.Value, targetNetworkId.Value, testNetworkId.Value, Optional.ToNullable(selectionTypeForFailover)); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciProtectedNicProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciProtectedNicProperties.cs new file mode 100644 index 000000000000..c619accdd2a3 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciProtectedNicProperties.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// HyperVToAzStackHCI NIC properties. + public partial class HyperVToAzStackHciProtectedNicProperties + { + /// Initializes a new instance of HyperVToAzStackHciProtectedNicProperties. + internal HyperVToAzStackHciProtectedNicProperties() + { + } + + /// Initializes a new instance of HyperVToAzStackHciProtectedNicProperties. + /// Gets or sets the NIC Id. + /// Gets or sets the NIC mac address. + /// Gets or sets the network name. + /// Gets or sets the target network Id within AzStackHCI Cluster. + /// Gets or sets the target test network Id within AzStackHCI Cluster. + /// Gets or sets the selection type of the NIC. + internal HyperVToAzStackHciProtectedNicProperties(string nicId, string macAddress, string networkName, string targetNetworkId, string testNetworkId, VmNicSelection? selectionTypeForFailover) + { + NicId = nicId; + MacAddress = macAddress; + NetworkName = networkName; + TargetNetworkId = targetNetworkId; + TestNetworkId = testNetworkId; + SelectionTypeForFailover = selectionTypeForFailover; + } + + /// Gets or sets the NIC Id. + public string NicId { get; } + /// Gets or sets the NIC mac address. + public string MacAddress { get; } + /// Gets or sets the network name. + public string NetworkName { get; } + /// Gets or sets the target network Id within AzStackHCI Cluster. + public string TargetNetworkId { get; } + /// Gets or sets the target test network Id within AzStackHCI Cluster. + public string TestNetworkId { get; } + /// Gets or sets the selection type of the NIC. + public VmNicSelection? SelectionTypeForFailover { get; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciRecoveryPointModelCustomProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciRecoveryPointModelCustomProperties.Serialization.cs new file mode 100644 index 000000000000..ec9fe5db6f4e --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciRecoveryPointModelCustomProperties.Serialization.cs @@ -0,0 +1,49 @@ +// 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.RecoveryServicesDataReplication.Models +{ + public partial class HyperVToAzStackHciRecoveryPointModelCustomProperties + { + internal static HyperVToAzStackHciRecoveryPointModelCustomProperties DeserializeHyperVToAzStackHciRecoveryPointModelCustomProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> diskIds = default; + string instanceType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("diskIds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + diskIds = array; + continue; + } + if (property.NameEquals("instanceType"u8)) + { + instanceType = property.Value.GetString(); + continue; + } + } + return new HyperVToAzStackHciRecoveryPointModelCustomProperties(instanceType, Optional.ToList(diskIds)); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciRecoveryPointModelCustomProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciRecoveryPointModelCustomProperties.cs new file mode 100644 index 000000000000..f1503ee7017c --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciRecoveryPointModelCustomProperties.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// HyperV to AzStackHCI recovery point model custom properties. + public partial class HyperVToAzStackHciRecoveryPointModelCustomProperties : RecoveryPointModelCustomProperties + { + /// Initializes a new instance of HyperVToAzStackHciRecoveryPointModelCustomProperties. + internal HyperVToAzStackHciRecoveryPointModelCustomProperties() + { + DiskIds = new ChangeTrackingList(); + InstanceType = "HyperVToAzStackHCI"; + } + + /// Initializes a new instance of HyperVToAzStackHciRecoveryPointModelCustomProperties. + /// Gets or sets the instance type. + /// Gets or sets the list of the disk Ids. + internal HyperVToAzStackHciRecoveryPointModelCustomProperties(string instanceType, IReadOnlyList diskIds) : base(instanceType) + { + DiskIds = diskIds; + InstanceType = instanceType ?? "HyperVToAzStackHCI"; + } + + /// Gets or sets the list of the disk Ids. + public IReadOnlyList DiskIds { get; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciReplicationExtensionModelCustomProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciReplicationExtensionModelCustomProperties.Serialization.cs new file mode 100644 index 000000000000..d3908b8c21cc --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciReplicationExtensionModelCustomProperties.Serialization.cs @@ -0,0 +1,172 @@ +// 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.RecoveryServicesDataReplication.Models +{ + public partial class HyperVToAzStackHciReplicationExtensionModelCustomProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("hyperVFabricArmId"u8); + writer.WriteStringValue(HyperVFabricArmId); + writer.WritePropertyName("azStackHciFabricArmId"u8); + writer.WriteStringValue(AzStackHciFabricArmId); + if (Optional.IsDefined(StorageAccountId)) + { + writer.WritePropertyName("storageAccountId"u8); + writer.WriteStringValue(StorageAccountId); + } + if (Optional.IsDefined(StorageAccountSasSecretName)) + { + writer.WritePropertyName("storageAccountSasSecretName"u8); + writer.WriteStringValue(StorageAccountSasSecretName); + } + writer.WritePropertyName("instanceType"u8); + writer.WriteStringValue(InstanceType); + writer.WriteEndObject(); + } + + internal static HyperVToAzStackHciReplicationExtensionModelCustomProperties DeserializeHyperVToAzStackHciReplicationExtensionModelCustomProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier hyperVFabricArmId = default; + Optional hyperVSiteId = default; + ResourceIdentifier azStackHciFabricArmId = default; + Optional azStackHciSiteId = default; + Optional storageAccountId = default; + Optional storageAccountSasSecretName = default; + Optional asrServiceUri = default; + Optional rcmServiceUri = default; + Optional gatewayServiceUri = default; + Optional sourceGatewayServiceId = default; + Optional targetGatewayServiceId = default; + Optional sourceStorageContainerName = default; + Optional targetStorageContainerName = default; + Optional resourceLocation = default; + Optional subscriptionId = default; + Optional resourceGroup = default; + string instanceType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("hyperVFabricArmId"u8)) + { + hyperVFabricArmId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("hyperVSiteId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + hyperVSiteId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("azStackHciFabricArmId"u8)) + { + azStackHciFabricArmId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("azStackHciSiteId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + azStackHciSiteId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("storageAccountId"u8)) + { + storageAccountId = property.Value.GetString(); + continue; + } + if (property.NameEquals("storageAccountSasSecretName"u8)) + { + storageAccountSasSecretName = property.Value.GetString(); + continue; + } + if (property.NameEquals("asrServiceUri"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + asrServiceUri = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("rcmServiceUri"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + rcmServiceUri = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("gatewayServiceUri"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + gatewayServiceUri = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("sourceGatewayServiceId"u8)) + { + sourceGatewayServiceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("targetGatewayServiceId"u8)) + { + targetGatewayServiceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("sourceStorageContainerName"u8)) + { + sourceStorageContainerName = property.Value.GetString(); + continue; + } + if (property.NameEquals("targetStorageContainerName"u8)) + { + targetStorageContainerName = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceLocation"u8)) + { + resourceLocation = property.Value.GetString(); + continue; + } + if (property.NameEquals("subscriptionId"u8)) + { + subscriptionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceGroup"u8)) + { + resourceGroup = property.Value.GetString(); + continue; + } + if (property.NameEquals("instanceType"u8)) + { + instanceType = property.Value.GetString(); + continue; + } + } + return new HyperVToAzStackHciReplicationExtensionModelCustomProperties(instanceType, hyperVFabricArmId, hyperVSiteId.Value, azStackHciFabricArmId, azStackHciSiteId.Value, storageAccountId.Value, storageAccountSasSecretName.Value, asrServiceUri.Value, rcmServiceUri.Value, gatewayServiceUri.Value, sourceGatewayServiceId.Value, targetGatewayServiceId.Value, sourceStorageContainerName.Value, targetStorageContainerName.Value, resourceLocation.Value, subscriptionId.Value, resourceGroup.Value); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciReplicationExtensionModelCustomProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciReplicationExtensionModelCustomProperties.cs new file mode 100644 index 000000000000..adee194e75a7 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/HyperVToAzStackHciReplicationExtensionModelCustomProperties.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// HyperV to AzStackHCI Replication extension model custom properties. + public partial class HyperVToAzStackHciReplicationExtensionModelCustomProperties : ReplicationExtensionModelCustomProperties + { + /// Initializes a new instance of HyperVToAzStackHciReplicationExtensionModelCustomProperties. + /// Gets or sets the ARM Id of the source HyperV fabric. + /// Gets or sets the ARM Id of the target AzStackHCI fabric. + /// or is null. + public HyperVToAzStackHciReplicationExtensionModelCustomProperties(ResourceIdentifier hyperVFabricArmId, ResourceIdentifier azStackHciFabricArmId) + { + Argument.AssertNotNull(hyperVFabricArmId, nameof(hyperVFabricArmId)); + Argument.AssertNotNull(azStackHciFabricArmId, nameof(azStackHciFabricArmId)); + + HyperVFabricArmId = hyperVFabricArmId; + AzStackHciFabricArmId = azStackHciFabricArmId; + InstanceType = "HyperVToAzStackHCI"; + } + + /// Initializes a new instance of HyperVToAzStackHciReplicationExtensionModelCustomProperties. + /// Gets or sets the instance type. + /// Gets or sets the ARM Id of the source HyperV fabric. + /// Gets or sets the ARM Id of the HyperV site. + /// Gets or sets the ARM Id of the target AzStackHCI fabric. + /// Gets or sets the ARM Id of the AzStackHCI site. + /// Gets or sets the storage account Id. + /// Gets or sets the Sas Secret of storage account. + /// Gets or sets the Uri of ASR. + /// Gets or sets the Uri of Rcm. + /// Gets or sets the Uri of Gateway. + /// Gets or sets the gateway service Id of source. + /// Gets or sets the gateway service Id of target. + /// Gets or sets the source storage container name. + /// Gets or sets the target storage container name. + /// Gets or sets the resource location. + /// Gets or sets the subscription. + /// Gets or sets the resource group. + internal HyperVToAzStackHciReplicationExtensionModelCustomProperties(string instanceType, ResourceIdentifier hyperVFabricArmId, ResourceIdentifier hyperVSiteId, ResourceIdentifier azStackHciFabricArmId, ResourceIdentifier azStackHciSiteId, string storageAccountId, string storageAccountSasSecretName, Uri asrServiceUri, Uri rcmServiceUri, Uri gatewayServiceUri, string sourceGatewayServiceId, string targetGatewayServiceId, string sourceStorageContainerName, string targetStorageContainerName, string resourceLocation, string subscriptionId, string resourceGroup) : base(instanceType) + { + HyperVFabricArmId = hyperVFabricArmId; + HyperVSiteId = hyperVSiteId; + AzStackHciFabricArmId = azStackHciFabricArmId; + AzStackHciSiteId = azStackHciSiteId; + StorageAccountId = storageAccountId; + StorageAccountSasSecretName = storageAccountSasSecretName; + AsrServiceUri = asrServiceUri; + RcmServiceUri = rcmServiceUri; + GatewayServiceUri = gatewayServiceUri; + SourceGatewayServiceId = sourceGatewayServiceId; + TargetGatewayServiceId = targetGatewayServiceId; + SourceStorageContainerName = sourceStorageContainerName; + TargetStorageContainerName = targetStorageContainerName; + ResourceLocation = resourceLocation; + SubscriptionId = subscriptionId; + ResourceGroup = resourceGroup; + InstanceType = instanceType ?? "HyperVToAzStackHCI"; + } + + /// Gets or sets the ARM Id of the source HyperV fabric. + public ResourceIdentifier HyperVFabricArmId { get; set; } + /// Gets or sets the ARM Id of the HyperV site. + public ResourceIdentifier HyperVSiteId { get; } + /// Gets or sets the ARM Id of the target AzStackHCI fabric. + public ResourceIdentifier AzStackHciFabricArmId { get; set; } + /// Gets or sets the ARM Id of the AzStackHCI site. + public ResourceIdentifier AzStackHciSiteId { get; } + /// Gets or sets the storage account Id. + public string StorageAccountId { get; set; } + /// Gets or sets the Sas Secret of storage account. + public string StorageAccountSasSecretName { get; set; } + /// Gets or sets the Uri of ASR. + public Uri AsrServiceUri { get; } + /// Gets or sets the Uri of Rcm. + public Uri RcmServiceUri { get; } + /// Gets or sets the Uri of Gateway. + public Uri GatewayServiceUri { get; } + /// Gets or sets the gateway service Id of source. + public string SourceGatewayServiceId { get; } + /// Gets or sets the gateway service Id of target. + public string TargetGatewayServiceId { get; } + /// Gets or sets the source storage container name. + public string SourceStorageContainerName { get; } + /// Gets or sets the target storage container name. + public string TargetStorageContainerName { get; } + /// Gets or sets the resource location. + public string ResourceLocation { get; } + /// Gets or sets the subscription. + public string SubscriptionId { get; } + /// Gets or sets the resource group. + public string ResourceGroup { get; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/PlannedFailoverModel.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/PlannedFailoverModel.Serialization.cs new file mode 100644 index 000000000000..a1247727657b --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/PlannedFailoverModel.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.RecoveryServicesDataReplication.Models +{ + public partial class PlannedFailoverModel : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + writer.WriteEndObject(); + } + + internal static PlannedFailoverModel DeserializePlannedFailoverModel(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + PlannedFailoverModelProperties properties = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + properties = PlannedFailoverModelProperties.DeserializePlannedFailoverModelProperties(property.Value); + continue; + } + } + return new PlannedFailoverModel(properties); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/PlannedFailoverModel.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/PlannedFailoverModel.cs new file mode 100644 index 000000000000..9745333ca9ea --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/PlannedFailoverModel.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// Planned failover model. + public partial class PlannedFailoverModel + { + /// Initializes a new instance of PlannedFailoverModel. + /// Planned failover model properties. + /// is null. + public PlannedFailoverModel(PlannedFailoverModelProperties properties) + { + Argument.AssertNotNull(properties, nameof(properties)); + + Properties = properties; + } + + /// Planned failover model properties. + internal PlannedFailoverModelProperties Properties { get; set; } + /// + /// Planned failover model custom properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + public PlannedFailoverModelCustomProperties PlannedFailoverModelCustomProperties + { + get => Properties is null ? default : Properties.CustomProperties; + set => Properties = new PlannedFailoverModelProperties(value); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/PlannedFailoverModelCustomProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/PlannedFailoverModelCustomProperties.Serialization.cs new file mode 100644 index 000000000000..6dc5d8d7e1ce --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/PlannedFailoverModelCustomProperties.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.RecoveryServicesDataReplication.Models +{ + public partial class PlannedFailoverModelCustomProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("instanceType"u8); + writer.WriteStringValue(InstanceType); + writer.WriteEndObject(); + } + + internal static PlannedFailoverModelCustomProperties DeserializePlannedFailoverModelCustomProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("instanceType", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "HyperVToAzStackHCI": return HyperVToAzStackHciPlannedFailoverModelCustomProperties.DeserializeHyperVToAzStackHciPlannedFailoverModelCustomProperties(element); + case "PlannedFailoverModelCustomProperties": return GeneralPlannedFailoverModelCustomProperties.DeserializeGeneralPlannedFailoverModelCustomProperties(element); + case "VMwareToAzStackHCI": return VMwareToAzStackHciPlannedFailoverModelCustomProperties.DeserializeVMwareToAzStackHciPlannedFailoverModelCustomProperties(element); + } + } + return UnknownPlannedFailoverModelCustomProperties.DeserializeUnknownPlannedFailoverModelCustomProperties(element); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/PlannedFailoverModelCustomProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/PlannedFailoverModelCustomProperties.cs new file mode 100644 index 000000000000..5ebaa57b08d3 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/PlannedFailoverModelCustomProperties.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// + /// Planned failover model custom properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + public abstract partial class PlannedFailoverModelCustomProperties + { + /// Initializes a new instance of PlannedFailoverModelCustomProperties. + protected PlannedFailoverModelCustomProperties() + { + } + + /// Initializes a new instance of PlannedFailoverModelCustomProperties. + /// Gets or sets the instance type. + internal PlannedFailoverModelCustomProperties(string instanceType) + { + InstanceType = instanceType; + } + + /// Gets or sets the instance type. + internal string InstanceType { get; set; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/PlannedFailoverModelProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/PlannedFailoverModelProperties.Serialization.cs new file mode 100644 index 000000000000..3b9a380f7bda --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/PlannedFailoverModelProperties.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.RecoveryServicesDataReplication.Models +{ + public partial class PlannedFailoverModelProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("customProperties"u8); + writer.WriteObjectValue(CustomProperties); + writer.WriteEndObject(); + } + + internal static PlannedFailoverModelProperties DeserializePlannedFailoverModelProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + PlannedFailoverModelCustomProperties customProperties = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("customProperties"u8)) + { + customProperties = PlannedFailoverModelCustomProperties.DeserializePlannedFailoverModelCustomProperties(property.Value); + continue; + } + } + return new PlannedFailoverModelProperties(customProperties); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/PlannedFailoverModelProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/PlannedFailoverModelProperties.cs new file mode 100644 index 000000000000..169a08ff4e7c --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/PlannedFailoverModelProperties.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.RecoveryServicesDataReplication.Models +{ + /// Planned failover model properties. + public partial class PlannedFailoverModelProperties + { + /// Initializes a new instance of PlannedFailoverModelProperties. + /// + /// Planned failover model custom properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + /// is null. + public PlannedFailoverModelProperties(PlannedFailoverModelCustomProperties customProperties) + { + Argument.AssertNotNull(customProperties, nameof(customProperties)); + + CustomProperties = customProperties; + } + + /// + /// Planned failover model custom properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + public PlannedFailoverModelCustomProperties CustomProperties { get; set; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/PolicyModelCustomProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/PolicyModelCustomProperties.Serialization.cs new file mode 100644 index 000000000000..5299cfed8efa --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/PolicyModelCustomProperties.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.RecoveryServicesDataReplication.Models +{ + public partial class PolicyModelCustomProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("instanceType"u8); + writer.WriteStringValue(InstanceType); + writer.WriteEndObject(); + } + + internal static PolicyModelCustomProperties DeserializePolicyModelCustomProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("instanceType", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "HyperVToAzStackHCI": return HyperVToAzStackHciPolicyModelCustomProperties.DeserializeHyperVToAzStackHciPolicyModelCustomProperties(element); + case "PolicyModelCustomProperties": return GeneralPolicyModelCustomProperties.DeserializeGeneralPolicyModelCustomProperties(element); + case "VMwareToAzStackHCI": return VMwareToAzStackHciPolicyModelCustomProperties.DeserializeVMwareToAzStackHciPolicyModelCustomProperties(element); + } + } + return UnknownPolicyModelCustomProperties.DeserializeUnknownPolicyModelCustomProperties(element); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/PolicyModelCustomProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/PolicyModelCustomProperties.cs new file mode 100644 index 000000000000..e9d29395008c --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/PolicyModelCustomProperties.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// + /// Policy model custom properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + public abstract partial class PolicyModelCustomProperties + { + /// Initializes a new instance of PolicyModelCustomProperties. + protected PolicyModelCustomProperties() + { + } + + /// Initializes a new instance of PolicyModelCustomProperties. + /// Gets or sets the instance type. + internal PolicyModelCustomProperties(string instanceType) + { + InstanceType = instanceType; + } + + /// Gets or sets the instance type. + internal string InstanceType { get; set; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/ProtectedItemActiveLocation.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/ProtectedItemActiveLocation.cs new file mode 100644 index 000000000000..ff982330d1ff --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/ProtectedItemActiveLocation.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.RecoveryServicesDataReplication.Models +{ + /// Gets or sets the location of the protected item. + public readonly partial struct ProtectedItemActiveLocation : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ProtectedItemActiveLocation(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PrimaryValue = "Primary"; + private const string RecoveryValue = "Recovery"; + + /// Primary. + public static ProtectedItemActiveLocation Primary { get; } = new ProtectedItemActiveLocation(PrimaryValue); + /// Recovery. + public static ProtectedItemActiveLocation Recovery { get; } = new ProtectedItemActiveLocation(RecoveryValue); + /// Determines if two values are the same. + public static bool operator ==(ProtectedItemActiveLocation left, ProtectedItemActiveLocation right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ProtectedItemActiveLocation left, ProtectedItemActiveLocation right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ProtectedItemActiveLocation(string value) => new ProtectedItemActiveLocation(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ProtectedItemActiveLocation other && Equals(other); + /// + public bool Equals(ProtectedItemActiveLocation 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/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/ProtectedItemDynamicMemoryConfig.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/ProtectedItemDynamicMemoryConfig.Serialization.cs new file mode 100644 index 000000000000..d0a4de91440b --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/ProtectedItemDynamicMemoryConfig.Serialization.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + public partial class ProtectedItemDynamicMemoryConfig : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("maximumMemoryInMegaBytes"u8); + writer.WriteNumberValue(MaximumMemoryInMegaBytes); + writer.WritePropertyName("minimumMemoryInMegaBytes"u8); + writer.WriteNumberValue(MinimumMemoryInMegaBytes); + writer.WritePropertyName("targetMemoryBufferPercentage"u8); + writer.WriteNumberValue(TargetMemoryBufferPercentage); + writer.WriteEndObject(); + } + + internal static ProtectedItemDynamicMemoryConfig DeserializeProtectedItemDynamicMemoryConfig(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + long maximumMemoryInMegaBytes = default; + long minimumMemoryInMegaBytes = default; + int targetMemoryBufferPercentage = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("maximumMemoryInMegaBytes"u8)) + { + maximumMemoryInMegaBytes = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("minimumMemoryInMegaBytes"u8)) + { + minimumMemoryInMegaBytes = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("targetMemoryBufferPercentage"u8)) + { + targetMemoryBufferPercentage = property.Value.GetInt32(); + continue; + } + } + return new ProtectedItemDynamicMemoryConfig(maximumMemoryInMegaBytes, minimumMemoryInMegaBytes, targetMemoryBufferPercentage); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/ProtectedItemDynamicMemoryConfig.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/ProtectedItemDynamicMemoryConfig.cs new file mode 100644 index 000000000000..cac837522c0e --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/ProtectedItemDynamicMemoryConfig.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// Protected item dynamic memory config. + public partial class ProtectedItemDynamicMemoryConfig + { + /// Initializes a new instance of ProtectedItemDynamicMemoryConfig. + /// Gets or sets maximum memory in MB. + /// Gets or sets minimum memory in MB. + /// Gets or sets target memory buffer in %. + public ProtectedItemDynamicMemoryConfig(long maximumMemoryInMegaBytes, long minimumMemoryInMegaBytes, int targetMemoryBufferPercentage) + { + MaximumMemoryInMegaBytes = maximumMemoryInMegaBytes; + MinimumMemoryInMegaBytes = minimumMemoryInMegaBytes; + TargetMemoryBufferPercentage = targetMemoryBufferPercentage; + } + + /// Gets or sets maximum memory in MB. + public long MaximumMemoryInMegaBytes { get; set; } + /// Gets or sets minimum memory in MB. + public long MinimumMemoryInMegaBytes { get; set; } + /// Gets or sets target memory buffer in %. + public int TargetMemoryBufferPercentage { get; set; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/ProtectedItemJobProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/ProtectedItemJobProperties.Serialization.cs new file mode 100644 index 000000000000..d58913187aba --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/ProtectedItemJobProperties.Serialization.cs @@ -0,0 +1,78 @@ +// 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.RecoveryServicesDataReplication.Models +{ + public partial class ProtectedItemJobProperties + { + internal static ProtectedItemJobProperties DeserializeProtectedItemJobProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional scenarioName = default; + Optional id = default; + Optional name = default; + Optional displayName = default; + Optional state = default; + Optional startTime = default; + Optional endTime = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("scenarioName"u8)) + { + scenarioName = property.Value.GetString(); + continue; + } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("state"u8)) + { + state = property.Value.GetString(); + continue; + } + if (property.NameEquals("startTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + startTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("endTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endTime = property.Value.GetDateTimeOffset("O"); + continue; + } + } + return new ProtectedItemJobProperties(scenarioName.Value, id.Value, name.Value, displayName.Value, state.Value, Optional.ToNullable(startTime), Optional.ToNullable(endTime)); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/ProtectedItemJobProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/ProtectedItemJobProperties.cs new file mode 100644 index 000000000000..cf958d3e2798 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/ProtectedItemJobProperties.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// Protected item job properties. + public partial class ProtectedItemJobProperties + { + /// Initializes a new instance of ProtectedItemJobProperties. + internal ProtectedItemJobProperties() + { + } + + /// Initializes a new instance of ProtectedItemJobProperties. + /// Gets or sets protection scenario name. + /// Gets or sets workflow Id. + /// Gets or sets workflow name. + /// Gets or sets the workflow friendly display name. + /// Gets or sets workflow state. + /// Gets or sets start time of the workflow. + /// Gets or sets end time of the workflow. + internal ProtectedItemJobProperties(string scenarioName, string id, string name, string displayName, string state, DateTimeOffset? startOn, DateTimeOffset? endOn) + { + ScenarioName = scenarioName; + Id = id; + Name = name; + DisplayName = displayName; + State = state; + StartOn = startOn; + EndOn = endOn; + } + + /// Gets or sets protection scenario name. + public string ScenarioName { get; } + /// Gets or sets workflow Id. + public string Id { get; } + /// Gets or sets workflow name. + public string Name { get; } + /// Gets or sets the workflow friendly display name. + public string DisplayName { get; } + /// Gets or sets workflow state. + public string State { get; } + /// Gets or sets start time of the workflow. + public DateTimeOffset? StartOn { get; } + /// Gets or sets end time of the workflow. + public DateTimeOffset? EndOn { get; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/ProtectedItemModelCustomProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/ProtectedItemModelCustomProperties.Serialization.cs new file mode 100644 index 000000000000..47a60636306b --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/ProtectedItemModelCustomProperties.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.RecoveryServicesDataReplication.Models +{ + public partial class ProtectedItemModelCustomProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("instanceType"u8); + writer.WriteStringValue(InstanceType); + writer.WriteEndObject(); + } + + internal static ProtectedItemModelCustomProperties DeserializeProtectedItemModelCustomProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("instanceType", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "HyperVToAzStackHCI": return HyperVToAzStackHciProtectedItemModelCustomProperties.DeserializeHyperVToAzStackHciProtectedItemModelCustomProperties(element); + case "ProtectedItemModelCustomProperties": return GeneralProtectedItemModelCustomProperties.DeserializeGeneralProtectedItemModelCustomProperties(element); + case "VMwareToAzStackHCI": return VMwareToAzStackHciProtectedItemModelCustomProperties.DeserializeVMwareToAzStackHciProtectedItemModelCustomProperties(element); + } + } + return UnknownProtectedItemModelCustomProperties.DeserializeUnknownProtectedItemModelCustomProperties(element); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/ProtectedItemModelCustomProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/ProtectedItemModelCustomProperties.cs new file mode 100644 index 000000000000..a995493e037e --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/ProtectedItemModelCustomProperties.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// + /// Protected item model custom properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + public abstract partial class ProtectedItemModelCustomProperties + { + /// Initializes a new instance of ProtectedItemModelCustomProperties. + protected ProtectedItemModelCustomProperties() + { + } + + /// Initializes a new instance of ProtectedItemModelCustomProperties. + /// Gets or sets the instance type. + internal ProtectedItemModelCustomProperties(string instanceType) + { + InstanceType = instanceType; + } + + /// Gets or sets the instance type. + internal string InstanceType { get; set; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/RecoveryPointModelCustomProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/RecoveryPointModelCustomProperties.Serialization.cs new file mode 100644 index 000000000000..4fe80948d4af --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/RecoveryPointModelCustomProperties.Serialization.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + public partial class RecoveryPointModelCustomProperties + { + internal static RecoveryPointModelCustomProperties DeserializeRecoveryPointModelCustomProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("instanceType", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "HyperVToAzStackHCI": return HyperVToAzStackHciRecoveryPointModelCustomProperties.DeserializeHyperVToAzStackHciRecoveryPointModelCustomProperties(element); + } + } + return UnknownRecoveryPointModelCustomProperties.DeserializeUnknownRecoveryPointModelCustomProperties(element); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/RecoveryPointModelCustomProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/RecoveryPointModelCustomProperties.cs new file mode 100644 index 000000000000..f90d8b914bb9 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/RecoveryPointModelCustomProperties.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// + /// Recovery point model custom properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + public abstract partial class RecoveryPointModelCustomProperties + { + /// Initializes a new instance of RecoveryPointModelCustomProperties. + protected RecoveryPointModelCustomProperties() + { + } + + /// Initializes a new instance of RecoveryPointModelCustomProperties. + /// Gets or sets the instance type. + internal RecoveryPointModelCustomProperties(string instanceType) + { + InstanceType = instanceType; + } + + /// Gets or sets the instance type. + internal string InstanceType { get; set; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/ReplicationExtensionModelCustomProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/ReplicationExtensionModelCustomProperties.Serialization.cs new file mode 100644 index 000000000000..79caba7f9f7c --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/ReplicationExtensionModelCustomProperties.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.RecoveryServicesDataReplication.Models +{ + public partial class ReplicationExtensionModelCustomProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("instanceType"u8); + writer.WriteStringValue(InstanceType); + writer.WriteEndObject(); + } + + internal static ReplicationExtensionModelCustomProperties DeserializeReplicationExtensionModelCustomProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("instanceType", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "HyperVToAzStackHCI": return HyperVToAzStackHciReplicationExtensionModelCustomProperties.DeserializeHyperVToAzStackHciReplicationExtensionModelCustomProperties(element); + case "ReplicationExtensionModelCustomProperties": return GeneralReplicationExtensionModelCustomProperties.DeserializeGeneralReplicationExtensionModelCustomProperties(element); + case "VMwareToAzStackHCI": return VMwareToAzStackHciReplicationExtensionModelCustomProperties.DeserializeVMwareToAzStackHciReplicationExtensionModelCustomProperties(element); + } + } + return UnknownReplicationExtensionModelCustomProperties.DeserializeUnknownReplicationExtensionModelCustomProperties(element); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/ReplicationExtensionModelCustomProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/ReplicationExtensionModelCustomProperties.cs new file mode 100644 index 000000000000..ca6633cf9807 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/ReplicationExtensionModelCustomProperties.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// + /// Replication extension model custom properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + public abstract partial class ReplicationExtensionModelCustomProperties + { + /// Initializes a new instance of ReplicationExtensionModelCustomProperties. + protected ReplicationExtensionModelCustomProperties() + { + } + + /// Initializes a new instance of ReplicationExtensionModelCustomProperties. + /// Gets or sets the instance type. + internal ReplicationExtensionModelCustomProperties(string instanceType) + { + InstanceType = instanceType; + } + + /// Gets or sets the instance type. + internal string InstanceType { get; set; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/StorageContainerProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/StorageContainerProperties.Serialization.cs new file mode 100644 index 000000000000..48709f6dd0a6 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/StorageContainerProperties.Serialization.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + public partial class StorageContainerProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + writer.WritePropertyName("clusterSharedVolumePath"u8); + writer.WriteStringValue(ClusterSharedVolumePath); + writer.WriteEndObject(); + } + + internal static StorageContainerProperties DeserializeStorageContainerProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string clusterSharedVolumePath = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("clusterSharedVolumePath"u8)) + { + clusterSharedVolumePath = property.Value.GetString(); + continue; + } + } + return new StorageContainerProperties(name, clusterSharedVolumePath); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/StorageContainerProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/StorageContainerProperties.cs new file mode 100644 index 000000000000..2cb8b832dca2 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/StorageContainerProperties.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// Storage container properties. + public partial class StorageContainerProperties + { + /// Initializes a new instance of StorageContainerProperties. + /// Gets or sets the Name. + /// Gets or sets the ClusterSharedVolumePath. + /// or is null. + public StorageContainerProperties(string name, string clusterSharedVolumePath) + { + Argument.AssertNotNull(name, nameof(name)); + Argument.AssertNotNull(clusterSharedVolumePath, nameof(clusterSharedVolumePath)); + + Name = name; + ClusterSharedVolumePath = clusterSharedVolumePath; + } + + /// Gets or sets the Name. + public string Name { get; set; } + /// Gets or sets the ClusterSharedVolumePath. + public string ClusterSharedVolumePath { get; set; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/TaskModelCustomProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/TaskModelCustomProperties.Serialization.cs new file mode 100644 index 000000000000..577eab7df412 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/TaskModelCustomProperties.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.RecoveryServicesDataReplication.Models +{ + internal partial class TaskModelCustomProperties + { + internal static TaskModelCustomProperties DeserializeTaskModelCustomProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string instanceType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("instanceType"u8)) + { + instanceType = property.Value.GetString(); + continue; + } + } + return new TaskModelCustomProperties(instanceType); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/TaskModelCustomProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/TaskModelCustomProperties.cs new file mode 100644 index 000000000000..2f8c5d476d91 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/TaskModelCustomProperties.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// Task model custom properties. + internal partial class TaskModelCustomProperties + { + /// Initializes a new instance of TaskModelCustomProperties. + /// Gets or sets the instance type. + /// is null. + internal TaskModelCustomProperties(string instanceType) + { + Argument.AssertNotNull(instanceType, nameof(instanceType)); + + InstanceType = instanceType; + } + + /// Gets or sets the instance type. + public string InstanceType { get; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/TestFailoverCleanupWorkflowModelCustomProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/TestFailoverCleanupWorkflowModelCustomProperties.Serialization.cs new file mode 100644 index 000000000000..fc93577df6a2 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/TestFailoverCleanupWorkflowModelCustomProperties.Serialization.cs @@ -0,0 +1,55 @@ +// 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.RecoveryServicesDataReplication.Models +{ + public partial class TestFailoverCleanupWorkflowModelCustomProperties + { + internal static TestFailoverCleanupWorkflowModelCustomProperties DeserializeTestFailoverCleanupWorkflowModelCustomProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional comments = default; + string instanceType = default; + Optional> affectedObjectDetails = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("comments"u8)) + { + comments = property.Value.GetString(); + continue; + } + if (property.NameEquals("instanceType"u8)) + { + instanceType = property.Value.GetString(); + continue; + } + if (property.NameEquals("affectedObjectDetails"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()); + } + affectedObjectDetails = dictionary; + continue; + } + } + return new TestFailoverCleanupWorkflowModelCustomProperties(instanceType, Optional.ToDictionary(affectedObjectDetails), comments.Value); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/TestFailoverCleanupWorkflowModelCustomProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/TestFailoverCleanupWorkflowModelCustomProperties.cs new file mode 100644 index 000000000000..c3d8d576cfb3 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/TestFailoverCleanupWorkflowModelCustomProperties.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// Test failover cleanup workflow model custom properties. + public partial class TestFailoverCleanupWorkflowModelCustomProperties : WorkflowModelCustomProperties + { + /// Initializes a new instance of TestFailoverCleanupWorkflowModelCustomProperties. + internal TestFailoverCleanupWorkflowModelCustomProperties() + { + InstanceType = "TestFailoverCleanupWorkflowDetails"; + } + + /// Initializes a new instance of TestFailoverCleanupWorkflowModelCustomProperties. + /// Gets or sets the instance type. + /// Gets or sets any custom properties of the affected object. + /// Gets or sets the test failover cleanup comments. + internal TestFailoverCleanupWorkflowModelCustomProperties(string instanceType, IReadOnlyDictionary affectedObjectDetails, string comments) : base(instanceType, affectedObjectDetails) + { + Comments = comments; + InstanceType = instanceType ?? "TestFailoverCleanupWorkflowDetails"; + } + + /// Gets or sets the test failover cleanup comments. + public string Comments { get; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/TestFailoverWorkflowModelCustomProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/TestFailoverWorkflowModelCustomProperties.Serialization.cs new file mode 100644 index 000000000000..b53a89e47cdf --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/TestFailoverWorkflowModelCustomProperties.Serialization.cs @@ -0,0 +1,64 @@ +// 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.RecoveryServicesDataReplication.Models +{ + public partial class TestFailoverWorkflowModelCustomProperties + { + internal static TestFailoverWorkflowModelCustomProperties DeserializeTestFailoverWorkflowModelCustomProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> protectedItemDetails = default; + string instanceType = default; + Optional> affectedObjectDetails = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("protectedItemDetails"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(FailoverProtectedItemProperties.DeserializeFailoverProtectedItemProperties(item)); + } + protectedItemDetails = array; + continue; + } + if (property.NameEquals("instanceType"u8)) + { + instanceType = property.Value.GetString(); + continue; + } + if (property.NameEquals("affectedObjectDetails"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()); + } + affectedObjectDetails = dictionary; + continue; + } + } + return new TestFailoverWorkflowModelCustomProperties(instanceType, Optional.ToDictionary(affectedObjectDetails), Optional.ToList(protectedItemDetails)); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/TestFailoverWorkflowModelCustomProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/TestFailoverWorkflowModelCustomProperties.cs new file mode 100644 index 000000000000..8553fc88d3cf --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/TestFailoverWorkflowModelCustomProperties.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// Test failover workflow model custom properties. + public partial class TestFailoverWorkflowModelCustomProperties : WorkflowModelCustomProperties + { + /// Initializes a new instance of TestFailoverWorkflowModelCustomProperties. + internal TestFailoverWorkflowModelCustomProperties() + { + ProtectedItemDetails = new ChangeTrackingList(); + InstanceType = "TestFailoverWorkflowDetails"; + } + + /// Initializes a new instance of TestFailoverWorkflowModelCustomProperties. + /// Gets or sets the instance type. + /// Gets or sets any custom properties of the affected object. + /// Gets or sets the test VM details. + internal TestFailoverWorkflowModelCustomProperties(string instanceType, IReadOnlyDictionary affectedObjectDetails, IReadOnlyList protectedItemDetails) : base(instanceType, affectedObjectDetails) + { + ProtectedItemDetails = protectedItemDetails; + InstanceType = instanceType ?? "TestFailoverWorkflowDetails"; + } + + /// Gets or sets the test VM details. + public IReadOnlyList ProtectedItemDetails { get; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownDraModelCustomProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownDraModelCustomProperties.Serialization.cs new file mode 100644 index 000000000000..cade9a245163 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownDraModelCustomProperties.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.RecoveryServicesDataReplication.Models +{ + internal partial class UnknownDraModelCustomProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("instanceType"u8); + writer.WriteStringValue(InstanceType); + writer.WriteEndObject(); + } + + internal static UnknownDraModelCustomProperties DeserializeUnknownDraModelCustomProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string instanceType = "Unknown"; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("instanceType"u8)) + { + instanceType = property.Value.GetString(); + continue; + } + } + return new UnknownDraModelCustomProperties(instanceType); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownDraModelCustomProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownDraModelCustomProperties.cs new file mode 100644 index 000000000000..7c89739efc81 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownDraModelCustomProperties.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// The UnknownDraModelCustomProperties. + internal partial class UnknownDraModelCustomProperties : DraModelCustomProperties + { + /// Initializes a new instance of UnknownDraModelCustomProperties. + /// Gets or sets the instance type. + internal UnknownDraModelCustomProperties(string instanceType) : base(instanceType) + { + InstanceType = instanceType ?? "Unknown"; + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownEventModelCustomProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownEventModelCustomProperties.Serialization.cs new file mode 100644 index 000000000000..870c811db7be --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownEventModelCustomProperties.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.RecoveryServicesDataReplication.Models +{ + internal partial class UnknownEventModelCustomProperties + { + internal static UnknownEventModelCustomProperties DeserializeUnknownEventModelCustomProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string instanceType = "Unknown"; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("instanceType"u8)) + { + instanceType = property.Value.GetString(); + continue; + } + } + return new UnknownEventModelCustomProperties(instanceType); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownEventModelCustomProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownEventModelCustomProperties.cs new file mode 100644 index 000000000000..cb78fe246749 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownEventModelCustomProperties.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// The UnknownEventModelCustomProperties. + internal partial class UnknownEventModelCustomProperties : EventModelCustomProperties + { + /// Initializes a new instance of UnknownEventModelCustomProperties. + /// Gets or sets the instance type. + internal UnknownEventModelCustomProperties(string instanceType) : base(instanceType) + { + InstanceType = instanceType ?? "Unknown"; + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownFabricModelCustomProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownFabricModelCustomProperties.Serialization.cs new file mode 100644 index 000000000000..5fef72fdd65d --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownFabricModelCustomProperties.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.RecoveryServicesDataReplication.Models +{ + internal partial class UnknownFabricModelCustomProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("instanceType"u8); + writer.WriteStringValue(InstanceType); + writer.WriteEndObject(); + } + + internal static UnknownFabricModelCustomProperties DeserializeUnknownFabricModelCustomProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string instanceType = "Unknown"; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("instanceType"u8)) + { + instanceType = property.Value.GetString(); + continue; + } + } + return new UnknownFabricModelCustomProperties(instanceType); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownFabricModelCustomProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownFabricModelCustomProperties.cs new file mode 100644 index 000000000000..658d62aafa1e --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownFabricModelCustomProperties.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// The UnknownFabricModelCustomProperties. + internal partial class UnknownFabricModelCustomProperties : FabricModelCustomProperties + { + /// Initializes a new instance of UnknownFabricModelCustomProperties. + /// Gets or sets the instance type. + internal UnknownFabricModelCustomProperties(string instanceType) : base(instanceType) + { + InstanceType = instanceType ?? "Unknown"; + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownPlannedFailoverModelCustomProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownPlannedFailoverModelCustomProperties.Serialization.cs new file mode 100644 index 000000000000..4221531672a6 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownPlannedFailoverModelCustomProperties.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.RecoveryServicesDataReplication.Models +{ + internal partial class UnknownPlannedFailoverModelCustomProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("instanceType"u8); + writer.WriteStringValue(InstanceType); + writer.WriteEndObject(); + } + + internal static UnknownPlannedFailoverModelCustomProperties DeserializeUnknownPlannedFailoverModelCustomProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string instanceType = "Unknown"; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("instanceType"u8)) + { + instanceType = property.Value.GetString(); + continue; + } + } + return new UnknownPlannedFailoverModelCustomProperties(instanceType); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownPlannedFailoverModelCustomProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownPlannedFailoverModelCustomProperties.cs new file mode 100644 index 000000000000..80fa2eaeb23b --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownPlannedFailoverModelCustomProperties.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// The UnknownPlannedFailoverModelCustomProperties. + internal partial class UnknownPlannedFailoverModelCustomProperties : PlannedFailoverModelCustomProperties + { + /// Initializes a new instance of UnknownPlannedFailoverModelCustomProperties. + /// Gets or sets the instance type. + internal UnknownPlannedFailoverModelCustomProperties(string instanceType) : base(instanceType) + { + InstanceType = instanceType ?? "Unknown"; + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownPolicyModelCustomProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownPolicyModelCustomProperties.Serialization.cs new file mode 100644 index 000000000000..ca16e10bcd3e --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownPolicyModelCustomProperties.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.RecoveryServicesDataReplication.Models +{ + internal partial class UnknownPolicyModelCustomProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("instanceType"u8); + writer.WriteStringValue(InstanceType); + writer.WriteEndObject(); + } + + internal static UnknownPolicyModelCustomProperties DeserializeUnknownPolicyModelCustomProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string instanceType = "Unknown"; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("instanceType"u8)) + { + instanceType = property.Value.GetString(); + continue; + } + } + return new UnknownPolicyModelCustomProperties(instanceType); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownPolicyModelCustomProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownPolicyModelCustomProperties.cs new file mode 100644 index 000000000000..4819228f2ae0 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownPolicyModelCustomProperties.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// The UnknownPolicyModelCustomProperties. + internal partial class UnknownPolicyModelCustomProperties : PolicyModelCustomProperties + { + /// Initializes a new instance of UnknownPolicyModelCustomProperties. + /// Gets or sets the instance type. + internal UnknownPolicyModelCustomProperties(string instanceType) : base(instanceType) + { + InstanceType = instanceType ?? "Unknown"; + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownProtectedItemModelCustomProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownProtectedItemModelCustomProperties.Serialization.cs new file mode 100644 index 000000000000..cfcf25ab8a7f --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownProtectedItemModelCustomProperties.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.RecoveryServicesDataReplication.Models +{ + internal partial class UnknownProtectedItemModelCustomProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("instanceType"u8); + writer.WriteStringValue(InstanceType); + writer.WriteEndObject(); + } + + internal static UnknownProtectedItemModelCustomProperties DeserializeUnknownProtectedItemModelCustomProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string instanceType = "Unknown"; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("instanceType"u8)) + { + instanceType = property.Value.GetString(); + continue; + } + } + return new UnknownProtectedItemModelCustomProperties(instanceType); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownProtectedItemModelCustomProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownProtectedItemModelCustomProperties.cs new file mode 100644 index 000000000000..189c2443a9f1 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownProtectedItemModelCustomProperties.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// The UnknownProtectedItemModelCustomProperties. + internal partial class UnknownProtectedItemModelCustomProperties : ProtectedItemModelCustomProperties + { + /// Initializes a new instance of UnknownProtectedItemModelCustomProperties. + /// Gets or sets the instance type. + internal UnknownProtectedItemModelCustomProperties(string instanceType) : base(instanceType) + { + InstanceType = instanceType ?? "Unknown"; + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownRecoveryPointModelCustomProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownRecoveryPointModelCustomProperties.Serialization.cs new file mode 100644 index 000000000000..edb7d9eb92d6 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownRecoveryPointModelCustomProperties.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.RecoveryServicesDataReplication.Models +{ + internal partial class UnknownRecoveryPointModelCustomProperties + { + internal static UnknownRecoveryPointModelCustomProperties DeserializeUnknownRecoveryPointModelCustomProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string instanceType = "Unknown"; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("instanceType"u8)) + { + instanceType = property.Value.GetString(); + continue; + } + } + return new UnknownRecoveryPointModelCustomProperties(instanceType); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownRecoveryPointModelCustomProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownRecoveryPointModelCustomProperties.cs new file mode 100644 index 000000000000..6f13ed9b7009 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownRecoveryPointModelCustomProperties.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// The UnknownRecoveryPointModelCustomProperties. + internal partial class UnknownRecoveryPointModelCustomProperties : RecoveryPointModelCustomProperties + { + /// Initializes a new instance of UnknownRecoveryPointModelCustomProperties. + /// Gets or sets the instance type. + internal UnknownRecoveryPointModelCustomProperties(string instanceType) : base(instanceType) + { + InstanceType = instanceType ?? "Unknown"; + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownReplicationExtensionModelCustomProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownReplicationExtensionModelCustomProperties.Serialization.cs new file mode 100644 index 000000000000..0ecaedee6682 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownReplicationExtensionModelCustomProperties.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.RecoveryServicesDataReplication.Models +{ + internal partial class UnknownReplicationExtensionModelCustomProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("instanceType"u8); + writer.WriteStringValue(InstanceType); + writer.WriteEndObject(); + } + + internal static UnknownReplicationExtensionModelCustomProperties DeserializeUnknownReplicationExtensionModelCustomProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string instanceType = "Unknown"; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("instanceType"u8)) + { + instanceType = property.Value.GetString(); + continue; + } + } + return new UnknownReplicationExtensionModelCustomProperties(instanceType); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownReplicationExtensionModelCustomProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownReplicationExtensionModelCustomProperties.cs new file mode 100644 index 000000000000..717edc73d614 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownReplicationExtensionModelCustomProperties.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// The UnknownReplicationExtensionModelCustomProperties. + internal partial class UnknownReplicationExtensionModelCustomProperties : ReplicationExtensionModelCustomProperties + { + /// Initializes a new instance of UnknownReplicationExtensionModelCustomProperties. + /// Gets or sets the instance type. + internal UnknownReplicationExtensionModelCustomProperties(string instanceType) : base(instanceType) + { + InstanceType = instanceType ?? "Unknown"; + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownWorkflowModelCustomProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownWorkflowModelCustomProperties.Serialization.cs new file mode 100644 index 000000000000..e0f02067d4a0 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownWorkflowModelCustomProperties.Serialization.cs @@ -0,0 +1,49 @@ +// 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.RecoveryServicesDataReplication.Models +{ + internal partial class UnknownWorkflowModelCustomProperties + { + internal static UnknownWorkflowModelCustomProperties DeserializeUnknownWorkflowModelCustomProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string instanceType = "Unknown"; + Optional> affectedObjectDetails = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("instanceType"u8)) + { + instanceType = property.Value.GetString(); + continue; + } + if (property.NameEquals("affectedObjectDetails"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()); + } + affectedObjectDetails = dictionary; + continue; + } + } + return new UnknownWorkflowModelCustomProperties(instanceType, Optional.ToDictionary(affectedObjectDetails)); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownWorkflowModelCustomProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownWorkflowModelCustomProperties.cs new file mode 100644 index 000000000000..c66ca9eb809e --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/UnknownWorkflowModelCustomProperties.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// The UnknownWorkflowModelCustomProperties. + internal partial class UnknownWorkflowModelCustomProperties : WorkflowModelCustomProperties + { + /// Initializes a new instance of UnknownWorkflowModelCustomProperties. + /// Gets or sets the instance type. + /// Gets or sets any custom properties of the affected object. + internal UnknownWorkflowModelCustomProperties(string instanceType, IReadOnlyDictionary affectedObjectDetails) : base(instanceType, affectedObjectDetails) + { + InstanceType = instanceType ?? "Unknown"; + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareDraModelCustomProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareDraModelCustomProperties.Serialization.cs new file mode 100644 index 000000000000..b5e3ef4900f7 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareDraModelCustomProperties.Serialization.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + public partial class VMwareDraModelCustomProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("biosId"u8); + writer.WriteStringValue(BiosId); + writer.WritePropertyName("marsAuthenticationIdentity"u8); + writer.WriteObjectValue(MarsAuthenticationIdentity); + writer.WritePropertyName("instanceType"u8); + writer.WriteStringValue(InstanceType); + writer.WriteEndObject(); + } + + internal static VMwareDraModelCustomProperties DeserializeVMwareDraModelCustomProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string biosId = default; + DataReplicationIdentity marsAuthenticationIdentity = default; + string instanceType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("biosId"u8)) + { + biosId = property.Value.GetString(); + continue; + } + if (property.NameEquals("marsAuthenticationIdentity"u8)) + { + marsAuthenticationIdentity = DataReplicationIdentity.DeserializeDataReplicationIdentity(property.Value); + continue; + } + if (property.NameEquals("instanceType"u8)) + { + instanceType = property.Value.GetString(); + continue; + } + } + return new VMwareDraModelCustomProperties(instanceType, biosId, marsAuthenticationIdentity); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareDraModelCustomProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareDraModelCustomProperties.cs new file mode 100644 index 000000000000..bee852d3c609 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareDraModelCustomProperties.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// VMware DRA model custom properties. + public partial class VMwareDraModelCustomProperties : DraModelCustomProperties + { + /// Initializes a new instance of VMwareDraModelCustomProperties. + /// Gets or sets the BIOS Id of the DRA machine. + /// Identity model. + /// or is null. + public VMwareDraModelCustomProperties(string biosId, DataReplicationIdentity marsAuthenticationIdentity) + { + Argument.AssertNotNull(biosId, nameof(biosId)); + Argument.AssertNotNull(marsAuthenticationIdentity, nameof(marsAuthenticationIdentity)); + + BiosId = biosId; + MarsAuthenticationIdentity = marsAuthenticationIdentity; + InstanceType = "VMware"; + } + + /// Initializes a new instance of VMwareDraModelCustomProperties. + /// Gets or sets the instance type. + /// Gets or sets the BIOS Id of the DRA machine. + /// Identity model. + internal VMwareDraModelCustomProperties(string instanceType, string biosId, DataReplicationIdentity marsAuthenticationIdentity) : base(instanceType) + { + BiosId = biosId; + MarsAuthenticationIdentity = marsAuthenticationIdentity; + InstanceType = instanceType ?? "VMware"; + } + + /// Gets or sets the BIOS Id of the DRA machine. + public string BiosId { get; set; } + /// Identity model. + public DataReplicationIdentity MarsAuthenticationIdentity { get; set; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareMigrateFabricModelCustomProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareMigrateFabricModelCustomProperties.Serialization.cs new file mode 100644 index 000000000000..25253fa0b952 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareMigrateFabricModelCustomProperties.Serialization.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + public partial class VMwareMigrateFabricModelCustomProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("vmwareSiteId"u8); + writer.WriteStringValue(VMwareSiteId); + writer.WritePropertyName("migrationSolutionId"u8); + writer.WriteStringValue(MigrationSolutionId); + writer.WritePropertyName("instanceType"u8); + writer.WriteStringValue(InstanceType); + writer.WriteEndObject(); + } + + internal static VMwareMigrateFabricModelCustomProperties DeserializeVMwareMigrateFabricModelCustomProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier vmwareSiteId = default; + ResourceIdentifier migrationSolutionId = default; + string instanceType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("vmwareSiteId"u8)) + { + vmwareSiteId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("migrationSolutionId"u8)) + { + migrationSolutionId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("instanceType"u8)) + { + instanceType = property.Value.GetString(); + continue; + } + } + return new VMwareMigrateFabricModelCustomProperties(instanceType, vmwareSiteId, migrationSolutionId); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareMigrateFabricModelCustomProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareMigrateFabricModelCustomProperties.cs new file mode 100644 index 000000000000..b90da1dbe59b --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareMigrateFabricModelCustomProperties.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// VMware migrate fabric model custom properties. + public partial class VMwareMigrateFabricModelCustomProperties : FabricModelCustomProperties + { + /// Initializes a new instance of VMwareMigrateFabricModelCustomProperties. + /// Gets or sets the ARM Id of the VMware site. + /// Gets or sets the ARM Id of the migration solution. + /// or is null. + public VMwareMigrateFabricModelCustomProperties(ResourceIdentifier vMwareSiteId, ResourceIdentifier migrationSolutionId) + { + Argument.AssertNotNull(vMwareSiteId, nameof(vMwareSiteId)); + Argument.AssertNotNull(migrationSolutionId, nameof(migrationSolutionId)); + + VMwareSiteId = vMwareSiteId; + MigrationSolutionId = migrationSolutionId; + InstanceType = "VMwareMigrate"; + } + + /// Initializes a new instance of VMwareMigrateFabricModelCustomProperties. + /// Gets or sets the instance type. + /// Gets or sets the ARM Id of the VMware site. + /// Gets or sets the ARM Id of the migration solution. + internal VMwareMigrateFabricModelCustomProperties(string instanceType, ResourceIdentifier vMwareSiteId, ResourceIdentifier migrationSolutionId) : base(instanceType) + { + VMwareSiteId = vMwareSiteId; + MigrationSolutionId = migrationSolutionId; + InstanceType = instanceType ?? "VMwareMigrate"; + } + + /// Gets or sets the ARM Id of the VMware site. + public ResourceIdentifier VMwareSiteId { get; set; } + /// Gets or sets the ARM Id of the migration solution. + public ResourceIdentifier MigrationSolutionId { get; set; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciDiskInput.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciDiskInput.Serialization.cs new file mode 100644 index 000000000000..6751c171ed95 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciDiskInput.Serialization.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + public partial class VMwareToAzStackHciDiskInput : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("diskId"u8); + writer.WriteStringValue(DiskId); + if (Optional.IsDefined(StorageContainerId)) + { + writer.WritePropertyName("storageContainerId"u8); + writer.WriteStringValue(StorageContainerId); + } + if (Optional.IsDefined(IsDynamic)) + { + writer.WritePropertyName("isDynamic"u8); + writer.WriteBooleanValue(IsDynamic.Value); + } + writer.WritePropertyName("diskSizeGB"u8); + writer.WriteNumberValue(DiskSizeGB); + writer.WritePropertyName("diskFileFormat"u8); + writer.WriteStringValue(DiskFileFormat); + writer.WritePropertyName("isOsDisk"u8); + writer.WriteBooleanValue(IsOSDisk); + writer.WriteEndObject(); + } + + internal static VMwareToAzStackHciDiskInput DeserializeVMwareToAzStackHciDiskInput(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string diskId = default; + Optional storageContainerId = default; + Optional isDynamic = default; + long diskSizeGB = default; + string diskFileFormat = default; + bool isOSDisk = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("diskId"u8)) + { + diskId = property.Value.GetString(); + continue; + } + if (property.NameEquals("storageContainerId"u8)) + { + storageContainerId = property.Value.GetString(); + continue; + } + if (property.NameEquals("isDynamic"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isDynamic = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("diskSizeGB"u8)) + { + diskSizeGB = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("diskFileFormat"u8)) + { + diskFileFormat = property.Value.GetString(); + continue; + } + if (property.NameEquals("isOsDisk"u8)) + { + isOSDisk = property.Value.GetBoolean(); + continue; + } + } + return new VMwareToAzStackHciDiskInput(diskId, storageContainerId.Value, Optional.ToNullable(isDynamic), diskSizeGB, diskFileFormat, isOSDisk); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciDiskInput.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciDiskInput.cs new file mode 100644 index 000000000000..484fe2430cfe --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciDiskInput.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// VMwareToAzStack disk input. + public partial class VMwareToAzStackHciDiskInput + { + /// Initializes a new instance of VMwareToAzStackHciDiskInput. + /// Gets or sets the disk Id. + /// Gets or sets the disk size in GB. + /// Gets or sets the type of the virtual hard disk, vhd or vhdx. + /// Gets or sets a value indicating whether disk is os disk. + /// or is null. + public VMwareToAzStackHciDiskInput(string diskId, long diskSizeGB, string diskFileFormat, bool isOSDisk) + { + Argument.AssertNotNull(diskId, nameof(diskId)); + Argument.AssertNotNull(diskFileFormat, nameof(diskFileFormat)); + + DiskId = diskId; + DiskSizeGB = diskSizeGB; + DiskFileFormat = diskFileFormat; + IsOSDisk = isOSDisk; + } + + /// Initializes a new instance of VMwareToAzStackHciDiskInput. + /// Gets or sets the disk Id. + /// Gets or sets the target storage account ARM Id. + /// + /// Gets or sets a value indicating whether dynamic sizing is enabled on the virtual hard + /// disk. + /// + /// Gets or sets the disk size in GB. + /// Gets or sets the type of the virtual hard disk, vhd or vhdx. + /// Gets or sets a value indicating whether disk is os disk. + internal VMwareToAzStackHciDiskInput(string diskId, string storageContainerId, bool? isDynamic, long diskSizeGB, string diskFileFormat, bool isOSDisk) + { + DiskId = diskId; + StorageContainerId = storageContainerId; + IsDynamic = isDynamic; + DiskSizeGB = diskSizeGB; + DiskFileFormat = diskFileFormat; + IsOSDisk = isOSDisk; + } + + /// Gets or sets the disk Id. + public string DiskId { get; set; } + /// Gets or sets the target storage account ARM Id. + public string StorageContainerId { get; set; } + /// + /// Gets or sets a value indicating whether dynamic sizing is enabled on the virtual hard + /// disk. + /// + public bool? IsDynamic { get; set; } + /// Gets or sets the disk size in GB. + public long DiskSizeGB { get; set; } + /// Gets or sets the type of the virtual hard disk, vhd or vhdx. + public string DiskFileFormat { get; set; } + /// Gets or sets a value indicating whether disk is os disk. + public bool IsOSDisk { get; set; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciNicInput.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciNicInput.Serialization.cs new file mode 100644 index 000000000000..a12f283335ea --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciNicInput.Serialization.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + public partial class VMwareToAzStackHciNicInput : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("nicId"u8); + writer.WriteStringValue(NicId); + writer.WritePropertyName("label"u8); + writer.WriteStringValue(Label); + writer.WritePropertyName("targetNetworkId"u8); + writer.WriteStringValue(TargetNetworkId); + writer.WritePropertyName("testNetworkId"u8); + writer.WriteStringValue(TestNetworkId); + writer.WritePropertyName("selectionTypeForFailover"u8); + writer.WriteStringValue(SelectionTypeForFailover.ToString()); + writer.WriteEndObject(); + } + + internal static VMwareToAzStackHciNicInput DeserializeVMwareToAzStackHciNicInput(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string nicId = default; + string label = default; + Optional networkName = default; + string targetNetworkId = default; + string testNetworkId = default; + VmNicSelection selectionTypeForFailover = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("nicId"u8)) + { + nicId = property.Value.GetString(); + continue; + } + if (property.NameEquals("label"u8)) + { + label = property.Value.GetString(); + continue; + } + if (property.NameEquals("networkName"u8)) + { + networkName = property.Value.GetString(); + continue; + } + if (property.NameEquals("targetNetworkId"u8)) + { + targetNetworkId = property.Value.GetString(); + continue; + } + if (property.NameEquals("testNetworkId"u8)) + { + testNetworkId = property.Value.GetString(); + continue; + } + if (property.NameEquals("selectionTypeForFailover"u8)) + { + selectionTypeForFailover = new VmNicSelection(property.Value.GetString()); + continue; + } + } + return new VMwareToAzStackHciNicInput(nicId, label, networkName.Value, targetNetworkId, testNetworkId, selectionTypeForFailover); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciNicInput.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciNicInput.cs new file mode 100644 index 000000000000..3bf2858bdcf3 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciNicInput.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// VMwareToAzStackHCI NIC properties. + public partial class VMwareToAzStackHciNicInput + { + /// Initializes a new instance of VMwareToAzStackHciNicInput. + /// Gets or sets the NIC Id. + /// Gets or sets the NIC label. + /// Gets or sets the target network Id within AzStackHCI Cluster. + /// Gets or sets the target test network Id within AzStackHCI Cluster. + /// Gets or sets the selection type of the NIC. + /// , , or is null. + public VMwareToAzStackHciNicInput(string nicId, string label, string targetNetworkId, string testNetworkId, VmNicSelection selectionTypeForFailover) + { + Argument.AssertNotNull(nicId, nameof(nicId)); + Argument.AssertNotNull(label, nameof(label)); + Argument.AssertNotNull(targetNetworkId, nameof(targetNetworkId)); + Argument.AssertNotNull(testNetworkId, nameof(testNetworkId)); + + NicId = nicId; + Label = label; + TargetNetworkId = targetNetworkId; + TestNetworkId = testNetworkId; + SelectionTypeForFailover = selectionTypeForFailover; + } + + /// Initializes a new instance of VMwareToAzStackHciNicInput. + /// Gets or sets the NIC Id. + /// Gets or sets the NIC label. + /// Gets or sets the network name. + /// Gets or sets the target network Id within AzStackHCI Cluster. + /// Gets or sets the target test network Id within AzStackHCI Cluster. + /// Gets or sets the selection type of the NIC. + internal VMwareToAzStackHciNicInput(string nicId, string label, string networkName, string targetNetworkId, string testNetworkId, VmNicSelection selectionTypeForFailover) + { + NicId = nicId; + Label = label; + NetworkName = networkName; + TargetNetworkId = targetNetworkId; + TestNetworkId = testNetworkId; + SelectionTypeForFailover = selectionTypeForFailover; + } + + /// Gets or sets the NIC Id. + public string NicId { get; set; } + /// Gets or sets the NIC label. + public string Label { get; set; } + /// Gets or sets the network name. + public string NetworkName { get; } + /// Gets or sets the target network Id within AzStackHCI Cluster. + public string TargetNetworkId { get; set; } + /// Gets or sets the target test network Id within AzStackHCI Cluster. + public string TestNetworkId { get; set; } + /// Gets or sets the selection type of the NIC. + public VmNicSelection SelectionTypeForFailover { get; set; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciPlannedFailoverModelCustomProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciPlannedFailoverModelCustomProperties.Serialization.cs new file mode 100644 index 000000000000..d6cb0e2d152a --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciPlannedFailoverModelCustomProperties.Serialization.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + public partial class VMwareToAzStackHciPlannedFailoverModelCustomProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("shutdownSourceVM"u8); + writer.WriteBooleanValue(ShutdownSourceVm); + writer.WritePropertyName("instanceType"u8); + writer.WriteStringValue(InstanceType); + writer.WriteEndObject(); + } + + internal static VMwareToAzStackHciPlannedFailoverModelCustomProperties DeserializeVMwareToAzStackHciPlannedFailoverModelCustomProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool shutdownSourceVm = default; + string instanceType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("shutdownSourceVM"u8)) + { + shutdownSourceVm = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("instanceType"u8)) + { + instanceType = property.Value.GetString(); + continue; + } + } + return new VMwareToAzStackHciPlannedFailoverModelCustomProperties(instanceType, shutdownSourceVm); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciPlannedFailoverModelCustomProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciPlannedFailoverModelCustomProperties.cs new file mode 100644 index 000000000000..c33c501814c9 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciPlannedFailoverModelCustomProperties.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// VMware to AzStackHCI planned failover model custom properties. + public partial class VMwareToAzStackHciPlannedFailoverModelCustomProperties : PlannedFailoverModelCustomProperties + { + /// Initializes a new instance of VMwareToAzStackHciPlannedFailoverModelCustomProperties. + /// Gets or sets a value indicating whether VM needs to be shut down. + public VMwareToAzStackHciPlannedFailoverModelCustomProperties(bool shutdownSourceVm) + { + ShutdownSourceVm = shutdownSourceVm; + InstanceType = "VMwareToAzStackHCI"; + } + + /// Initializes a new instance of VMwareToAzStackHciPlannedFailoverModelCustomProperties. + /// Gets or sets the instance type. + /// Gets or sets a value indicating whether VM needs to be shut down. + internal VMwareToAzStackHciPlannedFailoverModelCustomProperties(string instanceType, bool shutdownSourceVm) : base(instanceType) + { + ShutdownSourceVm = shutdownSourceVm; + InstanceType = instanceType ?? "VMwareToAzStackHCI"; + } + + /// Gets or sets a value indicating whether VM needs to be shut down. + public bool ShutdownSourceVm { get; set; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciPolicyModelCustomProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciPolicyModelCustomProperties.Serialization.cs new file mode 100644 index 000000000000..491444d25312 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciPolicyModelCustomProperties.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.RecoveryServicesDataReplication.Models +{ + public partial class VMwareToAzStackHciPolicyModelCustomProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("recoveryPointHistoryInMinutes"u8); + writer.WriteNumberValue(RecoveryPointHistoryInMinutes); + writer.WritePropertyName("crashConsistentFrequencyInMinutes"u8); + writer.WriteNumberValue(CrashConsistentFrequencyInMinutes); + writer.WritePropertyName("appConsistentFrequencyInMinutes"u8); + writer.WriteNumberValue(AppConsistentFrequencyInMinutes); + writer.WritePropertyName("instanceType"u8); + writer.WriteStringValue(InstanceType); + writer.WriteEndObject(); + } + + internal static VMwareToAzStackHciPolicyModelCustomProperties DeserializeVMwareToAzStackHciPolicyModelCustomProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int recoveryPointHistoryInMinutes = default; + int crashConsistentFrequencyInMinutes = default; + int appConsistentFrequencyInMinutes = default; + string instanceType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("recoveryPointHistoryInMinutes"u8)) + { + recoveryPointHistoryInMinutes = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("crashConsistentFrequencyInMinutes"u8)) + { + crashConsistentFrequencyInMinutes = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("appConsistentFrequencyInMinutes"u8)) + { + appConsistentFrequencyInMinutes = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("instanceType"u8)) + { + instanceType = property.Value.GetString(); + continue; + } + } + return new VMwareToAzStackHciPolicyModelCustomProperties(instanceType, recoveryPointHistoryInMinutes, crashConsistentFrequencyInMinutes, appConsistentFrequencyInMinutes); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciPolicyModelCustomProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciPolicyModelCustomProperties.cs new file mode 100644 index 000000000000..169738f1455b --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciPolicyModelCustomProperties.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// VMware To AzStackHCI Policy model custom properties. + public partial class VMwareToAzStackHciPolicyModelCustomProperties : PolicyModelCustomProperties + { + /// Initializes a new instance of VMwareToAzStackHciPolicyModelCustomProperties. + /// + /// Gets or sets the duration in minutes until which the recovery points need to be + /// stored. + /// + /// Gets or sets the crash consistent snapshot frequency (in minutes). + /// Gets or sets the app consistent snapshot frequency (in minutes). + public VMwareToAzStackHciPolicyModelCustomProperties(int recoveryPointHistoryInMinutes, int crashConsistentFrequencyInMinutes, int appConsistentFrequencyInMinutes) + { + RecoveryPointHistoryInMinutes = recoveryPointHistoryInMinutes; + CrashConsistentFrequencyInMinutes = crashConsistentFrequencyInMinutes; + AppConsistentFrequencyInMinutes = appConsistentFrequencyInMinutes; + InstanceType = "VMwareToAzStackHCI"; + } + + /// Initializes a new instance of VMwareToAzStackHciPolicyModelCustomProperties. + /// Gets or sets the instance type. + /// + /// Gets or sets the duration in minutes until which the recovery points need to be + /// stored. + /// + /// Gets or sets the crash consistent snapshot frequency (in minutes). + /// Gets or sets the app consistent snapshot frequency (in minutes). + internal VMwareToAzStackHciPolicyModelCustomProperties(string instanceType, int recoveryPointHistoryInMinutes, int crashConsistentFrequencyInMinutes, int appConsistentFrequencyInMinutes) : base(instanceType) + { + RecoveryPointHistoryInMinutes = recoveryPointHistoryInMinutes; + CrashConsistentFrequencyInMinutes = crashConsistentFrequencyInMinutes; + AppConsistentFrequencyInMinutes = appConsistentFrequencyInMinutes; + InstanceType = instanceType ?? "VMwareToAzStackHCI"; + } + + /// + /// Gets or sets the duration in minutes until which the recovery points need to be + /// stored. + /// + public int RecoveryPointHistoryInMinutes { get; set; } + /// Gets or sets the crash consistent snapshot frequency (in minutes). + public int CrashConsistentFrequencyInMinutes { get; set; } + /// Gets or sets the app consistent snapshot frequency (in minutes). + public int AppConsistentFrequencyInMinutes { get; set; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciProtectedDiskProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciProtectedDiskProperties.Serialization.cs new file mode 100644 index 000000000000..f3a8881fdb86 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciProtectedDiskProperties.Serialization.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + public partial class VMwareToAzStackHciProtectedDiskProperties + { + internal static VMwareToAzStackHciProtectedDiskProperties DeserializeVMwareToAzStackHciProtectedDiskProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional storageContainerId = default; + Optional storageContainerLocalPath = default; + Optional sourceDiskId = default; + Optional sourceDiskName = default; + Optional seedDiskName = default; + Optional testMigrateDiskName = default; + Optional migrateDiskName = default; + Optional isOSDisk = default; + Optional capacityInBytes = default; + Optional isDynamic = default; + Optional diskType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("storageContainerId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + storageContainerId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("storageContainerLocalPath"u8)) + { + storageContainerLocalPath = property.Value.GetString(); + continue; + } + if (property.NameEquals("sourceDiskId"u8)) + { + sourceDiskId = property.Value.GetString(); + continue; + } + if (property.NameEquals("sourceDiskName"u8)) + { + sourceDiskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("seedDiskName"u8)) + { + seedDiskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("testMigrateDiskName"u8)) + { + testMigrateDiskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("migrateDiskName"u8)) + { + migrateDiskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("isOsDisk"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isOSDisk = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("capacityInBytes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + capacityInBytes = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("isDynamic"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isDynamic = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("diskType"u8)) + { + diskType = property.Value.GetString(); + continue; + } + } + return new VMwareToAzStackHciProtectedDiskProperties(storageContainerId.Value, storageContainerLocalPath.Value, sourceDiskId.Value, sourceDiskName.Value, seedDiskName.Value, testMigrateDiskName.Value, migrateDiskName.Value, Optional.ToNullable(isOSDisk), Optional.ToNullable(capacityInBytes), Optional.ToNullable(isDynamic), diskType.Value); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciProtectedDiskProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciProtectedDiskProperties.cs new file mode 100644 index 000000000000..59427974c591 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciProtectedDiskProperties.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// VMwareToAzStackHCI protected disk properties. + public partial class VMwareToAzStackHciProtectedDiskProperties + { + /// Initializes a new instance of VMwareToAzStackHciProtectedDiskProperties. + internal VMwareToAzStackHciProtectedDiskProperties() + { + } + + /// Initializes a new instance of VMwareToAzStackHciProtectedDiskProperties. + /// Gets or sets the ARM Id of the storage container. + /// Gets or sets the local path of the storage container. + /// Gets or sets the source disk Id. + /// Gets or sets the source disk Name. + /// Gets or sets the seed disk name. + /// Gets or sets the test failover clone disk. + /// Gets or sets the failover clone disk. + /// Gets or sets a value indicating whether the disk is the OS disk. + /// Gets or sets the disk capacity in bytes. + /// + /// Gets or sets a value indicating whether dynamic sizing is enabled on the virtual hard + /// disk. + /// + /// Gets or sets the disk type. + internal VMwareToAzStackHciProtectedDiskProperties(ResourceIdentifier storageContainerId, string storageContainerLocalPath, string sourceDiskId, string sourceDiskName, string seedDiskName, string testMigrateDiskName, string migrateDiskName, bool? isOSDisk, long? capacityInBytes, bool? isDynamic, string diskType) + { + StorageContainerId = storageContainerId; + StorageContainerLocalPath = storageContainerLocalPath; + SourceDiskId = sourceDiskId; + SourceDiskName = sourceDiskName; + SeedDiskName = seedDiskName; + TestMigrateDiskName = testMigrateDiskName; + MigrateDiskName = migrateDiskName; + IsOSDisk = isOSDisk; + CapacityInBytes = capacityInBytes; + IsDynamic = isDynamic; + DiskType = diskType; + } + + /// Gets or sets the ARM Id of the storage container. + public ResourceIdentifier StorageContainerId { get; } + /// Gets or sets the local path of the storage container. + public string StorageContainerLocalPath { get; } + /// Gets or sets the source disk Id. + public string SourceDiskId { get; } + /// Gets or sets the source disk Name. + public string SourceDiskName { get; } + /// Gets or sets the seed disk name. + public string SeedDiskName { get; } + /// Gets or sets the test failover clone disk. + public string TestMigrateDiskName { get; } + /// Gets or sets the failover clone disk. + public string MigrateDiskName { get; } + /// Gets or sets a value indicating whether the disk is the OS disk. + public bool? IsOSDisk { get; } + /// Gets or sets the disk capacity in bytes. + public long? CapacityInBytes { get; } + /// + /// Gets or sets a value indicating whether dynamic sizing is enabled on the virtual hard + /// disk. + /// + public bool? IsDynamic { get; } + /// Gets or sets the disk type. + public string DiskType { get; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciProtectedItemModelCustomProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciProtectedItemModelCustomProperties.Serialization.cs new file mode 100644 index 000000000000..ae01bbe1b4ef --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciProtectedItemModelCustomProperties.Serialization.cs @@ -0,0 +1,493 @@ +// 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; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + public partial class VMwareToAzStackHciProtectedItemModelCustomProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("targetHciClusterId"u8); + writer.WriteStringValue(TargetHciClusterId); + writer.WritePropertyName("targetArcClusterCustomLocationId"u8); + writer.WriteStringValue(TargetArcClusterCustomLocationId); + writer.WritePropertyName("storageContainerId"u8); + writer.WriteStringValue(StorageContainerId); + writer.WritePropertyName("targetResourceGroupId"u8); + writer.WriteStringValue(TargetResourceGroupId); + writer.WritePropertyName("customLocationRegion"u8); + writer.WriteStringValue(CustomLocationRegion); + writer.WritePropertyName("disksToInclude"u8); + writer.WriteStartArray(); + foreach (var item in DisksToInclude) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + writer.WritePropertyName("nicsToInclude"u8); + writer.WriteStartArray(); + foreach (var item in NicsToInclude) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + if (Optional.IsDefined(TargetVmName)) + { + writer.WritePropertyName("targetVmName"u8); + writer.WriteStringValue(TargetVmName); + } + writer.WritePropertyName("hyperVGeneration"u8); + writer.WriteStringValue(HyperVGeneration); + if (Optional.IsDefined(TargetNetworkId)) + { + writer.WritePropertyName("targetNetworkId"u8); + writer.WriteStringValue(TargetNetworkId); + } + if (Optional.IsDefined(TestNetworkId)) + { + writer.WritePropertyName("testNetworkId"u8); + writer.WriteStringValue(TestNetworkId); + } + if (Optional.IsDefined(TargetCpuCores)) + { + writer.WritePropertyName("targetCpuCores"u8); + writer.WriteNumberValue(TargetCpuCores.Value); + } + if (Optional.IsDefined(IsDynamicRam)) + { + writer.WritePropertyName("isDynamicRam"u8); + writer.WriteBooleanValue(IsDynamicRam.Value); + } + if (Optional.IsDefined(DynamicMemoryConfig)) + { + writer.WritePropertyName("dynamicMemoryConfig"u8); + writer.WriteObjectValue(DynamicMemoryConfig); + } + if (Optional.IsDefined(TargetMemoryInMegaBytes)) + { + writer.WritePropertyName("targetMemoryInMegaBytes"u8); + writer.WriteNumberValue(TargetMemoryInMegaBytes.Value); + } + writer.WritePropertyName("fabricDiscoveryMachineId"u8); + writer.WriteStringValue(FabricDiscoveryMachineId); + writer.WritePropertyName("runAsAccountId"u8); + writer.WriteStringValue(RunAsAccountId); + writer.WritePropertyName("sourceDraName"u8); + writer.WriteStringValue(SourceDraName); + writer.WritePropertyName("targetDraName"u8); + writer.WriteStringValue(TargetDraName); + if (Optional.IsDefined(PerformAutoResync)) + { + writer.WritePropertyName("performAutoResync"u8); + writer.WriteBooleanValue(PerformAutoResync.Value); + } + writer.WritePropertyName("instanceType"u8); + writer.WriteStringValue(InstanceType); + writer.WriteEndObject(); + } + + internal static VMwareToAzStackHciProtectedItemModelCustomProperties DeserializeVMwareToAzStackHciProtectedItemModelCustomProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional activeLocation = default; + ResourceIdentifier targetHciClusterId = default; + ResourceIdentifier targetArcClusterCustomLocationId = default; + Optional targetAzStackHciClusterName = default; + ResourceIdentifier storageContainerId = default; + ResourceIdentifier targetResourceGroupId = default; + Optional targetLocation = default; + string customLocationRegion = default; + IList disksToInclude = default; + IList nicsToInclude = default; + Optional> protectedDisks = default; + Optional> protectedNics = default; + Optional targetVmBiosId = default; + Optional targetVmName = default; + string hyperVGeneration = default; + Optional targetNetworkId = default; + Optional testNetworkId = default; + Optional targetCpuCores = default; + Optional isDynamicRam = default; + Optional dynamicMemoryConfig = default; + Optional targetMemoryInMegaBytes = default; + Optional osType = default; + Optional osName = default; + Optional firmwareType = default; + ResourceIdentifier fabricDiscoveryMachineId = default; + Optional sourceVmName = default; + Optional sourceCpuCores = default; + Optional sourceMemoryInMegaBytes = default; + string runAsAccountId = default; + string sourceDraName = default; + string targetDraName = default; + Optional sourceApplianceName = default; + Optional targetApplianceName = default; + Optional failoverRecoveryPointId = default; + Optional lastRecoveryPointReceived = default; + Optional lastRecoveryPointId = default; + Optional initialReplicationProgressPercentage = default; + Optional migrationProgressPercentage = default; + Optional resumeProgressPercentage = default; + Optional resyncProgressPercentage = default; + Optional resyncRetryCount = default; + Optional resyncRequired = default; + Optional resyncState = default; + Optional performAutoResync = default; + Optional resumeRetryCount = default; + Optional lastReplicationUpdateTime = default; + string instanceType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("activeLocation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + activeLocation = new ProtectedItemActiveLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("targetHciClusterId"u8)) + { + targetHciClusterId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("targetArcClusterCustomLocationId"u8)) + { + targetArcClusterCustomLocationId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("targetAzStackHciClusterName"u8)) + { + targetAzStackHciClusterName = property.Value.GetString(); + continue; + } + if (property.NameEquals("storageContainerId"u8)) + { + storageContainerId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("targetResourceGroupId"u8)) + { + targetResourceGroupId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("targetLocation"u8)) + { + targetLocation = property.Value.GetString(); + continue; + } + if (property.NameEquals("customLocationRegion"u8)) + { + customLocationRegion = property.Value.GetString(); + continue; + } + if (property.NameEquals("disksToInclude"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(VMwareToAzStackHciDiskInput.DeserializeVMwareToAzStackHciDiskInput(item)); + } + disksToInclude = array; + continue; + } + if (property.NameEquals("nicsToInclude"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(VMwareToAzStackHciNicInput.DeserializeVMwareToAzStackHciNicInput(item)); + } + nicsToInclude = array; + continue; + } + if (property.NameEquals("protectedDisks"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(VMwareToAzStackHciProtectedDiskProperties.DeserializeVMwareToAzStackHciProtectedDiskProperties(item)); + } + protectedDisks = array; + continue; + } + if (property.NameEquals("protectedNics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(VMwareToAzStackHciProtectedNicProperties.DeserializeVMwareToAzStackHciProtectedNicProperties(item)); + } + protectedNics = array; + continue; + } + if (property.NameEquals("targetVmBiosId"u8)) + { + targetVmBiosId = property.Value.GetString(); + continue; + } + if (property.NameEquals("targetVmName"u8)) + { + targetVmName = property.Value.GetString(); + continue; + } + if (property.NameEquals("hyperVGeneration"u8)) + { + hyperVGeneration = property.Value.GetString(); + continue; + } + if (property.NameEquals("targetNetworkId"u8)) + { + targetNetworkId = property.Value.GetString(); + continue; + } + if (property.NameEquals("testNetworkId"u8)) + { + testNetworkId = property.Value.GetString(); + continue; + } + if (property.NameEquals("targetCpuCores"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + targetCpuCores = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("isDynamicRam"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isDynamicRam = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("dynamicMemoryConfig"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dynamicMemoryConfig = ProtectedItemDynamicMemoryConfig.DeserializeProtectedItemDynamicMemoryConfig(property.Value); + continue; + } + if (property.NameEquals("targetMemoryInMegaBytes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + targetMemoryInMegaBytes = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("osType"u8)) + { + osType = property.Value.GetString(); + continue; + } + if (property.NameEquals("osName"u8)) + { + osName = property.Value.GetString(); + continue; + } + if (property.NameEquals("firmwareType"u8)) + { + firmwareType = property.Value.GetString(); + continue; + } + if (property.NameEquals("fabricDiscoveryMachineId"u8)) + { + fabricDiscoveryMachineId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("sourceVmName"u8)) + { + sourceVmName = property.Value.GetString(); + continue; + } + if (property.NameEquals("sourceCpuCores"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sourceCpuCores = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("sourceMemoryInMegaBytes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sourceMemoryInMegaBytes = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("runAsAccountId"u8)) + { + runAsAccountId = property.Value.GetString(); + continue; + } + if (property.NameEquals("sourceDraName"u8)) + { + sourceDraName = property.Value.GetString(); + continue; + } + if (property.NameEquals("targetDraName"u8)) + { + targetDraName = property.Value.GetString(); + continue; + } + if (property.NameEquals("sourceApplianceName"u8)) + { + sourceApplianceName = property.Value.GetString(); + continue; + } + if (property.NameEquals("targetApplianceName"u8)) + { + targetApplianceName = property.Value.GetString(); + continue; + } + if (property.NameEquals("failoverRecoveryPointId"u8)) + { + failoverRecoveryPointId = property.Value.GetString(); + continue; + } + if (property.NameEquals("lastRecoveryPointReceived"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastRecoveryPointReceived = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastRecoveryPointId"u8)) + { + lastRecoveryPointId = property.Value.GetString(); + continue; + } + if (property.NameEquals("initialReplicationProgressPercentage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + initialReplicationProgressPercentage = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("migrationProgressPercentage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + migrationProgressPercentage = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("resumeProgressPercentage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resumeProgressPercentage = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("resyncProgressPercentage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resyncProgressPercentage = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("resyncRetryCount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resyncRetryCount = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("resyncRequired"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resyncRequired = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("resyncState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resyncState = new VMwareToAzureMigrateResyncState(property.Value.GetString()); + continue; + } + if (property.NameEquals("performAutoResync"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + performAutoResync = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("resumeRetryCount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resumeRetryCount = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("lastReplicationUpdateTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastReplicationUpdateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("instanceType"u8)) + { + instanceType = property.Value.GetString(); + continue; + } + } + return new VMwareToAzStackHciProtectedItemModelCustomProperties(instanceType, Optional.ToNullable(activeLocation), targetHciClusterId, targetArcClusterCustomLocationId, targetAzStackHciClusterName.Value, storageContainerId, targetResourceGroupId, targetLocation.Value, customLocationRegion, disksToInclude, nicsToInclude, Optional.ToList(protectedDisks), Optional.ToList(protectedNics), targetVmBiosId.Value, targetVmName.Value, hyperVGeneration, targetNetworkId.Value, testNetworkId.Value, Optional.ToNullable(targetCpuCores), Optional.ToNullable(isDynamicRam), dynamicMemoryConfig.Value, Optional.ToNullable(targetMemoryInMegaBytes), osType.Value, osName.Value, firmwareType.Value, fabricDiscoveryMachineId, sourceVmName.Value, Optional.ToNullable(sourceCpuCores), Optional.ToNullable(sourceMemoryInMegaBytes), runAsAccountId, sourceDraName, targetDraName, sourceApplianceName.Value, targetApplianceName.Value, failoverRecoveryPointId.Value, Optional.ToNullable(lastRecoveryPointReceived), lastRecoveryPointId.Value, Optional.ToNullable(initialReplicationProgressPercentage), Optional.ToNullable(migrationProgressPercentage), Optional.ToNullable(resumeProgressPercentage), Optional.ToNullable(resyncProgressPercentage), Optional.ToNullable(resyncRetryCount), Optional.ToNullable(resyncRequired), Optional.ToNullable(resyncState), Optional.ToNullable(performAutoResync), Optional.ToNullable(resumeRetryCount), Optional.ToNullable(lastReplicationUpdateTime)); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciProtectedItemModelCustomProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciProtectedItemModelCustomProperties.cs new file mode 100644 index 000000000000..caa97b6ef3d8 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciProtectedItemModelCustomProperties.cs @@ -0,0 +1,268 @@ +// 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.RecoveryServicesDataReplication.Models +{ + /// VMware to AzStackHCI Protected item model custom properties. + public partial class VMwareToAzStackHciProtectedItemModelCustomProperties : ProtectedItemModelCustomProperties + { + /// Initializes a new instance of VMwareToAzStackHciProtectedItemModelCustomProperties. + /// Gets or sets the Target HCI Cluster ARM Id. + /// Gets or sets the Target Arc Cluster Custom Location ARM Id. + /// Gets or sets the target storage container ARM Id. + /// Gets or sets the target resource group ARM Id. + /// Gets or sets the location of Azure Arc HCI custom location resource. + /// Gets or sets the list of disks to replicate. + /// Gets or sets the list of VM NIC to replicate. + /// Gets or sets the hypervisor generation of the virtual machine possible values are 1,2. + /// Gets or sets the ARM Id of the discovered machine. + /// Gets or sets the run as account Id. + /// Gets or sets the source DRA name. + /// Gets or sets the target DRA name. + /// , , , , , , , , , , or is null. + public VMwareToAzStackHciProtectedItemModelCustomProperties(ResourceIdentifier targetHciClusterId, ResourceIdentifier targetArcClusterCustomLocationId, ResourceIdentifier storageContainerId, ResourceIdentifier targetResourceGroupId, string customLocationRegion, IEnumerable disksToInclude, IEnumerable nicsToInclude, string hyperVGeneration, ResourceIdentifier fabricDiscoveryMachineId, string runAsAccountId, string sourceDraName, string targetDraName) + { + Argument.AssertNotNull(targetHciClusterId, nameof(targetHciClusterId)); + Argument.AssertNotNull(targetArcClusterCustomLocationId, nameof(targetArcClusterCustomLocationId)); + Argument.AssertNotNull(storageContainerId, nameof(storageContainerId)); + Argument.AssertNotNull(targetResourceGroupId, nameof(targetResourceGroupId)); + Argument.AssertNotNull(customLocationRegion, nameof(customLocationRegion)); + Argument.AssertNotNull(disksToInclude, nameof(disksToInclude)); + Argument.AssertNotNull(nicsToInclude, nameof(nicsToInclude)); + Argument.AssertNotNull(hyperVGeneration, nameof(hyperVGeneration)); + Argument.AssertNotNull(fabricDiscoveryMachineId, nameof(fabricDiscoveryMachineId)); + Argument.AssertNotNull(runAsAccountId, nameof(runAsAccountId)); + Argument.AssertNotNull(sourceDraName, nameof(sourceDraName)); + Argument.AssertNotNull(targetDraName, nameof(targetDraName)); + + TargetHciClusterId = targetHciClusterId; + TargetArcClusterCustomLocationId = targetArcClusterCustomLocationId; + StorageContainerId = storageContainerId; + TargetResourceGroupId = targetResourceGroupId; + CustomLocationRegion = customLocationRegion; + DisksToInclude = disksToInclude.ToList(); + NicsToInclude = nicsToInclude.ToList(); + ProtectedDisks = new ChangeTrackingList(); + ProtectedNics = new ChangeTrackingList(); + HyperVGeneration = hyperVGeneration; + FabricDiscoveryMachineId = fabricDiscoveryMachineId; + RunAsAccountId = runAsAccountId; + SourceDraName = sourceDraName; + TargetDraName = targetDraName; + InstanceType = "VMwareToAzStackHCI"; + } + + /// Initializes a new instance of VMwareToAzStackHciProtectedItemModelCustomProperties. + /// Gets or sets the instance type. + /// Gets or sets the location of the protected item. + /// Gets or sets the Target HCI Cluster ARM Id. + /// Gets or sets the Target Arc Cluster Custom Location ARM Id. + /// Gets or sets the Target AzStackHCI cluster name. + /// Gets or sets the target storage container ARM Id. + /// Gets or sets the target resource group ARM Id. + /// Gets or sets the target location. + /// Gets or sets the location of Azure Arc HCI custom location resource. + /// Gets or sets the list of disks to replicate. + /// Gets or sets the list of VM NIC to replicate. + /// Gets or sets the list of protected disks. + /// Gets or sets the VM NIC details. + /// Gets or sets the BIOS Id of the target AzStackHCI VM. + /// Gets or sets the target VM display name. + /// Gets or sets the hypervisor generation of the virtual machine possible values are 1,2. + /// Gets or sets the target network Id within AzStackHCI Cluster. + /// Gets or sets the target test network Id within AzStackHCI Cluster. + /// Gets or sets the target CPU cores. + /// Gets or sets a value indicating whether memory is dynamical. + /// Protected item dynamic memory config. + /// Gets or sets the target memory in mega-bytes. + /// Gets or sets the type of the OS. + /// Gets or sets the name of the OS. + /// Gets or sets the firmware type. + /// Gets or sets the ARM Id of the discovered machine. + /// Gets or sets the source VM display name. + /// Gets or sets the source VM CPU cores. + /// Gets or sets the source VM ram memory size in megabytes. + /// Gets or sets the run as account Id. + /// Gets or sets the source DRA name. + /// Gets or sets the target DRA name. + /// Gets or sets the source appliance name. + /// Gets or sets the target appliance name. + /// Gets or sets the recovery point Id to which the VM was failed over. + /// Gets or sets the last recovery point received time. + /// Gets or sets the last recovery point Id. + /// + /// Gets or sets the initial replication progress percentage. This is calculated based on + /// total bytes processed for all disks in the source VM. + /// + /// Gets or sets the migration progress percentage. + /// Gets or sets the resume progress percentage. + /// + /// Gets or sets the resync progress percentage. This is calculated based on total bytes + /// processed for all disks in the source VM. + /// + /// Gets or sets the resync retry count. + /// Gets or sets a value indicating whether resync is required. + /// Gets or sets the resync state. + /// Gets or sets a value indicating whether auto resync is to be done. + /// Gets or sets the resume retry count. + /// Gets or sets the latest timestamp that replication status is updated. + internal VMwareToAzStackHciProtectedItemModelCustomProperties(string instanceType, ProtectedItemActiveLocation? activeLocation, ResourceIdentifier targetHciClusterId, ResourceIdentifier targetArcClusterCustomLocationId, string targetAzStackHciClusterName, ResourceIdentifier storageContainerId, ResourceIdentifier targetResourceGroupId, string targetLocation, string customLocationRegion, IList disksToInclude, IList nicsToInclude, IReadOnlyList protectedDisks, IReadOnlyList protectedNics, string targetVmBiosId, string targetVmName, string hyperVGeneration, string targetNetworkId, string testNetworkId, int? targetCpuCores, bool? isDynamicRam, ProtectedItemDynamicMemoryConfig dynamicMemoryConfig, int? targetMemoryInMegaBytes, string osType, string osName, string firmwareType, ResourceIdentifier fabricDiscoveryMachineId, string sourceVmName, int? sourceCpuCores, double? sourceMemoryInMegaBytes, string runAsAccountId, string sourceDraName, string targetDraName, string sourceApplianceName, string targetApplianceName, string failoverRecoveryPointId, DateTimeOffset? lastRecoveryPointReceived, string lastRecoveryPointId, int? initialReplicationProgressPercentage, int? migrationProgressPercentage, int? resumeProgressPercentage, int? resyncProgressPercentage, long? resyncRetryCount, bool? resyncRequired, VMwareToAzureMigrateResyncState? resyncState, bool? performAutoResync, long? resumeRetryCount, DateTimeOffset? lastReplicationUpdateOn) : base(instanceType) + { + ActiveLocation = activeLocation; + TargetHciClusterId = targetHciClusterId; + TargetArcClusterCustomLocationId = targetArcClusterCustomLocationId; + TargetAzStackHciClusterName = targetAzStackHciClusterName; + StorageContainerId = storageContainerId; + TargetResourceGroupId = targetResourceGroupId; + TargetLocation = targetLocation; + CustomLocationRegion = customLocationRegion; + DisksToInclude = disksToInclude; + NicsToInclude = nicsToInclude; + ProtectedDisks = protectedDisks; + ProtectedNics = protectedNics; + TargetVmBiosId = targetVmBiosId; + TargetVmName = targetVmName; + HyperVGeneration = hyperVGeneration; + TargetNetworkId = targetNetworkId; + TestNetworkId = testNetworkId; + TargetCpuCores = targetCpuCores; + IsDynamicRam = isDynamicRam; + DynamicMemoryConfig = dynamicMemoryConfig; + TargetMemoryInMegaBytes = targetMemoryInMegaBytes; + OSType = osType; + OSName = osName; + FirmwareType = firmwareType; + FabricDiscoveryMachineId = fabricDiscoveryMachineId; + SourceVmName = sourceVmName; + SourceCpuCores = sourceCpuCores; + SourceMemoryInMegaBytes = sourceMemoryInMegaBytes; + RunAsAccountId = runAsAccountId; + SourceDraName = sourceDraName; + TargetDraName = targetDraName; + SourceApplianceName = sourceApplianceName; + TargetApplianceName = targetApplianceName; + FailoverRecoveryPointId = failoverRecoveryPointId; + LastRecoveryPointReceived = lastRecoveryPointReceived; + LastRecoveryPointId = lastRecoveryPointId; + InitialReplicationProgressPercentage = initialReplicationProgressPercentage; + MigrationProgressPercentage = migrationProgressPercentage; + ResumeProgressPercentage = resumeProgressPercentage; + ResyncProgressPercentage = resyncProgressPercentage; + ResyncRetryCount = resyncRetryCount; + ResyncRequired = resyncRequired; + ResyncState = resyncState; + PerformAutoResync = performAutoResync; + ResumeRetryCount = resumeRetryCount; + LastReplicationUpdateOn = lastReplicationUpdateOn; + InstanceType = instanceType ?? "VMwareToAzStackHCI"; + } + + /// Gets or sets the location of the protected item. + public ProtectedItemActiveLocation? ActiveLocation { get; } + /// Gets or sets the Target HCI Cluster ARM Id. + public ResourceIdentifier TargetHciClusterId { get; set; } + /// Gets or sets the Target Arc Cluster Custom Location ARM Id. + public ResourceIdentifier TargetArcClusterCustomLocationId { get; set; } + /// Gets or sets the Target AzStackHCI cluster name. + public string TargetAzStackHciClusterName { get; } + /// Gets or sets the target storage container ARM Id. + public ResourceIdentifier StorageContainerId { get; set; } + /// Gets or sets the target resource group ARM Id. + public ResourceIdentifier TargetResourceGroupId { get; set; } + /// Gets or sets the target location. + public string TargetLocation { get; } + /// Gets or sets the location of Azure Arc HCI custom location resource. + public string CustomLocationRegion { get; set; } + /// Gets or sets the list of disks to replicate. + public IList DisksToInclude { get; } + /// Gets or sets the list of VM NIC to replicate. + public IList NicsToInclude { get; } + /// Gets or sets the list of protected disks. + public IReadOnlyList ProtectedDisks { get; } + /// Gets or sets the VM NIC details. + public IReadOnlyList ProtectedNics { get; } + /// Gets or sets the BIOS Id of the target AzStackHCI VM. + public string TargetVmBiosId { get; } + /// Gets or sets the target VM display name. + public string TargetVmName { get; set; } + /// Gets or sets the hypervisor generation of the virtual machine possible values are 1,2. + public string HyperVGeneration { get; set; } + /// Gets or sets the target network Id within AzStackHCI Cluster. + public string TargetNetworkId { get; set; } + /// Gets or sets the target test network Id within AzStackHCI Cluster. + public string TestNetworkId { get; set; } + /// Gets or sets the target CPU cores. + public int? TargetCpuCores { get; set; } + /// Gets or sets a value indicating whether memory is dynamical. + public bool? IsDynamicRam { get; set; } + /// Protected item dynamic memory config. + public ProtectedItemDynamicMemoryConfig DynamicMemoryConfig { get; set; } + /// Gets or sets the target memory in mega-bytes. + public int? TargetMemoryInMegaBytes { get; set; } + /// Gets or sets the type of the OS. + public string OSType { get; } + /// Gets or sets the name of the OS. + public string OSName { get; } + /// Gets or sets the firmware type. + public string FirmwareType { get; } + /// Gets or sets the ARM Id of the discovered machine. + public ResourceIdentifier FabricDiscoveryMachineId { get; set; } + /// Gets or sets the source VM display name. + public string SourceVmName { get; } + /// Gets or sets the source VM CPU cores. + public int? SourceCpuCores { get; } + /// Gets or sets the source VM ram memory size in megabytes. + public double? SourceMemoryInMegaBytes { get; } + /// Gets or sets the run as account Id. + public string RunAsAccountId { get; set; } + /// Gets or sets the source DRA name. + public string SourceDraName { get; set; } + /// Gets or sets the target DRA name. + public string TargetDraName { get; set; } + /// Gets or sets the source appliance name. + public string SourceApplianceName { get; } + /// Gets or sets the target appliance name. + public string TargetApplianceName { get; } + /// Gets or sets the recovery point Id to which the VM was failed over. + public string FailoverRecoveryPointId { get; } + /// Gets or sets the last recovery point received time. + public DateTimeOffset? LastRecoveryPointReceived { get; } + /// Gets or sets the last recovery point Id. + public string LastRecoveryPointId { get; } + /// + /// Gets or sets the initial replication progress percentage. This is calculated based on + /// total bytes processed for all disks in the source VM. + /// + public int? InitialReplicationProgressPercentage { get; } + /// Gets or sets the migration progress percentage. + public int? MigrationProgressPercentage { get; } + /// Gets or sets the resume progress percentage. + public int? ResumeProgressPercentage { get; } + /// + /// Gets or sets the resync progress percentage. This is calculated based on total bytes + /// processed for all disks in the source VM. + /// + public int? ResyncProgressPercentage { get; } + /// Gets or sets the resync retry count. + public long? ResyncRetryCount { get; } + /// Gets or sets a value indicating whether resync is required. + public bool? ResyncRequired { get; } + /// Gets or sets the resync state. + public VMwareToAzureMigrateResyncState? ResyncState { get; } + /// Gets or sets a value indicating whether auto resync is to be done. + public bool? PerformAutoResync { get; set; } + /// Gets or sets the resume retry count. + public long? ResumeRetryCount { get; } + /// Gets or sets the latest timestamp that replication status is updated. + public DateTimeOffset? LastReplicationUpdateOn { get; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciProtectedNicProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciProtectedNicProperties.Serialization.cs new file mode 100644 index 000000000000..78904debb7e0 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciProtectedNicProperties.Serialization.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + public partial class VMwareToAzStackHciProtectedNicProperties + { + internal static VMwareToAzStackHciProtectedNicProperties DeserializeVMwareToAzStackHciProtectedNicProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional nicId = default; + Optional macAddress = default; + Optional label = default; + Optional isPrimaryNic = default; + Optional networkName = default; + Optional targetNetworkId = default; + Optional testNetworkId = default; + Optional selectionTypeForFailover = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("nicId"u8)) + { + nicId = property.Value.GetString(); + continue; + } + if (property.NameEquals("macAddress"u8)) + { + macAddress = property.Value.GetString(); + continue; + } + if (property.NameEquals("label"u8)) + { + label = property.Value.GetString(); + continue; + } + if (property.NameEquals("isPrimaryNic"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isPrimaryNic = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("networkName"u8)) + { + networkName = property.Value.GetString(); + continue; + } + if (property.NameEquals("targetNetworkId"u8)) + { + targetNetworkId = property.Value.GetString(); + continue; + } + if (property.NameEquals("testNetworkId"u8)) + { + testNetworkId = property.Value.GetString(); + continue; + } + if (property.NameEquals("selectionTypeForFailover"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + selectionTypeForFailover = new VmNicSelection(property.Value.GetString()); + continue; + } + } + return new VMwareToAzStackHciProtectedNicProperties(nicId.Value, macAddress.Value, label.Value, Optional.ToNullable(isPrimaryNic), networkName.Value, targetNetworkId.Value, testNetworkId.Value, Optional.ToNullable(selectionTypeForFailover)); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciProtectedNicProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciProtectedNicProperties.cs new file mode 100644 index 000000000000..5f15e24f3ec2 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciProtectedNicProperties.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// VMwareToAzStackHCI NIC properties. + public partial class VMwareToAzStackHciProtectedNicProperties + { + /// Initializes a new instance of VMwareToAzStackHciProtectedNicProperties. + internal VMwareToAzStackHciProtectedNicProperties() + { + } + + /// Initializes a new instance of VMwareToAzStackHciProtectedNicProperties. + /// Gets or sets the NIC Id. + /// Gets or sets the NIC mac address. + /// Gets or sets the NIC label. + /// Gets or sets a value indicating whether this is the primary NIC. + /// Gets or sets the network name. + /// Gets or sets the target network Id within AzStackHCI Cluster. + /// Gets or sets the target test network Id within AzStackHCI Cluster. + /// Gets or sets the selection type of the NIC. + internal VMwareToAzStackHciProtectedNicProperties(string nicId, string macAddress, string label, bool? isPrimaryNic, string networkName, string targetNetworkId, string testNetworkId, VmNicSelection? selectionTypeForFailover) + { + NicId = nicId; + MacAddress = macAddress; + Label = label; + IsPrimaryNic = isPrimaryNic; + NetworkName = networkName; + TargetNetworkId = targetNetworkId; + TestNetworkId = testNetworkId; + SelectionTypeForFailover = selectionTypeForFailover; + } + + /// Gets or sets the NIC Id. + public string NicId { get; } + /// Gets or sets the NIC mac address. + public string MacAddress { get; } + /// Gets or sets the NIC label. + public string Label { get; } + /// Gets or sets a value indicating whether this is the primary NIC. + public bool? IsPrimaryNic { get; } + /// Gets or sets the network name. + public string NetworkName { get; } + /// Gets or sets the target network Id within AzStackHCI Cluster. + public string TargetNetworkId { get; } + /// Gets or sets the target test network Id within AzStackHCI Cluster. + public string TestNetworkId { get; } + /// Gets or sets the selection type of the NIC. + public VmNicSelection? SelectionTypeForFailover { get; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciReplicationExtensionModelCustomProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciReplicationExtensionModelCustomProperties.Serialization.cs new file mode 100644 index 000000000000..574155f2bbbe --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciReplicationExtensionModelCustomProperties.Serialization.cs @@ -0,0 +1,176 @@ +// 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.RecoveryServicesDataReplication.Models +{ + public partial class VMwareToAzStackHciReplicationExtensionModelCustomProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("vmwareFabricArmId"u8); + writer.WriteStringValue(VmwareFabricArmId); + writer.WritePropertyName("azStackHciFabricArmId"u8); + writer.WriteStringValue(AzStackHciFabricArmId); + if (Optional.IsDefined(StorageAccountId)) + { + writer.WritePropertyName("storageAccountId"u8); + writer.WriteStringValue(StorageAccountId); + } + if (Optional.IsDefined(StorageAccountSasSecretName)) + { + writer.WritePropertyName("storageAccountSasSecretName"u8); + writer.WriteStringValue(StorageAccountSasSecretName); + } + writer.WritePropertyName("instanceType"u8); + writer.WriteStringValue(InstanceType); + writer.WriteEndObject(); + } + + internal static VMwareToAzStackHciReplicationExtensionModelCustomProperties DeserializeVMwareToAzStackHciReplicationExtensionModelCustomProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier vmwareFabricArmId = default; + Optional vmwareSiteId = default; + ResourceIdentifier azStackHciFabricArmId = default; + Optional azStackHciSiteId = default; + Optional storageAccountId = default; + Optional storageAccountSasSecretName = default; + Optional asrServiceUri = default; + Optional rcmServiceUri = default; + Optional gatewayServiceUri = default; + Optional sourceGatewayServiceId = default; + Optional targetGatewayServiceId = default; + Optional sourceStorageContainerName = default; + Optional targetStorageContainerName = default; + Optional resourceLocation = default; + Optional subscriptionId = default; + Optional resourceGroup = default; + string instanceType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("vmwareFabricArmId"u8)) + { + vmwareFabricArmId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("vmwareSiteId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + vmwareSiteId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("azStackHciFabricArmId"u8)) + { + azStackHciFabricArmId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("azStackHciSiteId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + azStackHciSiteId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("storageAccountId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + storageAccountId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("storageAccountSasSecretName"u8)) + { + storageAccountSasSecretName = property.Value.GetString(); + continue; + } + if (property.NameEquals("asrServiceUri"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + asrServiceUri = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("rcmServiceUri"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + rcmServiceUri = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("gatewayServiceUri"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + gatewayServiceUri = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("sourceGatewayServiceId"u8)) + { + sourceGatewayServiceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("targetGatewayServiceId"u8)) + { + targetGatewayServiceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("sourceStorageContainerName"u8)) + { + sourceStorageContainerName = property.Value.GetString(); + continue; + } + if (property.NameEquals("targetStorageContainerName"u8)) + { + targetStorageContainerName = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceLocation"u8)) + { + resourceLocation = property.Value.GetString(); + continue; + } + if (property.NameEquals("subscriptionId"u8)) + { + subscriptionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceGroup"u8)) + { + resourceGroup = property.Value.GetString(); + continue; + } + if (property.NameEquals("instanceType"u8)) + { + instanceType = property.Value.GetString(); + continue; + } + } + return new VMwareToAzStackHciReplicationExtensionModelCustomProperties(instanceType, vmwareFabricArmId, vmwareSiteId.Value, azStackHciFabricArmId, azStackHciSiteId.Value, storageAccountId.Value, storageAccountSasSecretName.Value, asrServiceUri.Value, rcmServiceUri.Value, gatewayServiceUri.Value, sourceGatewayServiceId.Value, targetGatewayServiceId.Value, sourceStorageContainerName.Value, targetStorageContainerName.Value, resourceLocation.Value, subscriptionId.Value, resourceGroup.Value); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciReplicationExtensionModelCustomProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciReplicationExtensionModelCustomProperties.cs new file mode 100644 index 000000000000..53db8f1821ba --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzStackHciReplicationExtensionModelCustomProperties.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// VMware to AzStackHCI Replication extension model custom properties. + public partial class VMwareToAzStackHciReplicationExtensionModelCustomProperties : ReplicationExtensionModelCustomProperties + { + /// Initializes a new instance of VMwareToAzStackHciReplicationExtensionModelCustomProperties. + /// Gets or sets the ARM Id of the source VMware fabric. + /// Gets or sets the ARM Id of the target AzStackHCI fabric. + /// or is null. + public VMwareToAzStackHciReplicationExtensionModelCustomProperties(ResourceIdentifier vmwareFabricArmId, ResourceIdentifier azStackHciFabricArmId) + { + Argument.AssertNotNull(vmwareFabricArmId, nameof(vmwareFabricArmId)); + Argument.AssertNotNull(azStackHciFabricArmId, nameof(azStackHciFabricArmId)); + + VmwareFabricArmId = vmwareFabricArmId; + AzStackHciFabricArmId = azStackHciFabricArmId; + InstanceType = "VMwareToAzStackHCI"; + } + + /// Initializes a new instance of VMwareToAzStackHciReplicationExtensionModelCustomProperties. + /// Gets or sets the instance type. + /// Gets or sets the ARM Id of the source VMware fabric. + /// Gets or sets the ARM Id of the VMware site. + /// Gets or sets the ARM Id of the target AzStackHCI fabric. + /// Gets or sets the ARM Id of the AzStackHCI site. + /// Gets or sets the storage account Id. + /// Gets or sets the Sas Secret of storage account. + /// Gets or sets the Uri of ASR. + /// Gets or sets the Uri of Rcm. + /// Gets or sets the Uri of Gateway. + /// Gets or sets the gateway service Id of source. + /// Gets or sets the gateway service Id of target. + /// Gets or sets the source storage container name. + /// Gets or sets the target storage container name. + /// Gets or sets the resource location. + /// Gets or sets the subscription. + /// Gets or sets the resource group. + internal VMwareToAzStackHciReplicationExtensionModelCustomProperties(string instanceType, ResourceIdentifier vmwareFabricArmId, ResourceIdentifier vmwareSiteId, ResourceIdentifier azStackHciFabricArmId, ResourceIdentifier azStackHciSiteId, ResourceIdentifier storageAccountId, string storageAccountSasSecretName, Uri asrServiceUri, Uri rcmServiceUri, Uri gatewayServiceUri, string sourceGatewayServiceId, string targetGatewayServiceId, string sourceStorageContainerName, string targetStorageContainerName, string resourceLocation, string subscriptionId, string resourceGroup) : base(instanceType) + { + VmwareFabricArmId = vmwareFabricArmId; + VmwareSiteId = vmwareSiteId; + AzStackHciFabricArmId = azStackHciFabricArmId; + AzStackHciSiteId = azStackHciSiteId; + StorageAccountId = storageAccountId; + StorageAccountSasSecretName = storageAccountSasSecretName; + AsrServiceUri = asrServiceUri; + RcmServiceUri = rcmServiceUri; + GatewayServiceUri = gatewayServiceUri; + SourceGatewayServiceId = sourceGatewayServiceId; + TargetGatewayServiceId = targetGatewayServiceId; + SourceStorageContainerName = sourceStorageContainerName; + TargetStorageContainerName = targetStorageContainerName; + ResourceLocation = resourceLocation; + SubscriptionId = subscriptionId; + ResourceGroup = resourceGroup; + InstanceType = instanceType ?? "VMwareToAzStackHCI"; + } + + /// Gets or sets the ARM Id of the source VMware fabric. + public ResourceIdentifier VmwareFabricArmId { get; set; } + /// Gets or sets the ARM Id of the VMware site. + public ResourceIdentifier VmwareSiteId { get; } + /// Gets or sets the ARM Id of the target AzStackHCI fabric. + public ResourceIdentifier AzStackHciFabricArmId { get; set; } + /// Gets or sets the ARM Id of the AzStackHCI site. + public ResourceIdentifier AzStackHciSiteId { get; } + /// Gets or sets the storage account Id. + public ResourceIdentifier StorageAccountId { get; set; } + /// Gets or sets the Sas Secret of storage account. + public string StorageAccountSasSecretName { get; set; } + /// Gets or sets the Uri of ASR. + public Uri AsrServiceUri { get; } + /// Gets or sets the Uri of Rcm. + public Uri RcmServiceUri { get; } + /// Gets or sets the Uri of Gateway. + public Uri GatewayServiceUri { get; } + /// Gets or sets the gateway service Id of source. + public string SourceGatewayServiceId { get; } + /// Gets or sets the gateway service Id of target. + public string TargetGatewayServiceId { get; } + /// Gets or sets the source storage container name. + public string SourceStorageContainerName { get; } + /// Gets or sets the target storage container name. + public string TargetStorageContainerName { get; } + /// Gets or sets the resource location. + public string ResourceLocation { get; } + /// Gets or sets the subscription. + public string SubscriptionId { get; } + /// Gets or sets the resource group. + public string ResourceGroup { get; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzureMigrateResyncState.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzureMigrateResyncState.cs new file mode 100644 index 000000000000..54d3f759b819 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VMwareToAzureMigrateResyncState.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.RecoveryServicesDataReplication.Models +{ + /// Gets or sets the resync state. + public readonly partial struct VMwareToAzureMigrateResyncState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public VMwareToAzureMigrateResyncState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NoneValue = "None"; + private const string PreparedForResynchronizationValue = "PreparedForResynchronization"; + private const string StartedResynchronizationValue = "StartedResynchronization"; + + /// None. + public static VMwareToAzureMigrateResyncState None { get; } = new VMwareToAzureMigrateResyncState(NoneValue); + /// PreparedForResynchronization. + public static VMwareToAzureMigrateResyncState PreparedForResynchronization { get; } = new VMwareToAzureMigrateResyncState(PreparedForResynchronizationValue); + /// StartedResynchronization. + public static VMwareToAzureMigrateResyncState StartedResynchronization { get; } = new VMwareToAzureMigrateResyncState(StartedResynchronizationValue); + /// Determines if two values are the same. + public static bool operator ==(VMwareToAzureMigrateResyncState left, VMwareToAzureMigrateResyncState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(VMwareToAzureMigrateResyncState left, VMwareToAzureMigrateResyncState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator VMwareToAzureMigrateResyncState(string value) => new VMwareToAzureMigrateResyncState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is VMwareToAzureMigrateResyncState other && Equals(other); + /// + public bool Equals(VMwareToAzureMigrateResyncState 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/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VmNicSelection.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VmNicSelection.cs new file mode 100644 index 000000000000..bd1b19800bb9 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/VmNicSelection.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// Gets or sets the selection type of the NIC. + public readonly partial struct VmNicSelection : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public VmNicSelection(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NotSelectedValue = "NotSelected"; + private const string SelectedByUserValue = "SelectedByUser"; + private const string SelectedByDefaultValue = "SelectedByDefault"; + private const string SelectedByUserOverrideValue = "SelectedByUserOverride"; + + /// NotSelected. + public static VmNicSelection NotSelected { get; } = new VmNicSelection(NotSelectedValue); + /// SelectedByUser. + public static VmNicSelection SelectedByUser { get; } = new VmNicSelection(SelectedByUserValue); + /// SelectedByDefault. + public static VmNicSelection SelectedByDefault { get; } = new VmNicSelection(SelectedByDefaultValue); + /// SelectedByUserOverride. + public static VmNicSelection SelectedByUserOverride { get; } = new VmNicSelection(SelectedByUserOverrideValue); + /// Determines if two values are the same. + public static bool operator ==(VmNicSelection left, VmNicSelection right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(VmNicSelection left, VmNicSelection right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator VmNicSelection(string value) => new VmNicSelection(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is VmNicSelection other && Equals(other); + /// + public bool Equals(VmNicSelection 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/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/WorkflowModelCustomProperties.Serialization.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/WorkflowModelCustomProperties.Serialization.cs new file mode 100644 index 000000000000..1b5de0e37f25 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/WorkflowModelCustomProperties.Serialization.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + public partial class WorkflowModelCustomProperties + { + internal static WorkflowModelCustomProperties DeserializeWorkflowModelCustomProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("instanceType", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "FailoverWorkflowDetails": return FailoverWorkflowModelCustomProperties.DeserializeFailoverWorkflowModelCustomProperties(element); + case "TestFailoverCleanupWorkflowDetails": return TestFailoverCleanupWorkflowModelCustomProperties.DeserializeTestFailoverCleanupWorkflowModelCustomProperties(element); + case "TestFailoverWorkflowDetails": return TestFailoverWorkflowModelCustomProperties.DeserializeTestFailoverWorkflowModelCustomProperties(element); + } + } + return UnknownWorkflowModelCustomProperties.DeserializeUnknownWorkflowModelCustomProperties(element); + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/WorkflowModelCustomProperties.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/WorkflowModelCustomProperties.cs new file mode 100644 index 000000000000..adbdaeb5e6ef --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/WorkflowModelCustomProperties.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.RecoveryServicesDataReplication.Models +{ + /// + /// Workflow model custom properties. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + public abstract partial class WorkflowModelCustomProperties + { + /// Initializes a new instance of WorkflowModelCustomProperties. + protected WorkflowModelCustomProperties() + { + AffectedObjectDetails = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of WorkflowModelCustomProperties. + /// Gets or sets the instance type. + /// Gets or sets any custom properties of the affected object. + internal WorkflowModelCustomProperties(string instanceType, IReadOnlyDictionary affectedObjectDetails) + { + InstanceType = instanceType; + AffectedObjectDetails = affectedObjectDetails; + } + + /// Gets or sets the instance type. + internal string InstanceType { get; set; } + /// Gets or sets any custom properties of the affected object. + public IReadOnlyDictionary AffectedObjectDetails { get; } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/WorkflowObjectType.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/WorkflowObjectType.cs new file mode 100644 index 000000000000..55e7de0adeb0 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Models/WorkflowObjectType.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Models +{ + /// Gets or sets the object type. + public readonly partial struct WorkflowObjectType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public WorkflowObjectType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AvsDiskPoolValue = "AvsDiskPool"; + private const string DraValue = "Dra"; + private const string FabricValue = "Fabric"; + private const string PolicyValue = "Policy"; + private const string ProtectedItemValue = "ProtectedItem"; + private const string RecoveryPlanValue = "RecoveryPlan"; + private const string ReplicationExtensionValue = "ReplicationExtension"; + private const string VaultValue = "Vault"; + + /// AvsDiskPool. + public static WorkflowObjectType AvsDiskPool { get; } = new WorkflowObjectType(AvsDiskPoolValue); + /// Dra. + public static WorkflowObjectType Dra { get; } = new WorkflowObjectType(DraValue); + /// Fabric. + public static WorkflowObjectType Fabric { get; } = new WorkflowObjectType(FabricValue); + /// Policy. + public static WorkflowObjectType Policy { get; } = new WorkflowObjectType(PolicyValue); + /// ProtectedItem. + public static WorkflowObjectType ProtectedItem { get; } = new WorkflowObjectType(ProtectedItemValue); + /// RecoveryPlan. + public static WorkflowObjectType RecoveryPlan { get; } = new WorkflowObjectType(RecoveryPlanValue); + /// ReplicationExtension. + public static WorkflowObjectType ReplicationExtension { get; } = new WorkflowObjectType(ReplicationExtensionValue); + /// Vault. + public static WorkflowObjectType Vault { get; } = new WorkflowObjectType(VaultValue); + /// Determines if two values are the same. + public static bool operator ==(WorkflowObjectType left, WorkflowObjectType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(WorkflowObjectType left, WorkflowObjectType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator WorkflowObjectType(string value) => new WorkflowObjectType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is WorkflowObjectType other && Equals(other); + /// + public bool Equals(WorkflowObjectType 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/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/ProviderConstants.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/ProviderConstants.cs new file mode 100644 index 000000000000..c468763062c9 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/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.RecoveryServicesDataReplication +{ + internal static class ProviderConstants + { + public static string DefaultProviderNamespace { get; } = ClientDiagnostics.GetResourceProviderNamespace(typeof(ProviderConstants).Assembly); + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/RestOperations/AzureSiteRecoveryManagementServiceAPIRestOperations.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/RestOperations/AzureSiteRecoveryManagementServiceAPIRestOperations.cs new file mode 100644 index 000000000000..89efcab0ff2f --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/RestOperations/AzureSiteRecoveryManagementServiceAPIRestOperations.cs @@ -0,0 +1,208 @@ +// 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.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication +{ + internal partial class AzureSiteRecoveryManagementServiceAPIRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of AzureSiteRecoveryManagementServiceAPIRestOperations. + /// 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 AzureSiteRecoveryManagementServiceAPIRestOperations(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 ?? "2021-02-16-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateCheckNameAvailabilityRequest(string subscriptionId, AzureLocation location, DataReplicationNameAvailabilityContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.DataReplication/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/checkNameAvailability", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + if (content != null) + { + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteObjectValue(content); + request.Content = content0; + } + _userAgent.Apply(message); + return message; + } + + /// Checks the resource name availability. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the Azure region. + /// Resource details. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> CheckNameAvailabilityAsync(string subscriptionId, AzureLocation location, DataReplicationNameAvailabilityContent content = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateCheckNameAvailabilityRequest(subscriptionId, location, content); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataReplicationNameAvailabilityResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataReplicationNameAvailabilityResult.DeserializeDataReplicationNameAvailabilityResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Checks the resource name availability. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the Azure region. + /// Resource details. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response CheckNameAvailability(string subscriptionId, AzureLocation location, DataReplicationNameAvailabilityContent content = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateCheckNameAvailabilityRequest(subscriptionId, location, content); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataReplicationNameAvailabilityResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataReplicationNameAvailabilityResult.DeserializeDataReplicationNameAvailabilityResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeploymentPreflightRequest(string subscriptionId, string resourceGroupName, string deploymentId, DeploymentPreflightModel body) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DataReplication/deployments/", false); + uri.AppendPath(deploymentId, true); + uri.AppendPath("/preflight", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + if (body != null) + { + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(body); + request.Content = content; + } + _userAgent.Apply(message); + return message; + } + + /// Performs resource deployment validation. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Deployment Id. + /// Deployment preflight model. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> DeploymentPreflightAsync(string subscriptionId, string resourceGroupName, string deploymentId, DeploymentPreflightModel body = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(deploymentId, nameof(deploymentId)); + + using var message = CreateDeploymentPreflightRequest(subscriptionId, resourceGroupName, deploymentId, body); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeploymentPreflightModel value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DeploymentPreflightModel.DeserializeDeploymentPreflightModel(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Performs resource deployment validation. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Deployment Id. + /// Deployment preflight model. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response DeploymentPreflight(string subscriptionId, string resourceGroupName, string deploymentId, DeploymentPreflightModel body = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(deploymentId, nameof(deploymentId)); + + using var message = CreateDeploymentPreflightRequest(subscriptionId, resourceGroupName, deploymentId, body); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeploymentPreflightModel value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DeploymentPreflightModel.DeserializeDeploymentPreflightModel(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/RestOperations/DraRestOperations.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/RestOperations/DraRestOperations.cs new file mode 100644 index 000000000000..f061ec779464 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/RestOperations/DraRestOperations.cs @@ -0,0 +1,443 @@ +// 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.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication +{ + internal partial class DraRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of DraRestOperations. + /// 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 DraRestOperations(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 ?? "2021-02-16-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string fabricName, string fabricAgentName) + { + 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.DataReplication/replicationFabrics/", false); + uri.AppendPath(fabricName, true); + uri.AppendPath("/fabricAgents/", false); + uri.AppendPath(fabricAgentName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details of the fabric agent. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The fabric name. + /// The fabric agent (Dra) name. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string fabricName, string fabricAgentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fabricName, nameof(fabricName)); + Argument.AssertNotNullOrEmpty(fabricAgentName, nameof(fabricAgentName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, fabricName, fabricAgentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataReplicationDraData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataReplicationDraData.DeserializeDataReplicationDraData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DataReplicationDraData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details of the fabric agent. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The fabric name. + /// The fabric agent (Dra) name. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string fabricName, string fabricAgentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fabricName, nameof(fabricName)); + Argument.AssertNotNullOrEmpty(fabricAgentName, nameof(fabricAgentName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, fabricName, fabricAgentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataReplicationDraData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataReplicationDraData.DeserializeDataReplicationDraData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DataReplicationDraData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string fabricName, string fabricAgentName, DataReplicationDraData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DataReplication/replicationFabrics/", false); + uri.AppendPath(fabricName, true); + uri.AppendPath("/fabricAgents/", false); + uri.AppendPath(fabricAgentName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates the fabric agent. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The fabric name. + /// The fabric agent (Dra) name. + /// Dra model. + /// 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 fabricName, string fabricAgentName, DataReplicationDraData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fabricName, nameof(fabricName)); + Argument.AssertNotNullOrEmpty(fabricAgentName, nameof(fabricAgentName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, fabricName, fabricAgentName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates the fabric agent. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The fabric name. + /// The fabric agent (Dra) name. + /// Dra model. + /// 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 fabricName, string fabricAgentName, DataReplicationDraData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fabricName, nameof(fabricName)); + Argument.AssertNotNullOrEmpty(fabricAgentName, nameof(fabricAgentName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, fabricName, fabricAgentName, data); + _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 fabricName, string fabricAgentName) + { + 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.DataReplication/replicationFabrics/", false); + uri.AppendPath(fabricName, true); + uri.AppendPath("/fabricAgents/", false); + uri.AppendPath(fabricAgentName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the fabric agent. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The fabric name. + /// The fabric agent (Dra) name. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string fabricName, string fabricAgentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fabricName, nameof(fabricName)); + Argument.AssertNotNullOrEmpty(fabricAgentName, nameof(fabricAgentName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, fabricName, fabricAgentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the fabric agent. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The fabric name. + /// The fabric agent (Dra) name. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string fabricName, string fabricAgentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fabricName, nameof(fabricName)); + Argument.AssertNotNullOrEmpty(fabricAgentName, nameof(fabricAgentName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, fabricName, fabricAgentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string fabricName) + { + 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.DataReplication/replicationFabrics/", false); + uri.AppendPath(fabricName, true); + uri.AppendPath("/fabricAgents", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the list of fabric agents in the given fabric. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The fabric name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string fabricName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fabricName, nameof(fabricName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, fabricName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataReplicationDraListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataReplicationDraListResult.DeserializeDataReplicationDraListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the list of fabric agents in the given fabric. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The fabric name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string fabricName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fabricName, nameof(fabricName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, fabricName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataReplicationDraListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataReplicationDraListResult.DeserializeDataReplicationDraListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string fabricName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the list of fabric agents in the given fabric. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The fabric name. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string fabricName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fabricName, nameof(fabricName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, fabricName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataReplicationDraListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataReplicationDraListResult.DeserializeDataReplicationDraListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the list of fabric agents in the given fabric. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The fabric name. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string fabricName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fabricName, nameof(fabricName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, fabricName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataReplicationDraListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataReplicationDraListResult.DeserializeDataReplicationDraListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/RestOperations/EmailConfigurationRestOperations.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/RestOperations/EmailConfigurationRestOperations.cs new file mode 100644 index 000000000000..c9a7fd9bbae9 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/RestOperations/EmailConfigurationRestOperations.cs @@ -0,0 +1,377 @@ +// 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.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication +{ + internal partial class EmailConfigurationRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of EmailConfigurationRestOperations. + /// 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 EmailConfigurationRestOperations(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 ?? "2021-02-16-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string vaultName, string emailConfigurationName) + { + 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.DataReplication/replicationVaults/", false); + uri.AppendPath(vaultName, true); + uri.AppendPath("/alertSettings/", false); + uri.AppendPath(emailConfigurationName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details of the alert configuration setting. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The email configuration name. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string vaultName, string emailConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(emailConfigurationName, nameof(emailConfigurationName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, vaultName, emailConfigurationName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataReplicationEmailConfigurationData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataReplicationEmailConfigurationData.DeserializeDataReplicationEmailConfigurationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DataReplicationEmailConfigurationData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details of the alert configuration setting. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The email configuration name. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string vaultName, string emailConfigurationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(emailConfigurationName, nameof(emailConfigurationName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, vaultName, emailConfigurationName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataReplicationEmailConfigurationData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataReplicationEmailConfigurationData.DeserializeDataReplicationEmailConfigurationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DataReplicationEmailConfigurationData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string vaultName, string emailConfigurationName, DataReplicationEmailConfigurationData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DataReplication/replicationVaults/", false); + uri.AppendPath(vaultName, true); + uri.AppendPath("/alertSettings/", false); + uri.AppendPath(emailConfigurationName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates an alert configuration setting for the given vault. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The email configuration name. + /// EmailConfiguration model. + /// 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 vaultName, string emailConfigurationName, DataReplicationEmailConfigurationData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(emailConfigurationName, nameof(emailConfigurationName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, vaultName, emailConfigurationName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + DataReplicationEmailConfigurationData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataReplicationEmailConfigurationData.DeserializeDataReplicationEmailConfigurationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates an alert configuration setting for the given vault. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The email configuration name. + /// EmailConfiguration model. + /// 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 vaultName, string emailConfigurationName, DataReplicationEmailConfigurationData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(emailConfigurationName, nameof(emailConfigurationName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, vaultName, emailConfigurationName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + DataReplicationEmailConfigurationData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataReplicationEmailConfigurationData.DeserializeDataReplicationEmailConfigurationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string vaultName) + { + 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.DataReplication/replicationVaults/", false); + uri.AppendPath(vaultName, true); + uri.AppendPath("/alertSettings", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the list of alert configuration settings for the given vault. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, vaultName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataReplicationEmailConfigurationListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataReplicationEmailConfigurationListResult.DeserializeDataReplicationEmailConfigurationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the list of alert configuration settings for the given vault. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, vaultName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataReplicationEmailConfigurationListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataReplicationEmailConfigurationListResult.DeserializeDataReplicationEmailConfigurationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string vaultName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the list of alert configuration settings for the given vault. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, vaultName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataReplicationEmailConfigurationListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataReplicationEmailConfigurationListResult.DeserializeDataReplicationEmailConfigurationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the list of alert configuration settings for the given vault. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, vaultName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataReplicationEmailConfigurationListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataReplicationEmailConfigurationListResult.DeserializeDataReplicationEmailConfigurationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/RestOperations/EventRestOperations.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/RestOperations/EventRestOperations.cs new file mode 100644 index 000000000000..0e5f027ca9c5 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/RestOperations/EventRestOperations.cs @@ -0,0 +1,299 @@ +// 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.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication +{ + internal partial class EventRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of EventRestOperations. + /// 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 EventRestOperations(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 ?? "2021-02-16-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string vaultName, string eventName) + { + 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.DataReplication/replicationVaults/", false); + uri.AppendPath(vaultName, true); + uri.AppendPath("/events/", false); + uri.AppendPath(eventName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details of the event. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The event name. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string vaultName, string eventName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(eventName, nameof(eventName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, vaultName, eventName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataReplicationEventData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataReplicationEventData.DeserializeDataReplicationEventData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DataReplicationEventData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details of the event. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The event name. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string vaultName, string eventName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(eventName, nameof(eventName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, vaultName, eventName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataReplicationEventData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataReplicationEventData.DeserializeDataReplicationEventData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DataReplicationEventData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string vaultName, string filter, string continuationToken) + { + 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.DataReplication/replicationVaults/", false); + uri.AppendPath(vaultName, true); + uri.AppendPath("/events", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (continuationToken != null) + { + uri.AppendQuery("continuationToken", continuationToken, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the list of events in the given vault. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// Filter string. + /// Continuation token. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string vaultName, string filter = null, string continuationToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, vaultName, filter, continuationToken); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataReplicationEventListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataReplicationEventListResult.DeserializeDataReplicationEventListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the list of events in the given vault. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// Filter string. + /// Continuation token. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string vaultName, string filter = null, string continuationToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, vaultName, filter, continuationToken); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataReplicationEventListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataReplicationEventListResult.DeserializeDataReplicationEventListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string vaultName, string filter, string continuationToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the list of events in the given vault. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// Filter string. + /// Continuation token. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string vaultName, string filter = null, string continuationToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, vaultName, filter, continuationToken); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataReplicationEventListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataReplicationEventListResult.DeserializeDataReplicationEventListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the list of events in the given vault. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// Filter string. + /// Continuation token. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string vaultName, string filter = null, string continuationToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, vaultName, filter, continuationToken); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataReplicationEventListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataReplicationEventListResult.DeserializeDataReplicationEventListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/RestOperations/FabricRestOperations.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/RestOperations/FabricRestOperations.cs new file mode 100644 index 000000000000..35814b5088d4 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/RestOperations/FabricRestOperations.cs @@ -0,0 +1,644 @@ +// 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.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication +{ + internal partial class FabricRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of FabricRestOperations. + /// 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 FabricRestOperations(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 ?? "2021-02-16-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string fabricName) + { + 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.DataReplication/replicationFabrics/", false); + uri.AppendPath(fabricName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details of the fabric. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The fabric name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string fabricName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fabricName, nameof(fabricName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, fabricName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataReplicationFabricData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataReplicationFabricData.DeserializeDataReplicationFabricData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DataReplicationFabricData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details of the fabric. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The fabric name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string fabricName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fabricName, nameof(fabricName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, fabricName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataReplicationFabricData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataReplicationFabricData.DeserializeDataReplicationFabricData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DataReplicationFabricData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string fabricName, DataReplicationFabricData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DataReplication/replicationFabrics/", false); + uri.AppendPath(fabricName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates the fabric. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The fabric name. + /// Fabric properties. + /// 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 fabricName, DataReplicationFabricData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fabricName, nameof(fabricName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, fabricName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates the fabric. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The fabric name. + /// Fabric properties. + /// 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 fabricName, DataReplicationFabricData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fabricName, nameof(fabricName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, fabricName, data); + _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 fabricName, DataReplicationFabricPatch patch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DataReplication/replicationFabrics/", false); + uri.AppendPath(fabricName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Performs update on the fabric. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The fabric name. + /// Fabric properties. + /// 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 fabricName, DataReplicationFabricPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fabricName, nameof(fabricName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, fabricName, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Performs update on the fabric. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The fabric name. + /// Fabric properties. + /// 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 fabricName, DataReplicationFabricPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fabricName, nameof(fabricName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, fabricName, patch); + _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 fabricName) + { + 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.DataReplication/replicationFabrics/", false); + uri.AppendPath(fabricName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Removes the fabric. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The fabric name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string fabricName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fabricName, nameof(fabricName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, fabricName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Removes the fabric. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The fabric name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string fabricName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fabricName, nameof(fabricName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, fabricName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId, string continuationToken) + { + 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.DataReplication/replicationFabrics", false); + if (continuationToken != null) + { + uri.AppendQuery("continuationToken", continuationToken, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the list of fabrics in the given subscription. + /// The ID of the target subscription. The value must be an UUID. + /// Continuation token from the previous call. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionAsync(string subscriptionId, string continuationToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId, continuationToken); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataReplicationFabricListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataReplicationFabricListResult.DeserializeDataReplicationFabricListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the list of fabrics in the given subscription. + /// The ID of the target subscription. The value must be an UUID. + /// Continuation token from the previous call. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscription(string subscriptionId, string continuationToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId, continuationToken); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataReplicationFabricListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataReplicationFabricListResult.DeserializeDataReplicationFabricListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string continuationToken) + { + 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.DataReplication/replicationFabrics", false); + if (continuationToken != null) + { + uri.AppendQuery("continuationToken", continuationToken, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the list of fabrics in the given subscription and resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Continuation token from the previous call. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string continuationToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, continuationToken); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataReplicationFabricListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataReplicationFabricListResult.DeserializeDataReplicationFabricListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the list of fabrics in the given subscription and resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Continuation token from the previous call. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string continuationToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, continuationToken); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataReplicationFabricListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataReplicationFabricListResult.DeserializeDataReplicationFabricListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId, string continuationToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the list of fabrics in the given subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// Continuation token from the previous call. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, string continuationToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, continuationToken); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataReplicationFabricListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataReplicationFabricListResult.DeserializeDataReplicationFabricListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the list of fabrics in the given subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// Continuation token from the previous call. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, string continuationToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, continuationToken); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataReplicationFabricListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataReplicationFabricListResult.DeserializeDataReplicationFabricListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string continuationToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the list of fabrics in the given subscription and resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Continuation token from the previous call. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string continuationToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, continuationToken); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataReplicationFabricListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataReplicationFabricListResult.DeserializeDataReplicationFabricListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the list of fabrics in the given subscription and resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Continuation token from the previous call. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string continuationToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, continuationToken); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataReplicationFabricListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataReplicationFabricListResult.DeserializeDataReplicationFabricListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/RestOperations/PolicyRestOperations.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/RestOperations/PolicyRestOperations.cs new file mode 100644 index 000000000000..72677c0dffa0 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/RestOperations/PolicyRestOperations.cs @@ -0,0 +1,443 @@ +// 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.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication +{ + internal partial class PolicyRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of PolicyRestOperations. + /// 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 PolicyRestOperations(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 ?? "2021-02-16-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string vaultName, string policyName) + { + 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.DataReplication/replicationVaults/", false); + uri.AppendPath(vaultName, true); + uri.AppendPath("/replicationPolicies/", false); + uri.AppendPath(policyName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details of the policy. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The policy name. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string vaultName, string policyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(policyName, nameof(policyName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, vaultName, policyName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataReplicationPolicyData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataReplicationPolicyData.DeserializeDataReplicationPolicyData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DataReplicationPolicyData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details of the policy. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The policy name. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string vaultName, string policyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(policyName, nameof(policyName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, vaultName, policyName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataReplicationPolicyData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataReplicationPolicyData.DeserializeDataReplicationPolicyData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DataReplicationPolicyData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string vaultName, string policyName, DataReplicationPolicyData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DataReplication/replicationVaults/", false); + uri.AppendPath(vaultName, true); + uri.AppendPath("/replicationPolicies/", false); + uri.AppendPath(policyName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates the policy. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The policy name. + /// Policy model. + /// 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 vaultName, string policyName, DataReplicationPolicyData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(policyName, nameof(policyName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, vaultName, policyName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates the policy. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The policy name. + /// Policy model. + /// 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 vaultName, string policyName, DataReplicationPolicyData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(policyName, nameof(policyName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, vaultName, policyName, data); + _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 vaultName, string policyName) + { + 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.DataReplication/replicationVaults/", false); + uri.AppendPath(vaultName, true); + uri.AppendPath("/replicationPolicies/", false); + uri.AppendPath(policyName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Removes the policy. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The policy name. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string vaultName, string policyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(policyName, nameof(policyName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, vaultName, policyName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Removes the policy. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The policy name. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string vaultName, string policyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(policyName, nameof(policyName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, vaultName, policyName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string vaultName) + { + 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.DataReplication/replicationVaults/", false); + uri.AppendPath(vaultName, true); + uri.AppendPath("/replicationPolicies", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the list of policies in the given vault. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, vaultName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataReplicationPolicyListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataReplicationPolicyListResult.DeserializeDataReplicationPolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the list of policies in the given vault. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, vaultName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataReplicationPolicyListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataReplicationPolicyListResult.DeserializeDataReplicationPolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string vaultName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the list of policies in the given vault. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, vaultName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataReplicationPolicyListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataReplicationPolicyListResult.DeserializeDataReplicationPolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the list of policies in the given vault. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, vaultName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataReplicationPolicyListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataReplicationPolicyListResult.DeserializeDataReplicationPolicyListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/RestOperations/ProtectedItemRestOperations.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/RestOperations/ProtectedItemRestOperations.cs new file mode 100644 index 000000000000..71cb225f1ba3 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/RestOperations/ProtectedItemRestOperations.cs @@ -0,0 +1,535 @@ +// 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.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication +{ + internal partial class ProtectedItemRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ProtectedItemRestOperations. + /// 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 ProtectedItemRestOperations(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 ?? "2021-02-16-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string vaultName, string protectedItemName) + { + 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.DataReplication/replicationVaults/", false); + uri.AppendPath(vaultName, true); + uri.AppendPath("/protectedItems/", false); + uri.AppendPath(protectedItemName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details of the protected item. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The protected item name. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string vaultName, string protectedItemName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(protectedItemName, nameof(protectedItemName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, vaultName, protectedItemName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataReplicationProtectedItemData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataReplicationProtectedItemData.DeserializeDataReplicationProtectedItemData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DataReplicationProtectedItemData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details of the protected item. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The protected item name. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string vaultName, string protectedItemName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(protectedItemName, nameof(protectedItemName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, vaultName, protectedItemName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataReplicationProtectedItemData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataReplicationProtectedItemData.DeserializeDataReplicationProtectedItemData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DataReplicationProtectedItemData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string vaultName, string protectedItemName, DataReplicationProtectedItemData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DataReplication/replicationVaults/", false); + uri.AppendPath(vaultName, true); + uri.AppendPath("/protectedItems/", false); + uri.AppendPath(protectedItemName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates the protected item. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The protected item name. + /// Protected item model. + /// 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 vaultName, string protectedItemName, DataReplicationProtectedItemData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(protectedItemName, nameof(protectedItemName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, vaultName, protectedItemName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates the protected item. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The protected item name. + /// Protected item model. + /// 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 vaultName, string protectedItemName, DataReplicationProtectedItemData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(protectedItemName, nameof(protectedItemName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, vaultName, protectedItemName, data); + _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 vaultName, string protectedItemName, bool? forceDelete) + { + 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.DataReplication/replicationVaults/", false); + uri.AppendPath(vaultName, true); + uri.AppendPath("/protectedItems/", false); + uri.AppendPath(protectedItemName, true); + if (forceDelete != null) + { + uri.AppendQuery("forceDelete", forceDelete.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Removes the protected item. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The protected item name. + /// A flag indicating whether to do force delete or not. + /// 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 vaultName, string protectedItemName, bool? forceDelete = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(protectedItemName, nameof(protectedItemName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, vaultName, protectedItemName, forceDelete); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Removes the protected item. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The protected item name. + /// A flag indicating whether to do force delete or not. + /// 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 vaultName, string protectedItemName, bool? forceDelete = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(protectedItemName, nameof(protectedItemName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, vaultName, protectedItemName, forceDelete); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string vaultName) + { + 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.DataReplication/replicationVaults/", false); + uri.AppendPath(vaultName, true); + uri.AppendPath("/protectedItems", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the list of protected items in the given vault. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, vaultName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataReplicationProtectedItemListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataReplicationProtectedItemListResult.DeserializeDataReplicationProtectedItemListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the list of protected items in the given vault. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, vaultName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataReplicationProtectedItemListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataReplicationProtectedItemListResult.DeserializeDataReplicationProtectedItemListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreatePlannedFailoverRequest(string subscriptionId, string resourceGroupName, string vaultName, string protectedItemName, PlannedFailoverModel body) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DataReplication/replicationVaults/", false); + uri.AppendPath(vaultName, true); + uri.AppendPath("/protectedItems/", false); + uri.AppendPath(protectedItemName, true); + uri.AppendPath("/plannedFailover", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + if (body != null) + { + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(body); + request.Content = content; + } + _userAgent.Apply(message); + return message; + } + + /// Performs the planned failover on the protected item. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The protected item name. + /// Planned failover model. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task PlannedFailoverAsync(string subscriptionId, string resourceGroupName, string vaultName, string protectedItemName, PlannedFailoverModel body = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(protectedItemName, nameof(protectedItemName)); + + using var message = CreatePlannedFailoverRequest(subscriptionId, resourceGroupName, vaultName, protectedItemName, body); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Performs the planned failover on the protected item. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The protected item name. + /// Planned failover model. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response PlannedFailover(string subscriptionId, string resourceGroupName, string vaultName, string protectedItemName, PlannedFailoverModel body = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(protectedItemName, nameof(protectedItemName)); + + using var message = CreatePlannedFailoverRequest(subscriptionId, resourceGroupName, vaultName, protectedItemName, body); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string vaultName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the list of protected items in the given vault. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, vaultName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataReplicationProtectedItemListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataReplicationProtectedItemListResult.DeserializeDataReplicationProtectedItemListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the list of protected items in the given vault. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, vaultName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataReplicationProtectedItemListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataReplicationProtectedItemListResult.DeserializeDataReplicationProtectedItemListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/RestOperations/RecoveryPointsRestOperations.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/RestOperations/RecoveryPointsRestOperations.cs new file mode 100644 index 000000000000..e98e467bfd39 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/RestOperations/RecoveryPointsRestOperations.cs @@ -0,0 +1,299 @@ +// 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.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication +{ + internal partial class RecoveryPointsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of RecoveryPointsRestOperations. + /// 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 RecoveryPointsRestOperations(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 ?? "2021-02-16-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string vaultName, string protectedItemName, string recoveryPointName) + { + 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.DataReplication/replicationVaults/", false); + uri.AppendPath(vaultName, true); + uri.AppendPath("/protectedItems/", false); + uri.AppendPath(protectedItemName, true); + uri.AppendPath("/recoveryPoints/", false); + uri.AppendPath(recoveryPointName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details of the recovery point of a protected item. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The protected item name. + /// The recovery point name. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string vaultName, string protectedItemName, string recoveryPointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(protectedItemName, nameof(protectedItemName)); + Argument.AssertNotNullOrEmpty(recoveryPointName, nameof(recoveryPointName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, vaultName, protectedItemName, recoveryPointName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataReplicationRecoveryPointData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataReplicationRecoveryPointData.DeserializeDataReplicationRecoveryPointData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DataReplicationRecoveryPointData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details of the recovery point of a protected item. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The protected item name. + /// The recovery point name. + /// The cancellation token to use. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string vaultName, string protectedItemName, string recoveryPointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(protectedItemName, nameof(protectedItemName)); + Argument.AssertNotNullOrEmpty(recoveryPointName, nameof(recoveryPointName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, vaultName, protectedItemName, recoveryPointName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataReplicationRecoveryPointData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataReplicationRecoveryPointData.DeserializeDataReplicationRecoveryPointData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DataReplicationRecoveryPointData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string vaultName, string protectedItemName) + { + 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.DataReplication/replicationVaults/", false); + uri.AppendPath(vaultName, true); + uri.AppendPath("/protectedItems/", false); + uri.AppendPath(protectedItemName, true); + uri.AppendPath("/recoveryPoints", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the list of recovery points of the given protected item. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The protected item name. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string vaultName, string protectedItemName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(protectedItemName, nameof(protectedItemName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, vaultName, protectedItemName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataReplicationRecoveryPointListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataReplicationRecoveryPointListResult.DeserializeDataReplicationRecoveryPointListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the list of recovery points of the given protected item. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The protected item name. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string vaultName, string protectedItemName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(protectedItemName, nameof(protectedItemName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, vaultName, protectedItemName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataReplicationRecoveryPointListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataReplicationRecoveryPointListResult.DeserializeDataReplicationRecoveryPointListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string vaultName, string protectedItemName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the list of recovery points of the given protected item. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The protected item name. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string vaultName, string protectedItemName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(protectedItemName, nameof(protectedItemName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, vaultName, protectedItemName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataReplicationRecoveryPointListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataReplicationRecoveryPointListResult.DeserializeDataReplicationRecoveryPointListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the list of recovery points of the given protected item. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The protected item name. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string vaultName, string protectedItemName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(protectedItemName, nameof(protectedItemName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, vaultName, protectedItemName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataReplicationRecoveryPointListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataReplicationRecoveryPointListResult.DeserializeDataReplicationRecoveryPointListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/RestOperations/ReplicationExtensionRestOperations.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/RestOperations/ReplicationExtensionRestOperations.cs new file mode 100644 index 000000000000..932c049ae076 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/RestOperations/ReplicationExtensionRestOperations.cs @@ -0,0 +1,443 @@ +// 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.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication +{ + internal partial class ReplicationExtensionRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ReplicationExtensionRestOperations. + /// 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 ReplicationExtensionRestOperations(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 ?? "2021-02-16-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string vaultName, string replicationExtensionName) + { + 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.DataReplication/replicationVaults/", false); + uri.AppendPath(vaultName, true); + uri.AppendPath("/replicationExtensions/", false); + uri.AppendPath(replicationExtensionName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details of the replication extension. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The replication extension name. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string vaultName, string replicationExtensionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(replicationExtensionName, nameof(replicationExtensionName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, vaultName, replicationExtensionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataReplicationReplicationExtensionData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataReplicationReplicationExtensionData.DeserializeDataReplicationReplicationExtensionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DataReplicationReplicationExtensionData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details of the replication extension. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The replication extension name. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string vaultName, string replicationExtensionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(replicationExtensionName, nameof(replicationExtensionName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, vaultName, replicationExtensionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataReplicationReplicationExtensionData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataReplicationReplicationExtensionData.DeserializeDataReplicationReplicationExtensionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DataReplicationReplicationExtensionData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string vaultName, string replicationExtensionName, DataReplicationReplicationExtensionData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DataReplication/replicationVaults/", false); + uri.AppendPath(vaultName, true); + uri.AppendPath("/replicationExtensions/", false); + uri.AppendPath(replicationExtensionName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates the replication extension in the given vault. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The replication extension name. + /// Replication extension model. + /// 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 vaultName, string replicationExtensionName, DataReplicationReplicationExtensionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(replicationExtensionName, nameof(replicationExtensionName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, vaultName, replicationExtensionName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates the replication extension in the given vault. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The replication extension name. + /// Replication extension model. + /// 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 vaultName, string replicationExtensionName, DataReplicationReplicationExtensionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(replicationExtensionName, nameof(replicationExtensionName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, vaultName, replicationExtensionName, data); + _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 vaultName, string replicationExtensionName) + { + 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.DataReplication/replicationVaults/", false); + uri.AppendPath(vaultName, true); + uri.AppendPath("/replicationExtensions/", false); + uri.AppendPath(replicationExtensionName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the replication extension in the given vault. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The replication extension name. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string vaultName, string replicationExtensionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(replicationExtensionName, nameof(replicationExtensionName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, vaultName, replicationExtensionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the replication extension in the given vault. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The replication extension name. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string vaultName, string replicationExtensionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(replicationExtensionName, nameof(replicationExtensionName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, vaultName, replicationExtensionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string vaultName) + { + 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.DataReplication/replicationVaults/", false); + uri.AppendPath(vaultName, true); + uri.AppendPath("/replicationExtensions", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the list of replication extensions in the given vault. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, vaultName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataReplicationReplicationExtensionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataReplicationReplicationExtensionListResult.DeserializeDataReplicationReplicationExtensionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the list of replication extensions in the given vault. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, vaultName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataReplicationReplicationExtensionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataReplicationReplicationExtensionListResult.DeserializeDataReplicationReplicationExtensionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string vaultName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the list of replication extensions in the given vault. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, vaultName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataReplicationReplicationExtensionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataReplicationReplicationExtensionListResult.DeserializeDataReplicationReplicationExtensionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the list of replication extensions in the given vault. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, vaultName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataReplicationReplicationExtensionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataReplicationReplicationExtensionListResult.DeserializeDataReplicationReplicationExtensionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/RestOperations/VaultRestOperations.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/RestOperations/VaultRestOperations.cs new file mode 100644 index 000000000000..3fb964073ea3 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/RestOperations/VaultRestOperations.cs @@ -0,0 +1,644 @@ +// 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.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication +{ + internal partial class VaultRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of VaultRestOperations. + /// 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 VaultRestOperations(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 ?? "2021-02-16-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string vaultName) + { + 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.DataReplication/replicationVaults/", false); + uri.AppendPath(vaultName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details of the vault. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, vaultName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataReplicationVaultData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataReplicationVaultData.DeserializeDataReplicationVaultData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DataReplicationVaultData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details of the vault. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, vaultName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataReplicationVaultData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataReplicationVaultData.DeserializeDataReplicationVaultData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DataReplicationVaultData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string vaultName, DataReplicationVaultData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DataReplication/replicationVaults/", false); + uri.AppendPath(vaultName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates the vault. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// Vault properties. + /// 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 vaultName, DataReplicationVaultData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, vaultName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates the vault. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// Vault properties. + /// 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 vaultName, DataReplicationVaultData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, vaultName, data); + _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 vaultName, DataReplicationVaultPatch patch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.DataReplication/replicationVaults/", false); + uri.AppendPath(vaultName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Performs update on the vault. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// Vault properties. + /// 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 vaultName, DataReplicationVaultPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, vaultName, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Performs update on the vault. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// Vault properties. + /// 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 vaultName, DataReplicationVaultPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, vaultName, patch); + _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 vaultName) + { + 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.DataReplication/replicationVaults/", false); + uri.AppendPath(vaultName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Removes the vault. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, vaultName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Removes the vault. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string vaultName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, vaultName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId, string continuationToken) + { + 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.DataReplication/replicationVaults", false); + if (continuationToken != null) + { + uri.AppendQuery("continuationToken", continuationToken, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the list of vaults in the given subscription. + /// The ID of the target subscription. The value must be an UUID. + /// Continuation token from the previous call. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionAsync(string subscriptionId, string continuationToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId, continuationToken); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataReplicationVaultListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataReplicationVaultListResult.DeserializeDataReplicationVaultListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the list of vaults in the given subscription. + /// The ID of the target subscription. The value must be an UUID. + /// Continuation token from the previous call. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscription(string subscriptionId, string continuationToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId, continuationToken); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataReplicationVaultListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataReplicationVaultListResult.DeserializeDataReplicationVaultListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string continuationToken) + { + 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.DataReplication/replicationVaults", false); + if (continuationToken != null) + { + uri.AppendQuery("continuationToken", continuationToken, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the list of vaults in the given subscription and resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Continuation token from the previous call. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string continuationToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, continuationToken); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataReplicationVaultListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataReplicationVaultListResult.DeserializeDataReplicationVaultListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the list of vaults in the given subscription and resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Continuation token from the previous call. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string continuationToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, continuationToken); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataReplicationVaultListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataReplicationVaultListResult.DeserializeDataReplicationVaultListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId, string continuationToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the list of vaults in the given subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// Continuation token from the previous call. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, string continuationToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, continuationToken); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataReplicationVaultListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataReplicationVaultListResult.DeserializeDataReplicationVaultListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the list of vaults in the given subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// Continuation token from the previous call. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, string continuationToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, continuationToken); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataReplicationVaultListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataReplicationVaultListResult.DeserializeDataReplicationVaultListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string continuationToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the list of vaults in the given subscription and resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Continuation token from the previous call. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string continuationToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, continuationToken); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataReplicationVaultListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataReplicationVaultListResult.DeserializeDataReplicationVaultListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the list of vaults in the given subscription and resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Continuation token from the previous call. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string continuationToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, continuationToken); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataReplicationVaultListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataReplicationVaultListResult.DeserializeDataReplicationVaultListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/RestOperations/WorkflowRestOperations.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/RestOperations/WorkflowRestOperations.cs new file mode 100644 index 000000000000..68aed0f22a7a --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/RestOperations/WorkflowRestOperations.cs @@ -0,0 +1,299 @@ +// 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.RecoveryServicesDataReplication.Models; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication +{ + internal partial class WorkflowRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkflowRestOperations. + /// 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 WorkflowRestOperations(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 ?? "2021-02-16-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string vaultName, string jobName) + { + 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.DataReplication/replicationVaults/", false); + uri.AppendPath(vaultName, true); + uri.AppendPath("/jobs/", false); + uri.AppendPath(jobName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the details of the job. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The job (workflow) name. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string vaultName, string jobName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(jobName, nameof(jobName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, vaultName, jobName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataReplicationWorkflowData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataReplicationWorkflowData.DeserializeDataReplicationWorkflowData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DataReplicationWorkflowData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the details of the job. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// The job (workflow) name. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string vaultName, string jobName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + Argument.AssertNotNullOrEmpty(jobName, nameof(jobName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, vaultName, jobName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataReplicationWorkflowData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataReplicationWorkflowData.DeserializeDataReplicationWorkflowData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DataReplicationWorkflowData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string vaultName, string filter, string continuationToken) + { + 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.DataReplication/replicationVaults/", false); + uri.AppendPath(vaultName, true); + uri.AppendPath("/jobs", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (continuationToken != null) + { + uri.AppendQuery("continuationToken", continuationToken, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the list of jobs in the given vault. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// Filter string. + /// Continuation token. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string vaultName, string filter = null, string continuationToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, vaultName, filter, continuationToken); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataReplicationWorkflowListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataReplicationWorkflowListResult.DeserializeDataReplicationWorkflowListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the list of jobs in the given vault. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// Filter string. + /// Continuation token. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string vaultName, string filter = null, string continuationToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, vaultName, filter, continuationToken); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataReplicationWorkflowListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataReplicationWorkflowListResult.DeserializeDataReplicationWorkflowListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string vaultName, string filter, string continuationToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the list of jobs in the given vault. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// Filter string. + /// Continuation token. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string vaultName, string filter = null, string continuationToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, vaultName, filter, continuationToken); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DataReplicationWorkflowListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DataReplicationWorkflowListResult.DeserializeDataReplicationWorkflowListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the list of jobs in the given vault. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The vault name. + /// Filter string. + /// Continuation token. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string vaultName, string filter = null, string continuationToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vaultName, nameof(vaultName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, vaultName, filter, continuationToken); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DataReplicationWorkflowListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DataReplicationWorkflowListResult.DeserializeDataReplicationWorkflowListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Properties/AssemblyInfo.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..b55f2d37e18c --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/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.DataReplication")] + +[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] +[assembly: InternalsVisibleTo("Azure.ResourceManager.RecoveryServicesDataReplication.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/autorest.md b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/autorest.md new file mode 100644 index 000000000000..946ef8c9f604 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/autorest.md @@ -0,0 +1,230 @@ +# Generated code configuration + +Run `dotnet build /t:GenerateCode` to generate code. + +``` yaml +azure-arm: true +csharp: true +library-name: RecoveryServicesDataReplication +namespace: Azure.ResourceManager.RecoveryServicesDataReplication +require: https://github.com/Azure/azure-rest-api-specs/blob/64cddc58b25ae7d6e50cc0dfb5bc19af4ea23f65/specification/recoveryservicesdatareplication/resource-manager/readme.md +#tag: package-2021-02-16-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: + AzStackHCIFabricModelCustomProperties.azStackHciSiteId: -|arm-id + AzStackHCIFabricModelCustomProperties.fabricResourceId: -|arm-id + AzStackHCIFabricModelCustomProperties.migrationSolutionId: -|arm-id + DraModelProperties.lastHeartbeat: LastHeartbeatOn + CheckNameAvailabilityModel: DataReplicationNameAvailabilityContent + CheckNameAvailabilityModel.type: -|resource-type + CheckNameAvailabilityResponseModel: DataReplicationNameAvailabilityResult + CheckNameAvailabilityResponseModel.nameAvailable: IsNameAvailable + DeploymentPreflightResource.type: -|resource-type + DraModel: DataReplicationDra + DraModelCollection: DataReplicationDraListResult + DraModelProperties: DataReplicationDraProperties + EmailConfigurationModel: DataReplicationEmailConfiguration + EmailConfigurationModelCollection: DataReplicationEmailConfigurationListResult + EmailConfigurationModelProperties: DataReplicationEmailConfigurationProperties + ErrorModel: DataReplicationErrorInfo + EventModel: DataReplicationEvent + EventModelCollection: DataReplicationEventListResult + EventModelProperties: DataReplicationEventProperties + EventModelProperties.resourceType: -|resource-type + EventModelProperties.timeOfOccurrence: OccurredOn + FabricModel: DataReplicationFabric + FabricModelCollection: DataReplicationFabricListResult + FabricModelProperties: DataReplicationFabricProperties + FabricModelProperties.serviceResourceId: -|arm-id + HealthErrorModel: DataReplicationHealthErrorInfo + HealthStatus: DataReplicationHealthStatus + HyperVMigrateFabricModelCustomProperties.hyperVSiteId: -|arm-id + HyperVMigrateFabricModelCustomProperties.fabricResourceId: -|arm-id + HyperVMigrateFabricModelCustomProperties.migrationSolutionId: -|arm-id + HyperVToAzStackHCIDiskInput.storageContainerId: -|arm-id + HyperVToAzStackHCIProtectedDiskProperties.storageContainerId: -|arm-id + HyperVToAzStackHCIProtectedItemModelCustomProperties.targetHciClusterId: -|arm-id + HyperVToAzStackHCIProtectedItemModelCustomProperties.targetArcClusterCustomLocationId: -|arm-id + HyperVToAzStackHCIProtectedItemModelCustomProperties.fabricDiscoveryMachineId: -|arm-id + HyperVToAzStackHCIProtectedItemModelCustomProperties.targetResourceGroupId: -|arm-id + HyperVToAzStackHCIProtectedItemModelCustomProperties.storageContainerId: -|arm-id + HyperVToAzStackHCIReplicationExtensionModelCustomProperties.hyperVFabricArmId: -|arm-id + HyperVToAzStackHCIReplicationExtensionModelCustomProperties.hyperVSiteId: -|arm-id + HyperVToAzStackHCIReplicationExtensionModelCustomProperties.azStackHciFabricArmId: -|arm-id + HyperVToAzStackHCIReplicationExtensionModelCustomProperties.azStackHciSiteId: -|arm-id + IdentityModel: DataReplicationIdentity + InnerHealthErrorModel: DataReplicationInnerHealthErrorInfo + PolicyModel: DataReplicationPolicy + PolicyModelCollection: DataReplicationPolicyListResult + PolicyModelProperties: DataReplicationPolicyProperties + ProtectedItemModel: DataReplicationProtectedItem + ProtectedItemModelCollection: DataReplicationProtectedItemListResult + ProtectedItemModelProperties: DataReplicationProtectedItemProperties + ProtectedItemModelProperties.resyncRequired: IsResyncRequired + ProtectionState: DataReplicationProtectionState + ProvisioningState: DataReplicationProvisioningState + RecoveryPointModel: DataReplicationRecoveryPoint + RecoveryPointModelCollection: DataReplicationRecoveryPointListResult + RecoveryPointModelProperties: DataReplicationRecoveryPointProperties + RecoveryPointType: DataReplicationRecoveryPointType + ReplicationExtensionModel: DataReplicationReplicationExtension + ReplicationExtensionModelCollection: DataReplicationReplicationExtensionListResult + ReplicationExtensionModelProperties: DataReplicationReplicationExtensionProperties + ReplicationVaultType: DataReplicationReplicationVaultType + ResynchronizationState: DataReplicationResynchronizationState + TaskModel: DataReplicationTask + TaskState: DataReplicationTaskState + TestFailoverState: DataReplicationTestFailoverState + VaultModel: DataReplicationVault + VaultModelCollection: DataReplicationVaultListResult + VaultModelProperties: DataReplicationVaultProperties + VaultModelProperties.serviceResourceId: -|arm-id + VMwareMigrateFabricModelCustomProperties.vmwareSiteId: VMwareSiteId|arm-id + VMwareMigrateFabricModelCustomProperties.migrationSolutionId: -|arm-id + VMwareToAzStackHCIProtectedDiskProperties.storageContainerId: -|arm-id + VMwareToAzStackHCIProtectedItemModelCustomProperties.targetHciClusterId: -|arm-id + VMwareToAzStackHCIProtectedItemModelCustomProperties.targetArcClusterCustomLocationId: -|arm-id + VMwareToAzStackHCIProtectedItemModelCustomProperties.storageContainerId: -|arm-id + VMwareToAzStackHCIProtectedItemModelCustomProperties.targetResourceGroupId: -|arm-id + VMwareToAzStackHCIProtectedItemModelCustomProperties.fabricDiscoveryMachineId: -|arm-id + VMwareToAzStackHCIReplicationExtensionModelCustomProperties.vmwareFabricArmId: -|arm-id + VMwareToAzStackHCIReplicationExtensionModelCustomProperties.vmwareSiteId: -|arm-id + VMwareToAzStackHCIReplicationExtensionModelCustomProperties.azStackHciFabricArmId: -|arm-id + VMwareToAzStackHCIReplicationExtensionModelCustomProperties.azStackHciSiteId: -|arm-id + VMwareToAzStackHCIReplicationExtensionModelCustomProperties.storageAccountId: -|arm-id + WorkflowModel: DataReplicationWorkflow + WorkflowModelCollection: DataReplicationWorkflowListResult + WorkflowModelProperties: DataReplicationWorkflowProperties + WorkflowState: DataReplicationWorkflowState + +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 + HCI: Hci + +override-operation-name: + CheckNameAvailability: CheckDataReplicationNameAvailability + +directive: + # Remove all operation methods that already exist in core + - remove-operation: DraOperationStatus_Get + - remove-operation: FabricOperationsStatus_Get + - remove-operation: PolicyOperationStatus_Get + - remove-operation: ProtectedItemOperationStatus_Get + - remove-operation: ReplicationExtensionOperationStatus_Get + - remove-operation: VaultOperationStatus_Get + - remove-operation: WorkflowOperationStatus_Get + # Remove anonymous models + - from: recoveryservicesdatareplication.json + where: $.definitions + transform: > + delete $.ProtectedItemModelProperties.properties.currentJob.allOf; + $.ProtectedItemModelProperties.properties.currentJob['$ref'] = '#/definitions/ProtectedItemJobProperties'; + delete $.ProtectedItemModelProperties.properties.lastFailedEnableProtectionJob.allOf; + $.ProtectedItemModelProperties.properties.lastFailedEnableProtectionJob['$ref'] = '#/definitions/ProtectedItemJobProperties'; + delete $.ProtectedItemModelProperties.properties.lastFailedPlannedFailoverJob.allOf; + $.ProtectedItemModelProperties.properties.lastFailedPlannedFailoverJob['$ref'] = '#/definitions/ProtectedItemJobProperties'; + delete $.ProtectedItemModelProperties.properties.lastTestFailoverJob.allOf; + $.ProtectedItemModelProperties.properties.lastTestFailoverJob['$ref'] = '#/definitions/ProtectedItemJobProperties'; + # There are incorrect x-ms-discriminator-value in examples, should fix in the later + - from: recoveryservicesdatareplication.json + where: $.definitions + transform: > + $.GeneralDraModelCustomProperties = { + "description": "General DRA model custom properties.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/DraModelCustomProperties" + } + ], + "x-ms-discriminator-value": "DraModelCustomProperties" + }; + $.GeneralFabricModelCustomProperties = { + "description": "General fabric model custom properties.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/FabricModelCustomProperties" + } + ], + "x-ms-discriminator-value": "FabricModelCustomProperties" + }; + $.GeneralPolicyModelCustomProperties = { + "description": "General Policy model custom properties.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/PolicyModelCustomProperties" + } + ], + "x-ms-discriminator-value": "PolicyModelCustomProperties" + }; + $.GeneralProtectedItemModelCustomProperties = { + "description": "General Protected item model custom properties.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ProtectedItemModelCustomProperties" + } + ], + "x-ms-discriminator-value": "ProtectedItemModelCustomProperties" + }; + $.GeneralPlannedFailoverModelCustomProperties = { + "description": "General planned failover model custom properties.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/PlannedFailoverModelCustomProperties" + } + ], + "x-ms-discriminator-value": "PlannedFailoverModelCustomProperties" + }; + $.GeneralReplicationExtensionModelCustomProperties = { + "description": "General Replication extension model custom properties.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/ReplicationExtensionModelCustomProperties" + } + ], + "x-ms-discriminator-value": "ReplicationExtensionModelCustomProperties" + }; +``` \ No newline at end of file diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/tests/Azure.ResourceManager.RecoveryServicesDataReplication.Tests.csproj b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/tests/Azure.ResourceManager.RecoveryServicesDataReplication.Tests.csproj new file mode 100644 index 000000000000..a758435d13b9 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/tests/Azure.ResourceManager.RecoveryServicesDataReplication.Tests.csproj @@ -0,0 +1,5 @@ + + + + + diff --git a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/tests/RecoveryServicesDataReplicationManagementTestBase.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/tests/RecoveryServicesDataReplicationManagementTestBase.cs new file mode 100644 index 000000000000..86153801e6b1 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/tests/RecoveryServicesDataReplicationManagementTestBase.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.RecoveryServicesDataReplication.Tests +{ + public class RecoveryServicesDataReplicationManagementTestBase : ManagementRecordedTestBase + { + protected ArmClient Client { get; private set; } + protected SubscriptionResource DefaultSubscription { get; private set; } + + protected RecoveryServicesDataReplicationManagementTestBase(bool isAsync, RecordedTestMode mode) + : base(isAsync, mode) + { + } + + protected RecoveryServicesDataReplicationManagementTestBase(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/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/tests/RecoveryServicesDataReplicationManagementTestEnvironment.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/tests/RecoveryServicesDataReplicationManagementTestEnvironment.cs new file mode 100644 index 000000000000..ac2357129247 --- /dev/null +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/tests/RecoveryServicesDataReplicationManagementTestEnvironment.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core.TestFramework; + +namespace Azure.ResourceManager.RecoveryServicesDataReplication.Tests +{ + public class RecoveryServicesDataReplicationManagementTestEnvironment : TestEnvironment + { + } +} \ No newline at end of file diff --git a/sdk/recoveryservices-datareplication/ci.mgmt.yml b/sdk/recoveryservices-datareplication/ci.mgmt.yml new file mode 100644 index 000000000000..d1d25ec16b02 --- /dev/null +++ b/sdk/recoveryservices-datareplication/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/recoveryservicesdatareplication/ci.mgmt.yml + - sdk/recoveryservicesdatareplication/Azure.ResourceManager.RecoveryServicesDataReplication/ + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: recoveryservicesdatareplication + LimitForPullRequest: true + Artifacts: + - name: Azure.ResourceManager.RecoveryServicesDataReplication + safeName: AzureResourceManagerRecoveryServicesDataReplication diff --git a/sdk/resourcemanager/ci.mgmt.yml b/sdk/resourcemanager/ci.mgmt.yml index 0409f75da141..3ff7e90822a1 100644 --- a/sdk/resourcemanager/ci.mgmt.yml +++ b/sdk/resourcemanager/ci.mgmt.yml @@ -140,11 +140,13 @@ trigger: - sdk/quota/Azure.ResourceManager.Quota - sdk/recoveryservices/Azure.ResourceManager.RecoveryServices - sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup + - sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication - sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery - sdk/redis/Azure.ResourceManager.Redis - sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise - sdk/relay/Azure.ResourceManager.Relay - sdk/reservations/Azure.ResourceManager.Reservations + - sdk/resourceconnector/Azure.ResourceManager.ResourceConnector - sdk/resourcegraph/Azure.ResourceManager.ResourceGraph - sdk/resourcehealth/Azure.ResourceManager.ResourceHealth - sdk/resourcemover/Azure.ResourceManager.ResourceMover @@ -660,11 +662,13 @@ pr: - sdk/quota/Azure.ResourceManager.Quota - sdk/recoveryservices/Azure.ResourceManager.RecoveryServices - sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup + - sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication - sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery - sdk/redis/Azure.ResourceManager.Redis - sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise - sdk/relay/Azure.ResourceManager.Relay - sdk/reservations/Azure.ResourceManager.Reservations + - sdk/resourceconnector/Azure.ResourceManager.ResourceConnector - sdk/resourcegraph/Azure.ResourceManager.ResourceGraph - sdk/resourcehealth/Azure.ResourceManager.ResourceHealth - sdk/resourcemover/Azure.ResourceManager.ResourceMover