Skip to content

Commit d2ec538

Browse files
committed
Initial Check-in
1 parent 9369dfb commit d2ec538

File tree

81 files changed

+7851
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+7851
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{1CFE6234-2FC0-4FD0-87F8-103E06CE4133}</ProjectGuid>
8+
<OutputType>Library</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>Microsoft.Azure.Commands.ResourceManager.Clients</RootNamespace>
11+
<AssemblyName>Microsoft.Azure.Commands.ResourceManager.Clients</AssemblyName>
12+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
13+
<FileAlignment>512</FileAlignment>
14+
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\..\..\</SolutionDir>
15+
<RestorePackages>true</RestorePackages>
16+
<NuGetPackageImportStamp>a651016d</NuGetPackageImportStamp>
17+
</PropertyGroup>
18+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
19+
<DebugSymbols>true</DebugSymbols>
20+
<DebugType>full</DebugType>
21+
<Optimize>false</Optimize>
22+
<OutputPath>..\..\..\..\Package\Debug\ResourceManager\AzureResourceManager\ResourceManager</OutputPath>
23+
<DefineConstants>DEBUG;TRACE</DefineConstants>
24+
<ErrorReport>prompt</ErrorReport>
25+
<WarningLevel>4</WarningLevel>
26+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
27+
<Prefer32Bit>false</Prefer32Bit>
28+
</PropertyGroup>
29+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
30+
<SignAssembly>true</SignAssembly>
31+
<AssemblyOriginatorKeyFile>MSSharedLibKey.snk</AssemblyOriginatorKeyFile>
32+
<DelaySign>true</DelaySign>
33+
<OutputPath>..\..\..\..\Package\Release\ResourceManager\AzureResourceManager\ResourceManager</OutputPath>
34+
<DefineConstants>TRACE;SIGN</DefineConstants>
35+
<Optimize>true</Optimize>
36+
<DebugType>pdbonly</DebugType>
37+
<PlatformTarget>AnyCPU</PlatformTarget>
38+
<CodeAnalysisLogFile>bin\Release\Microsoft.Azure.Commands.ResourceManager.Core.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
39+
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
40+
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
41+
<ErrorReport>prompt</ErrorReport>
42+
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
43+
<CodeAnalysisRuleSetDirectories>;$(ProgramFiles)\Microsoft Visual Studio 12.0\Team Tools\Static Analysis Tools\Rule Sets</CodeAnalysisRuleSetDirectories>
44+
<CodeAnalysisRuleDirectories>;$(ProgramFiles)\Microsoft Visual Studio 12.0\Team Tools\Static Analysis Tools\FxCop\Rules</CodeAnalysisRuleDirectories>
45+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
46+
<Prefer32Bit>false</Prefer32Bit>
47+
</PropertyGroup>
48+
<ItemGroup>
49+
<Reference Include="Hyak.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
50+
<SpecificVersion>False</SpecificVersion>
51+
<HintPath>..\..\..\..\packages\Hyak.Common.1.0.2\lib\net45\Hyak.Common.dll</HintPath>
52+
</Reference>
53+
<Reference Include="Microsoft.Azure.Common, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
54+
<SpecificVersion>False</SpecificVersion>
55+
<HintPath>..\..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll</HintPath>
56+
</Reference>
57+
<Reference Include="Microsoft.Azure.Common.NetFramework, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
58+
<SpecificVersion>False</SpecificVersion>
59+
<HintPath>..\..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll</HintPath>
60+
</Reference>
61+
<Reference Include="Microsoft.Threading.Tasks, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
62+
<SpecificVersion>False</SpecificVersion>
63+
<HintPath>..\..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll</HintPath>
64+
</Reference>
65+
<Reference Include="Microsoft.Threading.Tasks.Extensions, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
66+
<SpecificVersion>False</SpecificVersion>
67+
<HintPath>..\..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.dll</HintPath>
68+
</Reference>
69+
<Reference Include="Microsoft.Threading.Tasks.Extensions.Desktop">
70+
<HintPath>..\..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll</HintPath>
71+
<Private>True</Private>
72+
</Reference>
73+
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
74+
<SpecificVersion>False</SpecificVersion>
75+
<HintPath>..\..\..\..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
76+
</Reference>
77+
<Reference Include="System" />
78+
<Reference Include="System.Core" />
79+
<Reference Include="System.Net" />
80+
<Reference Include="System.Net.Http" />
81+
<Reference Include="System.Net.Http.Extensions, Version=2.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
82+
<SpecificVersion>False</SpecificVersion>
83+
<HintPath>..\..\..\..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Extensions.dll</HintPath>
84+
</Reference>
85+
<Reference Include="System.Net.Http.Formatting, Version=5.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
86+
<SpecificVersion>False</SpecificVersion>
87+
<HintPath>..\..\..\..\Package\Debug\ResourceManager\AzureResourceManager\TrafficManager\System.Net.Http.Formatting.dll</HintPath>
88+
</Reference>
89+
<Reference Include="System.Net.Http.Primitives">
90+
<HintPath>..\..\..\..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Primitives.dll</HintPath>
91+
<Private>True</Private>
92+
</Reference>
93+
<Reference Include="System.Net.Http.WebRequest" />
94+
</ItemGroup>
95+
<ItemGroup>
96+
<Compile Include="Components\HttpClientHelperFactory.cs" />
97+
<Compile Include="Components\PaginatedResponseHelper.cs" />
98+
<Compile Include="RestClients\ResourceManagerRestClientBase.cs" />
99+
<Compile Include="RestClients\ResourceManagerRestRestClient.cs" />
100+
<Compile Include="Components\HttpClientHelper.cs" />
101+
<Compile Include="Components\Constants.cs" />
102+
<Compile Include="Components\HttpMethodExt.cs" />
103+
<Compile Include="Components\HttpStatusCodeExt.cs" />
104+
<Compile Include="Components\QueryFilterBuilder.cs" />
105+
<Compile Include="Components\ResourceIdUtility.cs" />
106+
<Compile Include="Components\OperationResult.cs" />
107+
<Compile Include="Handlers\AuthenticationHandler.cs" />
108+
<Compile Include="Handlers\RetryHandler.cs" />
109+
<Compile Include="Handlers\TracingHandler.cs" />
110+
<Compile Include="Handlers\UserAgentHandler.cs" />
111+
<Compile Include="Properties\AssemblyInfo.cs" />
112+
</ItemGroup>
113+
<ItemGroup>
114+
<ProjectReference Include="..\Common\Commands.ResourceManager.Common.csproj">
115+
<Project>{1cbd2f22-4430-4a27-81ba-e20838d3d929}</Project>
116+
<Name>Commands.ResourceManager.Common</Name>
117+
</ProjectReference>
118+
<ProjectReference Include="..\Data\Commands.ResourceManager.Data.csproj">
119+
<Project>{3E446A46-1F52-4CB7-AE63-62973C3F9718}</Project>
120+
<Name>Commands.ResourceManager.Data</Name>
121+
</ProjectReference>
122+
</ItemGroup>
123+
<ItemGroup>
124+
<None Include="MSSharedLibKey.snk" />
125+
<None Include="packages.config" />
126+
</ItemGroup>
127+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
128+
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
129+
<Import Project="..\..\..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />
130+
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
131+
<PropertyGroup>
132+
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
133+
</PropertyGroup>
134+
<Error Condition="!Exists('..\..\..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets'))" />
135+
</Target>
136+
</Project>
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
namespace Microsoft.Azure.Commands.ResourceManager.Clients.Components
16+
{
17+
/// <summary>
18+
/// Class for holding constants
19+
/// </summary>
20+
public static class Constants
21+
{
22+
/// <summary>
23+
/// The <c>Microsoft.Resource</c> namespace.
24+
/// </summary>
25+
public static readonly string MicrosoftResourceNamesapce = "Microsoft.Resources";
26+
27+
/// <summary>
28+
/// The string literal <c>ResourceGroups</c>
29+
/// </summary>
30+
public static readonly string ResourceGroups = "ResourceGroups";
31+
32+
/// <summary>
33+
/// The string literal <c>Providers</c>
34+
/// </summary>
35+
public static readonly string Providers = "Providers";
36+
37+
/// <summary>
38+
/// The string literal <c>Subscriptions</c>
39+
/// </summary>
40+
public static readonly string Subscriptions = "Subscriptions";
41+
42+
/// <summary>
43+
/// The string literal <c>Location</c>
44+
/// </summary>
45+
public static readonly string Location = "Location";
46+
47+
/// <summary>
48+
/// The default API version.
49+
/// </summary>
50+
public static readonly string DefaultApiVersion = "2015-01-01";
51+
52+
/// <summary>
53+
/// The move action.
54+
/// </summary>
55+
public static readonly string Move = "move";
56+
57+
/// <summary>
58+
/// The locks resource type.
59+
/// </summary>
60+
public static readonly string MicrosoftAuthorizationLocksType = "Microsoft.Authorization/locks";
61+
62+
/// <summary>
63+
/// The deployment operations resource type.
64+
/// </summary>
65+
public static readonly string MicrosoftResourcesDeploymentOperationsType = Constants.MicrosoftResourceNamesapce + "/deployments/operations";
66+
}
67+
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
namespace Microsoft.Azure.Commands.ResourceManager.Clients.Components
16+
{
17+
using System.Collections.Generic;
18+
using System.Linq;
19+
using System.Net.Http;
20+
using System.Net.Http.Headers;
21+
using Microsoft.Azure.Commands.ResourceManager.Clients.Handlers;
22+
using Microsoft.Azure.Commands.ResourceManager.Common.Extensions;
23+
24+
/// <summary>
25+
/// Factory class for creating <see cref="HttpClient"/> objects with custom headers.
26+
/// </summary>
27+
public abstract class HttpClientHelper
28+
{
29+
/// <summary>
30+
/// The subscription cloud credentials.
31+
/// </summary>
32+
private readonly SubscriptionCloudCredentials credentials;
33+
34+
/// <summary>
35+
/// The header values.
36+
/// </summary>
37+
private readonly IEnumerable<ProductInfoHeaderValue> headerValues;
38+
39+
/// <summary>
40+
/// Initializes a new instance of the <see cref="HttpClientHelper"/> class.
41+
/// </summary>
42+
/// <param name="credentials">The subscription cloud credentials.</param>
43+
/// <param name="headerValues">The header values.</param>
44+
protected HttpClientHelper(SubscriptionCloudCredentials credentials, IEnumerable<ProductInfoHeaderValue> headerValues)
45+
{
46+
this.credentials = credentials;
47+
this.headerValues = headerValues;
48+
}
49+
50+
/// <summary>
51+
/// Creates an <see cref="HttpClient"/>
52+
/// </summary>
53+
/// <param name="primaryHandlers">The handlers that will be added to the top of the chain.</param>
54+
public virtual HttpClient CreateHttpClient(params DelegatingHandler[] primaryHandlers)
55+
{
56+
var delegateHandlers = new DelegatingHandler[]
57+
{
58+
new AuthenticationHandler(cloudCredentials: credentials),
59+
new UserAgentHandler(headerValues: headerValues),
60+
new TracingHandler(),
61+
new Microsoft.Azure.Commands.ResourceManager.Clients.Handlers.RetryHandler(),
62+
};
63+
64+
return HttpClientFactory.Create(handlers: primaryHandlers.CoalesceEnumerable().Concat(delegateHandlers).ToArray());
65+
}
66+
}
67+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
namespace Microsoft.Azure.Commands.ResourceManager.Clients.Components
16+
{
17+
using System.Collections.Generic;
18+
using System.Net.Http.Headers;
19+
20+
/// <summary>
21+
/// Factory class for creating http client helpers.
22+
/// </summary>
23+
public class HttpClientHelperFactory
24+
{
25+
/// <summary>
26+
/// Gets an instance of the facotry.
27+
/// </summary>
28+
public static HttpClientHelperFactory Instance { get; internal set; }
29+
30+
/// <summary>
31+
/// Initializes static members of the <see cref="HttpClientHelperFactory"/> class.
32+
/// </summary>
33+
static HttpClientHelperFactory()
34+
{
35+
HttpClientHelperFactory.Instance = new HttpClientHelperFactory();
36+
}
37+
38+
/// <summary>
39+
/// Initializes a new instance of the <see cref="HttpClientHelperFactory"/> class.
40+
/// </summary>
41+
protected HttpClientHelperFactory()
42+
{
43+
}
44+
45+
/// <summary>
46+
/// Creates new instances of the <see cref="HttpClientHelper"/> class.
47+
/// </summary>
48+
/// <param name="credentials">The credentials.</param>
49+
/// <param name="headerValues">The headers.</param>
50+
public virtual HttpClientHelper CreateHttpClientHelper(SubscriptionCloudCredentials credentials, IEnumerable<ProductInfoHeaderValue> headerValues)
51+
{
52+
return new HttpClientHelperImpl(credentials: credentials, headerValues: headerValues);
53+
}
54+
55+
/// <summary>
56+
/// An implementation of the <see cref="HttpClientHelper"/> abstract class.
57+
/// </summary>
58+
private class HttpClientHelperImpl : HttpClientHelper
59+
{
60+
/// <summary>
61+
/// Initializes new instances of the <see cref="HttpClientHelperImpl"/> class.
62+
/// </summary>
63+
/// <param name="credentials">The credentials.</param>
64+
/// <param name="headerValues">The headers.</param>
65+
public HttpClientHelperImpl(SubscriptionCloudCredentials credentials, IEnumerable<ProductInfoHeaderValue> headerValues)
66+
: base(credentials: credentials, headerValues: headerValues)
67+
{
68+
}
69+
}
70+
}
71+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
namespace Microsoft.Azure.Commands.ResourceManager.Clients.Components
16+
{
17+
using System.Net.Http;
18+
19+
/// <summary>
20+
/// Extra http methods.
21+
/// </summary>
22+
public class HttpMethodExt
23+
{
24+
/// <summary>
25+
/// The PATCH method.
26+
/// </summary>
27+
public static readonly HttpMethod Patch = new HttpMethod("PATCH");
28+
}
29+
}

0 commit comments

Comments
 (0)