-
Notifications
You must be signed in to change notification settings - Fork 5.1k
initial checkin for core / tests #18968
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
m-nash
merged 18 commits into
Azure:feature/mgmt-track2
from
AME-Redmond:mnash-4518-initalCore
Feb 27, 2021
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
dd48718
initial checkin for core / tests
m-nash 346dc34
Add readme.md file
m-nash 0698302
Fix header in readme
m-nash 706f22e
remove autorest until we convert off hand written types
m-nash 178af7a
update azure.core reference
m-nash 903221e
Add the proto client which will be used until the autogen work is com…
m-nash 002848c
Add missing readmes for proto client
m-nash fc17340
update to require linq 4.0.0 so that don't have to upgrade bcl
m-nash 477b124
add changlog for CI
m-nash 69b81e6
change system.linq.async to update
m-nash 47d537c
update to use source vs binary for the temporary generation of Azure.…
m-nash 92d08aa
Add changelog for azure.resourcemanager.authorization and update vers…
m-nash 2cbde0c
update typos in readme
m-nash 6b28c33
update name of proto client sln
m-nash 9899273
merge in changes from proto repo this week
m-nash 09b790e
fixed unit test failures
m-nash 1e06b96
ignore tests which require live azure until 5122 is closed
m-nash 7fd9d1a
Update failing scenario test
m-nash File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
sdk/resourcemanager/Azure.ResourceManager.Core/Azure.ResourceManager.Core.sln
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # Release History | ||
|
|
||
| ## 1.0.0-beta.1 (Unreleased) | ||
|
|
||
| -Initial checkin |
6 changes: 6 additions & 0 deletions
6
sdk/resourcemanager/Azure.ResourceManager.Core/Directory.Build.props
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| <!-- | ||
| Add any shared properties you want for the projects under this package directory that need to be set before the auto imported Directory.Build.props | ||
| --> | ||
| <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory).., Directory.Build.props))\Directory.Build.props" /> | ||
| </Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| # Azure ResourceManager Core client library for .NET | ||
|
m-nash marked this conversation as resolved.
|
||
|
|
||
| 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 <https://cla.microsoft.com>. | ||
|
|
||
| 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 | ||
| <opencode@microsoft.com> with any additional questions or comments. | ||
|
|
||
| <!-- LINKS --> | ||
| [style-guide-msft]: https://docs.microsoft.com/style-guide/capitalization | ||
| [style-guide-cloud]: https://aka.ms/azsdk/cloud-style-guide | ||
|
|
||
|  | ||
41 changes: 41 additions & 0 deletions
41
sdk/resourcemanager/Azure.ResourceManager.Core/src/Adapters/PhArmResponse.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System; | ||
|
|
||
| namespace Azure.ResourceManager.Core | ||
| { | ||
| /// <summary> | ||
| /// 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 | ||
| /// </summary> | ||
| /// <typeparam name="TOperations"> The <see cref="ResourceOperationsBase"/> to convert the TModel into. </typeparam> | ||
| /// <typeparam name="TModel"> The model returned by the existing serivce calls. </typeparam> | ||
| public class PhArmResponse<TOperations, TModel> : ArmResponse<TOperations> | ||
| where TOperations : class | ||
| where TModel : class | ||
| { | ||
| private readonly Func<TModel, TOperations> _converter; | ||
| private readonly Response<TModel> _wrapped; | ||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="PhArmResponse{TOperations, TModel}"/> class. | ||
| /// </summary> | ||
| /// <param name="wrapped"> The results to wrap. </param> | ||
| /// <param name="converter"> The function used to convert from existing type to new type. </param> | ||
| public PhArmResponse(Response<TModel> wrapped, Func<TModel, TOperations> converter) | ||
| { | ||
| _wrapped = wrapped; | ||
| _converter = converter; | ||
| } | ||
|
|
||
| /// <inheritdoc/> | ||
| public override TOperations Value => _converter(_wrapped.Value); | ||
|
|
||
| /// <inheritdoc/> | ||
| public override Response GetRawResponse() | ||
| { | ||
| return _wrapped.GetRawResponse(); | ||
| } | ||
| } | ||
| } |
39 changes: 39 additions & 0 deletions
39
sdk/resourcemanager/Azure.ResourceManager.Core/src/Adapters/PhTaskDeferringAsyncPageable.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 | ||
| { | ||
| /// <summary> | ||
| /// A class repreesnting an AsyncPageable that executes a given task before retrieving the first page of results | ||
| /// </summary> | ||
| /// <typeparam name="TOperations"> The type of <see cref="ResourceOperationsBase"/> that will be returned. </typeparam> | ||
| public class PhTaskDeferringAsyncPageable<TOperations> : AsyncPageable<TOperations> | ||
| where TOperations : notnull | ||
| { | ||
| private readonly Func<Task<AsyncPageable<TOperations>>> _task; | ||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="PhTaskDeferringAsyncPageable{TOperations}"/> class. | ||
| /// </summary> | ||
| /// <param name="task"> The function to execute returning the AsyncPageable task. </param> | ||
| public PhTaskDeferringAsyncPageable(Func<Task<AsyncPageable<TOperations>>> task) | ||
| { | ||
| _task = task; | ||
| } | ||
|
|
||
| /// <inheritdoc/> | ||
| public override async IAsyncEnumerable<Page<TOperations>> AsPages( | ||
| string continuationToken = null, | ||
| int? pageSizeHint = null) | ||
| { | ||
| await foreach (var page in (await _task().ConfigureAwait(false)).AsPages().ConfigureAwait(false)) | ||
| { | ||
| yield return page; | ||
| } | ||
| } | ||
| } | ||
| } |
60 changes: 60 additions & 0 deletions
60
sdk/resourcemanager/Azure.ResourceManager.Core/src/Adapters/PhWrappingAsyncPageable.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 | ||
| { | ||
| /// <summary> | ||
| /// Returns an AsyncPageable that transforms each page of contents after they are retrieved from the server | ||
| /// according to the profived transformation function | ||
| /// </summary> | ||
| /// <typeparam name="TModel"> The model returned by existing AsyncPageable methods. </typeparam> | ||
| /// <typeparam name="TOperations"> The <see cref="ResourceOperationsBase"/> to convert TModel into. </typeparam> | ||
| public class PhWrappingAsyncPageable<TModel, TOperations> : AsyncPageable<TOperations> | ||
| where TOperations : class | ||
| where TModel : class | ||
| { | ||
| private readonly Func<TModel, TOperations> _converter; | ||
| private readonly IEnumerable<AsyncPageable<TModel>> _wrapped; | ||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="PhWrappingAsyncPageable{TModel, TOperations}"/> class. | ||
| /// </summary> | ||
| /// <param name="wrapped"> The results to wrap. </param> | ||
| /// <param name="converter"> The function used to convert from existing type to new type. </param> | ||
| public PhWrappingAsyncPageable(AsyncPageable<TModel> wrapped, Func<TModel, TOperations> converter) | ||
| { | ||
| _wrapped = new[] { wrapped }; | ||
| _converter = converter; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="PhWrappingAsyncPageable{TModel, TOperations}"/> class. | ||
| /// </summary> | ||
| /// <param name="wrapped"> The results to wrap. </param> | ||
| /// <param name="converter"> The function used to convert from existing type to new type. </param> | ||
| public PhWrappingAsyncPageable(IEnumerable<AsyncPageable<TModel>> wrapped, Func<TModel, TOperations> converter) | ||
| { | ||
| _wrapped = wrapped; | ||
| _converter = converter; | ||
| } | ||
|
|
||
| /// <inheritdoc/> | ||
| public override async IAsyncEnumerable<Page<TOperations>> 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<TModel, TOperations>(page, _converter); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
57 changes: 57 additions & 0 deletions
57
sdk/resourcemanager/Azure.ResourceManager.Core/src/Adapters/PhWrappingPageable.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 | ||
| { | ||
| /// <summary> | ||
| /// 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. | ||
| /// </summary> | ||
| /// <typeparam name="TModel"> The type parameter of the Pageable we are wrapping. </typeparam> | ||
| /// <typeparam name="TOperations"> The desired type parameter of the returned pageable. </typeparam> | ||
| public class PhWrappingPageable<TModel, TOperations> : Pageable<TOperations> | ||
| where TOperations : class | ||
| where TModel : class | ||
| { | ||
| private readonly Func<TModel, TOperations> _converter; | ||
| private readonly IEnumerable<Pageable<TModel>> _wrapped; | ||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="PhWrappingPageable{TModel, TOperations}"/> class. | ||
| /// </summary> | ||
| /// <param name="wrapped"> The results to wrap. </param> | ||
| /// <param name="converter"> The function used to convert from existing type to new type. </param> | ||
| public PhWrappingPageable(Pageable<TModel> wrapped, Func<TModel, TOperations> converter) | ||
| { | ||
| _wrapped = new[] { wrapped }; | ||
| _converter = converter; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="PhWrappingPageable{TModel, TOperations}"/> class. | ||
| /// </summary> | ||
| /// <param name="wrapped"> The results to wrap. </param> | ||
| /// <param name="converter"> The function used to convert from existing type to new type. </param> | ||
| public PhWrappingPageable(IEnumerable<Pageable<TModel>> wrapped, Func<TModel, TOperations> converter) | ||
| { | ||
| _wrapped = wrapped; | ||
| _converter = converter; | ||
| } | ||
|
|
||
| /// <inheritdoc/> | ||
| public override IEnumerable<Page<TOperations>> AsPages(string continuationToken = null, int? pageSizeHint = null) | ||
| { | ||
| foreach (var pages in _wrapped) | ||
| { | ||
| foreach (var page in pages.AsPages()) | ||
| { | ||
| yield return new WrappingPage<TModel, TOperations>(page, _converter); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.