From dd487188e0de9d570f6c0ad7c5ee79504da8d4d9 Mon Sep 17 00:00:00 2001
From: m-nash <64171366+m-nash@users.noreply.github.com>
Date: Tue, 23 Feb 2021 14:46:24 -0800
Subject: [PATCH 01/18] initial checkin for core / tests
---
eng/Packages.Data.props | 9 +-
.../Azure.ResourceManager.Core.sln | 43 ++
.../Directory.Build.props | 6 +
.../src/Adapters/PhArmResponse.cs | 41 ++
.../Adapters/PhTaskDeferringAsyncPageable.cs | 39 ++
.../src/Adapters/PhWrappingAsyncPageable.cs | 60 +++
.../src/Adapters/PhWrappingPageable.cs | 57 +++
.../src/Adapters/ProxyResource.cs | 62 +++
.../src/Adapters/TrackedResource.cs | 63 +++
.../src/Adapters/WrappingPage.cs | 46 ++
.../src/ApiVersionsBase.cs | 204 ++++++++
.../src/ArmBuilder.cs | 162 ++++++
.../src/ArmOperation.cs | 32 ++
.../src/ArmResponse.cs | 40 ++
.../src/ArmVoidOperation.cs | 111 +++++
.../src/Azure.ResourceManager.Core.csproj | 21 +
.../src/AzureResourceManagerClient.cs | 185 +++++++
.../src/AzureResourceManagerClientOptions.cs | 156 ++++++
.../src/ContainerBase.cs | 92 ++++
.../src/ExtensionResourceContainer.cs | 100 ++++
.../src/ExtensionResourceOperationsBase.cs | 93 ++++
.../src/GenericResource.cs | 41 ++
.../src/GenericResourceData.cs | 101 ++++
.../src/GenericResourceOperations.cs | 231 +++++++++
.../src/IDeletableResource.cs | 51 ++
.../src/ITaggableResource.cs | 114 +++++
.../src/OperationsBase.cs | 73 +++
.../src/Placeholder/PhArmOperation.cs | 102 ++++
.../src/Placeholder/ResourceGroupData.cs | 67 +++
.../src/Placeholder/SubscriptionData.cs | 74 +++
.../src/Properties/AssemblyInfo.cs | 6 +
.../src/ResourceContainerBase.cs | 122 +++++
.../src/ResourceGroup.cs | 41 ++
.../src/ResourceGroupContainer.cs | 108 ++++
.../src/ResourceGroupOperations.cs | 406 ++++++++++++++++
.../src/ResourceListOperations.cs | 202 ++++++++
.../src/ResourceOperationsBase.cs | 164 +++++++
.../src/Resources/GenericResourceFilter.cs | 26 +
.../src/Resources/KnownKeys.cs | 43 ++
.../src/Resources/LocationContainer.cs | 61 +++
.../src/Resources/LocationData.cs | 460 ++++++++++++++++++
.../src/Resources/Plan.cs | 110 +++++
.../src/Resources/Resource.cs | 71 +++
.../src/Resources/ResourceFilterCollection.cs | 70 +++
.../src/Resources/ResourceIdentifier.cs | 291 +++++++++++
.../src/Resources/ResourceIdentity.cs | 236 +++++++++
.../src/Resources/ResourceNameFilter.cs | 71 +++
.../src/Resources/ResourceTagFilter.cs | 65 +++
.../src/Resources/ResourceType.cs | 325 +++++++++++++
.../src/Resources/ResourceTypeFilter.cs | 45 ++
.../src/Resources/Sku.cs | 110 +++++
.../src/Resources/SystemAssignedIdentity.cs | 162 ++++++
.../src/Resources/TrackedResource.cs | 30 ++
.../src/Resources/UserAssignedIdentity.cs | 146 ++++++
.../src/Subscription.cs | 41 ++
.../src/SubscriptionContainer.cs | 93 ++++
.../src/SubscriptionOperations.cs | 106 ++++
.../src/autorest.md | 12 +
.../tests/ApiVersionsBaseTests.cs | 216 ++++++++
.../tests/ArmClientOptionsTests.cs | 25 +
.../tests/ArmClientTests.cs | 15 +
.../Azure.ResourceManager.Core.Tests.csproj | 32 ++
.../tests/IdentityTests.cs | 457 +++++++++++++++++
.../tests/LocationTests.cs | 225 +++++++++
.../tests/PlanTests.cs | 232 +++++++++
.../tests/README.MD | 16 +
.../tests/Resource/TestResource.cs | 16 +
.../tests/ResourceGroupOperationsTests.cs | 23 +
.../tests/ResourceIdentifierTests.cs | 123 +++++
.../tests/ResourceListOperationsTest.cs | 134 +++++
.../tests/ResourceNameFilterTests.cs | 62 +++
.../tests/ResourceTagFilterTests.cs | 67 +++
.../tests/ResourceTests.cs | 64 +++
.../tests/ResourceTypeTests.cs | 233 +++++++++
.../ArmClientOptionsExtensions.cs | 10 +
.../FakeResourceApiVersions.cs | 21 +
.../RpImplementations/FakeRpApiVersions.cs | 12 +
.../tests/SkuTests.cs | 228 +++++++++
.../tests/SubscriptionOperationsTests.cs | 52 ++
.../tests/SystemAssignedIdentityTests.cs | 339 +++++++++++++
.../tests/TaggableResourceTests.cs | 103 ++++
.../TestAssets/Identity/InvalidType.json | 13 +
.../Identity/InvalidTypeIsNull.json | 13 +
.../SystemAndUserAssignedInnerExtraField.json | 14 +
...SystemAndUserAssignedMiddleExtraField.json | 14 +
.../SystemAndUserAssignedOuterExtraField.json | 14 +
.../Identity/SystemAndUserAssignedValid.json | 13 +
...temAndUserAssignedValidMultIdentities.json | 17 +
.../TestAssets/Identity/SystemAssigned.json | 8 +
.../TestAssets/Identity/UserAssigned.json | 13 +
.../SystemAssignedBothEmptyString.json | 8 +
.../SystemAssignedBothValuesNull.json | 8 +
.../SystemAssignedInvalid.json | 8 +
.../SystemAssignedOneEmptyString.json | 8 +
.../SystemAssignedOneOtherValueNull.json | 8 +
.../SystemAssignedOneValueNull.json | 8 +
.../SystemAssignedValid.json | 8 +
.../SystemAssignedValidExtraField.json | 9 +
.../UserAssignedBothEmptyString.json | 13 +
.../UserAssignedBothValuesNull.json | 13 +
.../UserAssignedExtraField.json | 14 +
.../UserAssignedInvalid.json | 13 +
...UserAssignedInvalidMultipleIdentities.json | 17 +
.../UserAssignedOneEmptyString.json | 13 +
.../UserAssignedOneOtherValueNull.json | 13 +
.../UserAssignedOneValueNull.json | 13 +
.../UserAssignedValid.json | 13 +
.../UserAssignedValidMultipleIdentities.json | 17 +
.../tests/UserAssignedIdentityTests.cs | 315 ++++++++++++
sdk/resourcemanager/ci.yml | 31 ++
110 files changed, 9470 insertions(+), 3 deletions(-)
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/Azure.ResourceManager.Core.sln
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/Directory.Build.props
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/Adapters/PhArmResponse.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/Adapters/PhTaskDeferringAsyncPageable.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/Adapters/PhWrappingAsyncPageable.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/Adapters/PhWrappingPageable.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/Adapters/ProxyResource.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/Adapters/TrackedResource.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/Adapters/WrappingPage.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/ApiVersionsBase.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/ArmBuilder.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/ArmOperation.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/ArmResponse.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/ArmVoidOperation.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/Azure.ResourceManager.Core.csproj
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/AzureResourceManagerClient.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/AzureResourceManagerClientOptions.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/ContainerBase.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/ExtensionResourceContainer.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/ExtensionResourceOperationsBase.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/GenericResource.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/GenericResourceData.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/GenericResourceOperations.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/IDeletableResource.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/ITaggableResource.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/OperationsBase.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/Placeholder/PhArmOperation.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/Placeholder/ResourceGroupData.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/Placeholder/SubscriptionData.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/Properties/AssemblyInfo.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/ResourceContainerBase.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/ResourceGroup.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/ResourceGroupContainer.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/ResourceGroupOperations.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/ResourceListOperations.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/ResourceOperationsBase.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/Resources/GenericResourceFilter.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/Resources/KnownKeys.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/Resources/LocationContainer.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/Resources/LocationData.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/Resources/Plan.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/Resources/Resource.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/Resources/ResourceFilterCollection.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/Resources/ResourceIdentifier.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/Resources/ResourceIdentity.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/Resources/ResourceNameFilter.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/Resources/ResourceTagFilter.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/Resources/ResourceType.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/Resources/ResourceTypeFilter.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/Resources/Sku.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/Resources/SystemAssignedIdentity.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/Resources/TrackedResource.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/Resources/UserAssignedIdentity.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/Subscription.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/SubscriptionContainer.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/SubscriptionOperations.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/src/autorest.md
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/ApiVersionsBaseTests.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/ArmClientOptionsTests.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/ArmClientTests.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/Azure.ResourceManager.Core.Tests.csproj
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/IdentityTests.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/LocationTests.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/PlanTests.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/README.MD
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/Resource/TestResource.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/ResourceGroupOperationsTests.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/ResourceIdentifierTests.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/ResourceListOperationsTest.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/ResourceNameFilterTests.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/ResourceTagFilterTests.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/ResourceTests.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/ResourceTypeTests.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/RpImplementations/ArmClientOptionsExtensions.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/RpImplementations/FakeResourceApiVersions.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/RpImplementations/FakeRpApiVersions.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/SkuTests.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/SubscriptionOperationsTests.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/SystemAssignedIdentityTests.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/TaggableResourceTests.cs
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/TestAssets/Identity/InvalidType.json
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/TestAssets/Identity/InvalidTypeIsNull.json
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/TestAssets/Identity/SystemAndUserAssignedInnerExtraField.json
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/TestAssets/Identity/SystemAndUserAssignedMiddleExtraField.json
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/TestAssets/Identity/SystemAndUserAssignedOuterExtraField.json
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/TestAssets/Identity/SystemAndUserAssignedValid.json
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/TestAssets/Identity/SystemAndUserAssignedValidMultIdentities.json
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/TestAssets/Identity/SystemAssigned.json
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/TestAssets/Identity/UserAssigned.json
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/TestAssets/SystemAssignedIdentity/SystemAssignedBothEmptyString.json
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/TestAssets/SystemAssignedIdentity/SystemAssignedBothValuesNull.json
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/TestAssets/SystemAssignedIdentity/SystemAssignedInvalid.json
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/TestAssets/SystemAssignedIdentity/SystemAssignedOneEmptyString.json
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/TestAssets/SystemAssignedIdentity/SystemAssignedOneOtherValueNull.json
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/TestAssets/SystemAssignedIdentity/SystemAssignedOneValueNull.json
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/TestAssets/SystemAssignedIdentity/SystemAssignedValid.json
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/TestAssets/SystemAssignedIdentity/SystemAssignedValidExtraField.json
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/TestAssets/UserAssignedIdentity/UserAssignedBothEmptyString.json
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/TestAssets/UserAssignedIdentity/UserAssignedBothValuesNull.json
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/TestAssets/UserAssignedIdentity/UserAssignedExtraField.json
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/TestAssets/UserAssignedIdentity/UserAssignedInvalid.json
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/TestAssets/UserAssignedIdentity/UserAssignedInvalidMultipleIdentities.json
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/TestAssets/UserAssignedIdentity/UserAssignedOneEmptyString.json
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/TestAssets/UserAssignedIdentity/UserAssignedOneOtherValueNull.json
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/TestAssets/UserAssignedIdentity/UserAssignedOneValueNull.json
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/TestAssets/UserAssignedIdentity/UserAssignedValid.json
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/TestAssets/UserAssignedIdentity/UserAssignedValidMultipleIdentities.json
create mode 100644 sdk/resourcemanager/Azure.ResourceManager.Core/tests/UserAssignedIdentityTests.cs
create mode 100644 sdk/resourcemanager/ci.yml
diff --git a/eng/Packages.Data.props b/eng/Packages.Data.props
index 6db7c956504be..d8abf41aec2e6 100644
--- a/eng/Packages.Data.props
+++ b/eng/Packages.Data.props
@@ -64,14 +64,16 @@
-
+
-
+
-
+
+
+
@@ -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/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/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..0718cbf721cb4
--- /dev/null
+++ b/sdk/resourcemanager/Azure.ResourceManager.Core/src/Azure.ResourceManager.Core.csproj
@@ -0,0 +1,21 @@
+
+
+
+ 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
+
+
+
+
+
+
+
+
+
+
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