diff --git a/eng/Packages.Data.props b/eng/Packages.Data.props
index 6db7c956504be..bce2bd466898c 100644
--- a/eng/Packages.Data.props
+++ b/eng/Packages.Data.props
@@ -71,6 +71,8 @@
+
+
@@ -81,6 +83,7 @@
+
diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/Azure.ResourceManager.Core.sln b/sdk/resourcemanager/Azure.ResourceManager.Core/Azure.ResourceManager.Core.sln
new file mode 100644
index 0000000000000..40437f8262ad3
--- /dev/null
+++ b/sdk/resourcemanager/Azure.ResourceManager.Core/Azure.ResourceManager.Core.sln
@@ -0,0 +1,43 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.31019.35
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Core", "..\..\core\Azure.Core\src\Azure.Core.csproj", "{856C6092-55EB-4C02-B7D0-9846EDD70745}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Core.TestFramework", "..\..\core\Azure.Core.TestFramework\src\Azure.Core.TestFramework.csproj", "{62AF7C88-CE3F-416E-B18E-BC6F884C89E2}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Core", "src\Azure.ResourceManager.Core.csproj", "{010FE057-7BB5-4F8C-BB9A-6378144F4CA8}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Core.Tests", "tests\Azure.ResourceManager.Core.Tests.csproj", "{83E7651C-7FBE-45AA-B740-31FE9A3E44C7}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {856C6092-55EB-4C02-B7D0-9846EDD70745}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {856C6092-55EB-4C02-B7D0-9846EDD70745}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {856C6092-55EB-4C02-B7D0-9846EDD70745}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {856C6092-55EB-4C02-B7D0-9846EDD70745}.Release|Any CPU.Build.0 = Release|Any CPU
+ {62AF7C88-CE3F-416E-B18E-BC6F884C89E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {62AF7C88-CE3F-416E-B18E-BC6F884C89E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {62AF7C88-CE3F-416E-B18E-BC6F884C89E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {62AF7C88-CE3F-416E-B18E-BC6F884C89E2}.Release|Any CPU.Build.0 = Release|Any CPU
+ {010FE057-7BB5-4F8C-BB9A-6378144F4CA8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {010FE057-7BB5-4F8C-BB9A-6378144F4CA8}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {010FE057-7BB5-4F8C-BB9A-6378144F4CA8}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {010FE057-7BB5-4F8C-BB9A-6378144F4CA8}.Release|Any CPU.Build.0 = Release|Any CPU
+ {83E7651C-7FBE-45AA-B740-31FE9A3E44C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {83E7651C-7FBE-45AA-B740-31FE9A3E44C7}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {83E7651C-7FBE-45AA-B740-31FE9A3E44C7}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {83E7651C-7FBE-45AA-B740-31FE9A3E44C7}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {FA17550D-A020-4DD7-B3A3-0228FC290A1F}
+ EndGlobalSection
+EndGlobal
diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/CHANGELOG.md b/sdk/resourcemanager/Azure.ResourceManager.Core/CHANGELOG.md
new file mode 100644
index 0000000000000..5c312e4ea9bea
--- /dev/null
+++ b/sdk/resourcemanager/Azure.ResourceManager.Core/CHANGELOG.md
@@ -0,0 +1,5 @@
+# Release History
+
+## 1.0.0-beta.1 (Unreleased)
+
+-Initial checkin
diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/Directory.Build.props b/sdk/resourcemanager/Azure.ResourceManager.Core/Directory.Build.props
new file mode 100644
index 0000000000000..63bd836ad44b7
--- /dev/null
+++ b/sdk/resourcemanager/Azure.ResourceManager.Core/Directory.Build.props
@@ -0,0 +1,6 @@
+
+
+
+
diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/README.md b/sdk/resourcemanager/Azure.ResourceManager.Core/README.md
new file mode 100644
index 0000000000000..d3ec87665ccdf
--- /dev/null
+++ b/sdk/resourcemanager/Azure.ResourceManager.Core/README.md
@@ -0,0 +1,77 @@
+# Azure ResourceManager Core client library for .NET
+
+This package follows the [new Azure SDK guidelines](https://azure.github.io/azure-sdk/general_introduction.html) which provide a number of core capabilities that are shared amongst all Azure SDKs, including the intuitive Azure Identity library, an HTTP Pipeline with custom policies, error-handling, distributed tracing, and much more.
+
+## Getting started
+
+### Install the package
+
+Install the Azure Resources management core library for .NET with [NuGet](https://www.nuget.org/):
+
+```PowerShell
+Install-Package Azure.ResourceManager.Core -Version 1.0.0-beta.1
+```
+
+### Prerequisites
+
+* You must have an [Azure subscription](https://azure.microsoft.com/free/)
+
+### Authenticate the Client
+
+To create an authenticated client and start interacting with Azure resources, please see the [quickstart guide here](https://github.com/Azure/azure-sdk-for-net/blob/master/doc/mgmt_preview_quickstart.md)
+
+## Key concepts
+
+Key concepts of the Azure .NET SDK 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/master/doc/mgmt_preview_quickstart.md)
+- [API References](https://docs.microsoft.com/dotnet/api/?view=azure-dotnet)
+- [Authentication](https://github.com/Azure/azure-sdk-for-net/blob/master/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://docs.microsoft.com/samples/browse/?branch=master&languages=csharp&term=managing%20using%20Azure%20.NET%20SDK)
+
+## 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 on Azure SDK, please refer to [this website](https://azure.github.io/azure-sdk/)
+
+## Contributing
+
+For details on contributing to this repository, see the contributing
+guide.
+
+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
+(e.g., label, comment). Simply follow the instructions provided by the
+bot. You will only need to do this once across all repositories using
+our CLA.
+
+This project has adopted the Microsoft Open Source Code of Conduct. For
+more information see the Code of Conduct FAQ or contact
+ with any additional questions or comments.
+
+
+[style-guide-msft]: https://docs.microsoft.com/style-guide/capitalization
+[style-guide-cloud]: https://aka.ms/azsdk/cloud-style-guide
+
+![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-net%2Fsdk%2Ftemplate%2FAzure.Template%2FREADME.png)
diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/Adapters/PhArmResponse.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/Adapters/PhArmResponse.cs
new file mode 100644
index 0000000000000..c764cedd3366f
--- /dev/null
+++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/Adapters/PhArmResponse.cs
@@ -0,0 +1,41 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+using System;
+
+namespace Azure.ResourceManager.Core
+{
+ ///
+ /// Placeholder class, used to convert the gewneric type argument for a response from the underlyign rest API to the
+ /// desired type argument in the response
+ ///
+ /// The to convert the TModel into.
+ /// The model returned by the existing serivce calls.
+ public class PhArmResponse : ArmResponse
+ where TOperations : class
+ where TModel : class
+ {
+ private readonly Func _converter;
+ private readonly Response _wrapped;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The results to wrap.
+ /// The function used to convert from existing type to new type.
+ public PhArmResponse(Response wrapped, Func converter)
+ {
+ _wrapped = wrapped;
+ _converter = converter;
+ }
+
+ ///
+ public override TOperations Value => _converter(_wrapped.Value);
+
+ ///
+ public override Response GetRawResponse()
+ {
+ return _wrapped.GetRawResponse();
+ }
+ }
+}
diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/Adapters/PhTaskDeferringAsyncPageable.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/Adapters/PhTaskDeferringAsyncPageable.cs
new file mode 100644
index 0000000000000..0740e1668a50c
--- /dev/null
+++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/Adapters/PhTaskDeferringAsyncPageable.cs
@@ -0,0 +1,39 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+namespace Azure.ResourceManager.Core.Adapters
+{
+ ///
+ /// A class repreesnting an AsyncPageable that executes a given task before retrieving the first page of results
+ ///
+ /// The type of that will be returned.
+ public class PhTaskDeferringAsyncPageable : AsyncPageable
+ where TOperations : notnull
+ {
+ private readonly Func>> _task;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The function to execute returning the AsyncPageable task.
+ public PhTaskDeferringAsyncPageable(Func>> task)
+ {
+ _task = task;
+ }
+
+ ///
+ public override async IAsyncEnumerable> AsPages(
+ string continuationToken = null,
+ int? pageSizeHint = null)
+ {
+ await foreach (var page in (await _task().ConfigureAwait(false)).AsPages().ConfigureAwait(false))
+ {
+ yield return page;
+ }
+ }
+ }
+}
diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/Adapters/PhWrappingAsyncPageable.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/Adapters/PhWrappingAsyncPageable.cs
new file mode 100644
index 0000000000000..a15098cf7eee5
--- /dev/null
+++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/Adapters/PhWrappingAsyncPageable.cs
@@ -0,0 +1,60 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace Azure.ResourceManager.Core
+{
+ ///
+ /// Returns an AsyncPageable that transforms each page of contents after they are retrieved from the server
+ /// according to the profived transformation function
+ ///
+ /// The model returned by existing AsyncPageable methods.
+ /// The to convert TModel into.
+ public class PhWrappingAsyncPageable : AsyncPageable
+ where TOperations : class
+ where TModel : class
+ {
+ private readonly Func _converter;
+ private readonly IEnumerable> _wrapped;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The results to wrap.
+ /// The function used to convert from existing type to new type.
+ public PhWrappingAsyncPageable(AsyncPageable wrapped, Func converter)
+ {
+ _wrapped = new[] { wrapped };
+ _converter = converter;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The results to wrap.
+ /// The function used to convert from existing type to new type.
+ public PhWrappingAsyncPageable(IEnumerable> wrapped, Func converter)
+ {
+ _wrapped = wrapped;
+ _converter = converter;
+ }
+
+ ///
+ public override async IAsyncEnumerable> AsPages(
+ string continuationToken = null,
+ int? pageSizeHint = null)
+ {
+ foreach (var pageEnum in _wrapped)
+ {
+ await foreach (var page in pageEnum.AsPages().WithCancellation(CancellationToken))
+ {
+ yield return new WrappingPage(page, _converter);
+ }
+ }
+ }
+ }
+}
diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/Adapters/PhWrappingPageable.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/Adapters/PhWrappingPageable.cs
new file mode 100644
index 0000000000000..c11077cb01072
--- /dev/null
+++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/Adapters/PhWrappingPageable.cs
@@ -0,0 +1,57 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+using System;
+using System.Collections.Generic;
+
+namespace Azure.ResourceManager.Core
+{
+ ///
+ /// This class allows performing conversions on pages of data as they are accessed - used in the prototype to convett
+ /// between underlying model types and the new model types that extend Resource,
+ /// and also for returning Operations classes for those underlying objects.
+ ///
+ /// The type parameter of the Pageable we are wrapping.
+ /// The desired type parameter of the returned pageable.
+ public class PhWrappingPageable : Pageable
+ where TOperations : class
+ where TModel : class
+ {
+ private readonly Func _converter;
+ private readonly IEnumerable> _wrapped;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The results to wrap.
+ /// The function used to convert from existing type to new type.
+ public PhWrappingPageable(Pageable wrapped, Func converter)
+ {
+ _wrapped = new[] { wrapped };
+ _converter = converter;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The results to wrap.
+ /// The function used to convert from existing type to new type.
+ public PhWrappingPageable(IEnumerable> wrapped, Func converter)
+ {
+ _wrapped = wrapped;
+ _converter = converter;
+ }
+
+ ///
+ public override IEnumerable> AsPages(string continuationToken = null, int? pageSizeHint = null)
+ {
+ foreach (var pages in _wrapped)
+ {
+ foreach (var page in pages.AsPages())
+ {
+ yield return new WrappingPage(page, _converter);
+ }
+ }
+ }
+ }
+}
diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/Adapters/ProxyResource.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/Adapters/ProxyResource.cs
new file mode 100644
index 0000000000000..ac7ce5335c1b4
--- /dev/null
+++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/Adapters/ProxyResource.cs
@@ -0,0 +1,62 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+namespace Azure.ResourceManager.Core
+{
+ ///
+ /// A class representing a generic proxy resource in Azure
+ ///
+ /// The type of the underlying model this class wraps
+ public abstract class ProxyResource : Resource
+ where TModel : class
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The identifier of the resource that is the target of operations.
+ /// The model to copy from.
+ protected ProxyResource(ResourceIdentifier id, TModel data)
+ {
+ Id = id;
+ Model = data;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The identifier of the resource that is the target of operations.
+ /// The model to copy from.
+ protected ProxyResource(string id, TModel data)
+ {
+ if (ReferenceEquals(id, null))
+ {
+ Id = null;
+ }
+ else
+ {
+ Id = id;
+ }
+
+ Model = data;
+ }
+
+ ///
+ /// Gets or sets the identifier for the resource.
+ ///
+ public override ResourceIdentifier Id { get; protected set; }
+
+ ///
+ /// Gets or sets the Model this resource is based off.
+ ///
+ public virtual TModel Model { get; set; }
+
+ ///
+ /// Converts from a into the TModel.
+ ///
+ /// The tracked resource convert from.
+ public static implicit operator TModel(ProxyResource other)
+ {
+ return other.Model;
+ }
+ }
+}
diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/Adapters/TrackedResource.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/Adapters/TrackedResource.cs
new file mode 100644
index 0000000000000..f6aed917167f9
--- /dev/null
+++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/Adapters/TrackedResource.cs
@@ -0,0 +1,63 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+using Azure.ResourceManager.Resources.Models;
+
+namespace Azure.ResourceManager.Core
+{
+ ///
+ /// A class representing a generic tracked resource in Azure.
+ ///
+ /// The type of the underlying model this class wraps
+ public abstract class TrackedResource : TrackedResource
+ where TModel : class
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The identifier of the resource that is the target of operations.
+ /// The location of the resource.
+ /// The model to copy from.
+ protected TrackedResource(ResourceIdentifier id, LocationData location, TModel data)
+ {
+ Id = id;
+ Location = location;
+ Model = data;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The identifier of the resource that is the target of operations.
+ /// The location of the resource.
+ /// The model to copy from.
+ protected TrackedResource(string id, LocationData location, TModel data)
+ {
+ if (ReferenceEquals(id, null))
+ {
+ Id = null;
+ }
+ else
+ {
+ Id = id;
+ }
+
+ Location = location;
+ Model = data;
+ }
+
+ ///
+ /// Gets or sets the Model this resource is based off.
+ ///
+ public virtual TModel Model { get; set; }
+
+ ///
+ /// Converts from a into the TModel.
+ ///
+ /// The tracked resource convert from.
+ public static implicit operator TModel(TrackedResource other)
+ {
+ return other.Model;
+ }
+ }
+}
diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/Adapters/WrappingPage.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/Adapters/WrappingPage.cs
new file mode 100644
index 0000000000000..821f8aaff7255
--- /dev/null
+++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/Adapters/WrappingPage.cs
@@ -0,0 +1,46 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+using System;
+using System.Collections.Generic;
+using System.Collections.Immutable;
+using System.Linq;
+
+namespace Azure.ResourceManager.Core
+{
+ ///
+ /// A class representing a wrapper over
+ ///
+ /// The type parameter we are wrapping.
+ /// The desired type parameter of the returned page.
+ internal class WrappingPage : Page
+ where TOperations : class
+ where TModel : class
+ {
+ private readonly Func _converter;
+ private readonly Page _wrapped;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The results to wrap.
+ /// The function used to convert from existing type to new type.
+ internal WrappingPage(Page wrapped, Func converter)
+ {
+ _wrapped = wrapped;
+ _converter = converter;
+ }
+
+ ///
+ public override IReadOnlyList Values => _wrapped.Values.Select(_converter).ToImmutableList();
+
+ ///
+ public override string ContinuationToken => _wrapped.ContinuationToken;
+
+ ///
+ public override Response GetRawResponse()
+ {
+ return _wrapped.GetRawResponse();
+ }
+ }
+}
diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/ApiVersionsBase.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/ApiVersionsBase.cs
new file mode 100644
index 0000000000000..d542b5b532a00
--- /dev/null
+++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/ApiVersionsBase.cs
@@ -0,0 +1,204 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+using System;
+using System.Text.RegularExpressions;
+
+namespace Azure.ResourceManager.Core
+{
+ ///
+ /// A class representing Azure resource API versions base.
+ ///
+ public class ApiVersionsBase : IEquatable, IComparable
+ {
+ private readonly string _value;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The API version value.
+ protected ApiVersionsBase(string value)
+ {
+ _value = value;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static bool operator <(ApiVersionsBase left, ApiVersionsBase right)
+ {
+ if (left is null)
+ return true;
+
+ return left.CompareTo(right) == -1;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static bool operator >(ApiVersionsBase left, ApiVersionsBase right)
+ {
+ if (left is null)
+ return false;
+
+ return left.CompareTo(right) == 1;
+ }
+
+ ///
+ /// Implicit operator to convert ApiVersionsBase to string.
+ ///
+ /// The ApiVersionsBase object.
+ /// API version value.
+ public static implicit operator string(ApiVersionsBase version)
+ {
+ return version._value;
+ }
+
+ ///
+ /// Overrides == operator for comparing ApiVersionsBase object with string object.
+ ///
+ /// The ApiVersionsBase object to compare.
+ /// The API version value in string to compare.
+ /// Comparison result in boolean. Equal returns true otherwise returns false.
+ public static bool operator ==(ApiVersionsBase first, string second)
+ {
+ if (ReferenceEquals(null, first))
+ {
+ return ReferenceEquals(null, second);
+ }
+
+ if (ReferenceEquals(null, second))
+ {
+ return false;
+ }
+
+ return first.Equals(second);
+ }
+
+ ///
+ /// Overrides != operator for comparing ApiVersionsBase object with string object.
+ ///
+ /// The ApiVersionsBase object to compare.
+ /// The API version value in string to compare.
+ /// Comparison result in boolean. Equal returns false otherwise returns true.
+ public static bool operator !=(ApiVersionsBase first, string second)
+ {
+ if (ReferenceEquals(null, first))
+ {
+ return !ReferenceEquals(null, second);
+ }
+
+ if (ReferenceEquals(null, second))
+ {
+ return true;
+ }
+
+ return !first.Equals(second);
+ }
+
+ ///
+ /// Compares two API version values in string type.
+ ///
+ /// The API version value to compare.
+ /// Comparison result in integer. 1 for greater than, 0 for equals to, and -1 for less than.
+ public int CompareTo(string other)
+ {
+ if (other == null)
+ {
+ return 1;
+ }
+
+ var regPattern = @"(\d\d\d\d-\d\d-\d\d)(.*)";
+
+ var otherMatch = Regex.Match(other, regPattern);
+ var thisMatch = Regex.Match(_value, regPattern);
+
+ var otherDatePart = otherMatch.Groups[1].Value;
+ var thisDatePart = thisMatch.Groups[1].Value;
+
+ if (otherDatePart == thisDatePart)
+ {
+ var otherPreviewPart = otherMatch.Groups[2].Value;
+ var thisPreviewPart = thisMatch.Groups[2].Value;
+
+ if (otherPreviewPart == thisPreviewPart)
+ {
+ return 0;
+ }
+
+ if (string.IsNullOrEmpty(otherPreviewPart))
+ {
+ return -1;
+ }
+
+ if (string.IsNullOrEmpty(thisPreviewPart))
+ {
+ return 1;
+ }
+
+ return string.Compare(thisPreviewPart, otherPreviewPart, StringComparison.InvariantCulture);
+ }
+
+ return string.Compare(thisDatePart, otherDatePart, StringComparison.InvariantCulture);
+ }
+
+ ///
+ /// Compares the API version value in ApiVersionsBase object and the one in string.
+ ///
+ /// The API version value to compare.
+ /// Comparison result in boolean. Equal returns true otherwise returns false.
+ public bool Equals(string other)
+ {
+ if (other == null)
+ {
+ return false;
+ }
+
+ return other == _value;
+ }
+
+ ///
+ /// Converts ApiVersionsBase object to string.
+ ///
+ /// The API version value.
+ public override string ToString()
+ {
+ return _value;
+ }
+
+ ///
+ /// Compares the API version value in ApiVersionsBase object and the one in object.
+ ///
+ /// The object to compare.
+ /// Comparison result in boolean. Equal returns true otherwise returns false.
+ public override bool Equals(object obj)
+ {
+ if (obj is ApiVersionsBase)
+ {
+ return Equals(obj as ApiVersionsBase);
+ }
+
+ if (obj is string)
+ {
+ return Equals(obj as string);
+ }
+
+ return false;
+ }
+
+ ///
+ /// Gets the hash code of the API version value.
+ ///
+ /// The hash code of the API version value.
+ public override int GetHashCode()
+ {
+ return _value.GetHashCode();
+ }
+ }
+}
diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/ArmBuilder.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/ArmBuilder.cs
new file mode 100644
index 0000000000000..353a316d5b792
--- /dev/null
+++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/ArmBuilder.cs
@@ -0,0 +1,162 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace Azure.ResourceManager.Core
+{
+ ///
+ /// A class representing a builder object used to create Azure resources.
+ ///
+ /// The type of the operations class for a specific resource.
+ /// The type of the class containing properties for the underlying resource.
+ public class ArmBuilder
+ where TResource : Resource
+ where TOperations : ResourceOperationsBase
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The container object to create the resource in.
+ /// The resource to create.
+ public ArmBuilder(ResourceContainerBase container, TResource resource)
+ {
+ Resource = resource;
+ UnTypedContainer = container;
+ }
+
+ ///
+ /// Gets the resource object to create.
+ ///
+ protected TResource Resource { get; private set; }
+
+ ///
+ /// Gets the resource name.
+ ///
+ protected string ResourceName { get; private set; }
+
+ ///
+ /// Gets the container object to create the resource in.
+ ///
+ protected ResourceContainerBase UnTypedContainer { get; private set; }
+
+ ///
+ /// Creates the resource object to send to the Azure API.
+ ///
+ /// The resource to create.
+ public TResource Build()
+ {
+ ThrowIfNotValid();
+ OnBeforeBuild();
+ InternalBuild();
+ OnAfterBuild();
+
+ return Resource;
+ }
+
+ ///
+ /// The operation to create or update a resource. Please note some properties can be set only during creation.
+ ///
+ /// The name of the new resource to create.
+ /// A response with the operation for this resource.
+ public ArmResponse CreateOrUpdate(string name)
+ {
+ ResourceName = name;
+ Resource = Build();
+
+ return UnTypedContainer.CreateOrUpdate(name, Resource);
+ }
+
+ ///
+ /// The operation to create or update a resource. Please note some properties can be set only during creation.
+ ///
+ /// The name of the new resource to create.
+ /// A token to allow the caller to cancel the call to the service. The default value is .
+ /// A that on completion returns a response with the operation for this resource.
+ public async Task> CreateOrUpdateAsync(
+ string name,
+ CancellationToken cancellationToken = default)
+ {
+ ResourceName = name;
+ Resource = Build();
+
+ return await UnTypedContainer.CreateOrUpdateAsync(name, Resource, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// The operation to create or update a resource. Please note some properties can be set only during creation.
+ ///
+ /// The name of the new resource to create.
+ /// A token to allow the caller to cancel the call to the service. The default value is .
+ /// An that allows polling for completion of the operation.
+ ///
+ /// Details on long running operation object.
+ ///
+ public ArmOperation StartCreateOrUpdate(string name, CancellationToken cancellationToken = default)
+ {
+ ResourceName = name;
+ Resource = Build();
+
+ return UnTypedContainer.StartCreateOrUpdate(name, Resource, cancellationToken);
+ }
+
+ ///
+ /// The operation to create or update a resource. Please note some properties can be set only during creation.
+ ///
+ /// The name of the new resource to create.
+ /// A token to allow the caller to cancel the call to the service. The default value is .
+ /// A that on completion returns an that allows polling for completion of the operation.
+ ///
+ /// Details on long running operation object.
+ ///
+ public async Task> StartCreateOrUpdateAsync(
+ string name,
+ CancellationToken cancellationToken = default)
+ {
+ ResourceName = name;
+ Resource = Build();
+
+ return await UnTypedContainer.StartCreateOrUpdateAsync(name, Resource, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// Determines whether or not the resource is valid.
+ ///
+ /// The message indicating what is wrong with the resource.
+ /// Whether or not the resource is valid.
+ protected virtual bool IsValid(out string message)
+ {
+ message = string.Empty;
+
+ return true;
+ }
+
+ ///
+ /// Perform any tasks necessary after the resource is built
+ ///
+ protected virtual void OnAfterBuild()
+ {
+ }
+
+ ///
+ /// Perform any tasks necessary before the resource is built
+ ///
+ protected virtual void OnBeforeBuild()
+ {
+ }
+
+ private static void InternalBuild()
+ {
+ }
+
+ private void ThrowIfNotValid()
+ {
+ if (!IsValid(out var message))
+ {
+ throw new InvalidOperationException(message);
+ }
+ }
+ }
+}
diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/ArmOperation.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/ArmOperation.cs
new file mode 100644
index 0000000000000..18caabd837a3c
--- /dev/null
+++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/ArmOperation.cs
@@ -0,0 +1,32 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+namespace Azure.ResourceManager.Core
+{
+ ///
+ /// Abstract class for long-running or synchronous applications.
+ ///
+ /// The to return representing the result of the ArmOperation.
+ public abstract class ArmOperation : Operation
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The representing the result of the ArmOperation.
+ protected ArmOperation(TOperations syncValue)
+ {
+ CompletedSynchronously = syncValue != null;
+ SyncValue = syncValue;
+ }
+
+ ///
+ /// Gets a value indicating whether or not the operation completed synchronously.
+ ///
+ protected bool CompletedSynchronously { get; }
+
+ ///
+ /// Gets the representing the result of the ArmOperation.
+ ///
+ protected TOperations SyncValue { get; }
+ }
+}
diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/ArmResponse.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/ArmResponse.cs
new file mode 100644
index 0000000000000..d130fc8186316
--- /dev/null
+++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/ArmResponse.cs
@@ -0,0 +1,40 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+namespace Azure.ResourceManager.Core
+{
+ ///
+ /// A class representing a response object from azure resource manager service.
+ ///
+ public sealed class ArmResponse : ArmResponse
+ {
+ private readonly Response _response;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The azure response object to wrap.
+ public ArmResponse(Response response)
+ {
+ _response = response;
+ }
+
+ ///
+ public override Response Value => _response;
+
+ ///
+ public override Response GetRawResponse()
+ {
+ return _response;
+ }
+ }
+
+ ///
+ /// A class representing a response object from azure resource manager service.
+ ///
+ /// The operations object return by the api call.
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1402:File may only contain a single type", Justification = "Allowed when we have a generic version of the same type")]
+ public abstract class ArmResponse : Response
+ {
+ }
+}
diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/ArmVoidOperation.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/ArmVoidOperation.cs
new file mode 100644
index 0000000000000..bbab26ea2456e
--- /dev/null
+++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/ArmVoidOperation.cs
@@ -0,0 +1,111 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace Azure.ResourceManager.Core
+{
+ ///
+ /// Generic ARM long running operation class for operations with no returned value
+ ///
+ public sealed class ArmVoidOperation : ArmOperation
+ {
+ private readonly Operation _wrapped;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The operation that has a response which has no body.
+ public ArmVoidOperation(Operation other)
+ : base(null)
+ {
+ _wrapped = other;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The response which has no body.
+ public ArmVoidOperation(Response other)
+ : base(other)
+ {
+ }
+
+ ///
+ public override string Id => _wrapped?.Id;
+
+ ///
+ public override Response Value => SyncValue;
+
+ ///
+ public override bool HasCompleted => CompletedSynchronously || _wrapped.HasCompleted;
+
+ ///
+ public override bool HasValue => CompletedSynchronously || _wrapped.HasValue;
+
+ ///
+ public override Response GetRawResponse()
+ {
+ return CompletedSynchronously ? SyncValue : _wrapped.GetRawResponse();
+ }
+
+ ///
+ public override Response UpdateStatus(CancellationToken cancellationToken = default)
+ {
+ return CompletedSynchronously ? SyncValue : _wrapped.UpdateStatus(cancellationToken);
+ }
+
+ ///
+ public override async ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default)
+ {
+ return CompletedSynchronously ? SyncValue : await _wrapped.UpdateStatusAsync(cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ public override async ValueTask> WaitForCompletionAsync(
+ CancellationToken cancellationToken = default)
+ {
+ return CompletedSynchronously
+ ? new WrappingResponse(SyncValue)
+ : await _wrapped.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ public override async ValueTask> WaitForCompletionAsync(
+ TimeSpan pollingInterval,
+ CancellationToken cancellationToken)
+ {
+ return CompletedSynchronously
+ ? new WrappingResponse(SyncValue)
+ : await _wrapped.WaitForCompletionAsync(pollingInterval, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// A class which wraps a response with no body.
+ ///
+ internal class WrappingResponse : ArmResponse
+ {
+ private readonly Response _wrapped;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The response object to wrap.
+ public WrappingResponse(Response wrapped)
+ {
+ _wrapped = wrapped;
+ }
+
+ ///
+ public override Response Value => _wrapped;
+
+ ///
+ public override Response GetRawResponse()
+ {
+ return _wrapped;
+ }
+ }
+ }
+}
diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/Azure.ResourceManager.Core.csproj b/sdk/resourcemanager/Azure.ResourceManager.Core/src/Azure.ResourceManager.Core.csproj
new file mode 100644
index 0000000000000..364c9d64f576c
--- /dev/null
+++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/Azure.ResourceManager.Core.csproj
@@ -0,0 +1,22 @@
+
+
+
+ 1.0.0-beta.1
+ Azure.ResourceManager.Core
+
+ Azure management core SDK for Azure resources.
+ This is a beta preview vesion. This version uses a next-generation code generator that introduces important breaking changes, but also new features (such as intuitive authentication, custom HTTP pipeline, distributed tracing and much more).
+
+ azure;management;resource
+ $(NoWarn);AZC0008;AZC0001;AZC0107;CA2214;CA1036;CA1067;CA1065;SA1028
+ true
+
+
+
+
+
+
+
+
+
+
diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/AzureResourceManagerClient.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/AzureResourceManagerClient.cs
new file mode 100644
index 0000000000000..e5db0c8bee2e7
--- /dev/null
+++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/AzureResourceManagerClient.cs
@@ -0,0 +1,185 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+using Azure.Core;
+using Azure.Identity;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+
+namespace Azure.ResourceManager.Core
+{
+ ///
+ /// The entry point for all ARM clients.
+ ///
+ public class AzureResourceManagerClient
+ {
+ ///
+ /// The base URI of the service.
+ ///
+ internal const string DefaultUri = "https://management.azure.com";
+
+ private readonly TokenCredential _credentials;
+
+ private readonly Uri _baseUri;
+
+ ///
+ /// Initializes a new instance of the class for mocking.
+ ///
+ protected AzureResourceManagerClient()
+ : this(null, null, new DefaultAzureCredential(), new AzureResourceManagerClientOptions())
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The client parameters to use in these operations.
+ public AzureResourceManagerClient(AzureResourceManagerClientOptions options = default)
+ : this(null, null, new DefaultAzureCredential(), options)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// A credential used to authenticate to an Azure Service.
+ /// The client parameters to use in these operations.
+ public AzureResourceManagerClient(TokenCredential credential, AzureResourceManagerClientOptions options = default)
+ : this(null, null, credential, options)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The id of the default Azure subscription.
+ /// A credential used to authenticate to an Azure Service.
+ /// The client parameters to use in these operations.
+ public AzureResourceManagerClient(string defaultSubscriptionId, TokenCredential credential, AzureResourceManagerClientOptions options = default)
+ : this(defaultSubscriptionId, null, credential, options)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The base URI of the service.
+ /// A credential used to authenticate to an Azure Service.
+ /// The client parameters to use in these operations.
+ public AzureResourceManagerClient(Uri baseUri, TokenCredential credential, AzureResourceManagerClientOptions options = default)
+ : this(null, baseUri, credential, options)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The id of the default Azure subscription.
+ /// The base URI of the service.
+ /// A credential used to authenticate to an Azure Service.
+ /// The client parameters to use in these operations.
+ private AzureResourceManagerClient(string defaultSubscriptionId, Uri baseUri, TokenCredential credential, AzureResourceManagerClientOptions options = default)
+ {
+ _credentials = credential;
+ _baseUri = baseUri;
+ ClientOptions = options ?? new AzureResourceManagerClientOptions();
+
+ if (string.IsNullOrWhiteSpace(defaultSubscriptionId))
+ {
+ DefaultSubscription = GetDefaultSubscription();
+ }
+ else
+ {
+ DefaultSubscription = GetSubscriptionOperations(defaultSubscriptionId).Get().Value;
+ }
+
+ ApiVersionOverrides = new Dictionary();
+ }
+
+ ///
+ /// Gets the Api version overrides.
+ ///
+ public Dictionary ApiVersionOverrides { get; private set; }
+
+ ///
+ /// Gets the default Azure subscription.
+ ///
+ public Subscription DefaultSubscription { get; private set; }
+
+ ///
+ /// Gets the Azure resource manager client options.
+ ///
+ internal AzureResourceManagerClientOptions ClientOptions { get; }
+
+ ///
+ /// Gets the Azure subscription operations.
+ ///
+ /// The guid of the subscription.
+ /// Subscription operations.
+ public SubscriptionOperations GetSubscriptionOperations(string subscriptionGuid) => new SubscriptionOperations(
+ ClientOptions,
+ subscriptionGuid,
+ _credentials,
+ _baseUri);
+
+ ///
+ /// Gets the Azure subscriptions.
+ ///
+ /// Subscription container.
+ public SubscriptionContainer GetSubscriptionContainer()
+ {
+ return new SubscriptionContainer(ClientOptions, _credentials, _baseUri);
+ }
+
+ ///
+ /// Gets resource group operations.
+ ///
+ /// The id of the Azure subscription.
+ /// The resource group name.
+ /// Resource group operations.
+ public ResourceGroupOperations GetResourceGroupOperations(string subscriptionGuid, string resourceGroupName)
+ {
+ return GetSubscriptionOperations(subscriptionGuid).GetResourceGroupOperations(resourceGroupName);
+ }
+
+ ///
+ /// Gets resource group operations.
+ ///
+ /// The resource identifier of the resource group.
+ /// Resource group operations.
+ public ResourceGroupOperations GetResourceGroupOperations(ResourceIdentifier resourceGroupId)
+ {
+ return GetSubscriptionOperations(resourceGroupId.Subscription).GetResourceGroupOperations(resourceGroupId.ResourceGroup);
+ }
+
+ ///
+ /// Gets resource operations base.
+ ///
+ /// The type of the underlying model this class wraps.
+ /// The id of the Azure subscription.
+ /// The resource group name.
+ /// The resource type name.
+ /// Resource operations of the resource.
+ public T GetResourceOperations(string subscription, string resourceGroup, string name)
+ where T : OperationsBase
+ {
+ var rgOp = GetSubscriptionOperations(subscription).GetResourceGroupOperations(resourceGroup);
+ return Activator.CreateInstance(
+ typeof(T),
+ System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance,
+ null,
+ new object[] { rgOp, name },
+ CultureInfo.InvariantCulture) as T;
+ }
+
+ private Subscription GetDefaultSubscription()
+ {
+ var sub = GetSubscriptionContainer().List().FirstOrDefault();
+ if (sub is null)
+ throw new Exception("No subscriptions found for the given credentials");
+ return sub;
+ }
+ }
+}
diff --git a/sdk/resourcemanager/Azure.ResourceManager.Core/src/AzureResourceManagerClientOptions.cs b/sdk/resourcemanager/Azure.ResourceManager.Core/src/AzureResourceManagerClientOptions.cs
new file mode 100644
index 0000000000000..2b6e0a8a2753a
--- /dev/null
+++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/AzureResourceManagerClientOptions.cs
@@ -0,0 +1,156 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+using Azure.Core;
+using Azure.Core.Pipeline;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+
+namespace Azure.ResourceManager.Core
+{
+ ///
+ /// A class representing Azure resource manager client options.
+ ///
+ public sealed class AzureResourceManagerClientOptions : ClientOptions
+ {
+ private static readonly object _overridesLock = new object();
+
+ private Dictionary _overrides = new Dictionary();
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public AzureResourceManagerClientOptions()
+ : this(LocationData.Default, null)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The default location to use if can't be inherited from parent.
+ public AzureResourceManagerClientOptions(LocationData defaultLocation)
+ : this(defaultLocation, null)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The default location to use if can't be inherited from parent.
+ /// The client parameters to use in these operations.
+ internal AzureResourceManagerClientOptions(LocationData defaultLocation, AzureResourceManagerClientOptions other = null)
+ {
+ // Will go away when moved into core since we will have directy acces the policies and transport, so just need to set those
+ if (!ReferenceEquals(other, null))
+ Copy(other);
+ DefaultLocation = defaultLocation;
+ }
+
+ ///
+ /// Gets the default location to use if can't be inherited from parent.
+ ///
+ public LocationData DefaultLocation { get; }
+
+ ///
+ /// Gets each http call policies.
+ ///
+ /// A collection of http pipeline policy that may take multiple service requests to iterate over.
+ internal IList PerCallPolicies { get; } = new List();
+
+ ///
+ /// Gets each http retry call policies.
+ ///
+ /// A collection of http pipeline policy that may take multiple service requests to iterate over.
+ internal IList PerRetryPolicies { get; } = new List();
+
+ ///
+ /// Converts client options.
+ ///
+ /// The type of the underlying model this class wraps.
+ /// The converted client options.
+ public T Convert()
+ where T : ClientOptions, new()
+ {
+ var newOptions = new T();
+ newOptions.Transport = Transport;
+ foreach (var pol in PerCallPolicies)
+ {
+ newOptions.AddPolicy(pol, HttpPipelinePosition.PerCall);
+ }
+
+ foreach (var pol in PerRetryPolicies)
+ {
+ newOptions.AddPolicy(pol, HttpPipelinePosition.PerRetry);
+ }
+
+ return newOptions;
+ }
+
+ ///
+ /// Adds a policy for Azure resource manager client http call.
+ ///
+ /// The http call policy in the pipeline.
+ /// The position of the http call policy in the pipeline.
+ public new void AddPolicy(HttpPipelinePolicy policy, HttpPipelinePosition position)
+ {
+ // TODO policy lists are internal hence we don't have acces to them by inheriting ClientOptions in this Asembly, this is a wrapper for now to convert to the concrete
+ // policy options.
+ switch (position)
+ {
+ case HttpPipelinePosition.PerCall:
+ PerCallPolicies.Add(policy);
+ break;
+ case HttpPipelinePosition.PerRetry:
+ PerRetryPolicies.Add(policy);
+ break;
+ default:
+ throw new ArgumentOutOfRangeException(nameof(position), position, null);
+ }
+
+ base.AddPolicy(policy, position);
+ }
+
+ ///
+ /// Gets override object.
+ ///
+ /// The type of the underlying model this class wraps.
+ /// A function which returns an object.
+ /// The override object.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public object GetOverrideObject(Func