Skip to content

Commit 08724dd

Browse files
author
begoldsm
committed
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
2 parents 9fb21c9 + 339aeb6 commit 08724dd

19 files changed

+81
-47
lines changed

build.proj

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,11 @@
111111

112112
<PropertyGroup>
113113
<NuGetCommand>$(MSBuildProjectDirectory)\tools\NuGet.exe</NuGetCommand>
114+
<LibraryNugetPackageFolder>$(LibrarySourceFolder)\packages</LibraryNugetPackageFolder>
114115
<NuGetRestoreConfigFile>$(MSBuildProjectDirectory)\restore.config</NuGetRestoreConfigFile>
115116
<NuGetRestoreConfigSwitch>-ConfigFile &quot;$(NuGetRestoreConfigFile)&quot;</NuGetRestoreConfigSwitch>
117+
<NuGetRestorePackageSetting>-PackagesDirectory $(LibraryNugetPackageFolder)</NuGetRestorePackageSetting>
118+
116119
<PowerShellCommand>C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe</PowerShellCommand>
117120
</PropertyGroup>
118121

@@ -135,9 +138,9 @@
135138
Encoding="Unicode"/>
136139

137140
<Exec Command="$(NuGetCommand) sources add -Name LocalFeed -Source &quot;$(MSBuildProjectDirectory)\tools\LocalFeed&quot; $(NuGetRestoreConfigSwitch)"/>
138-
141+
<Exec Command="$(NuGetCommand) sources add -Name nugetRemote -Source &quot;https://api.nuget.org/v3/index.json&quot; $(NuGetRestoreConfigSwitch)"/>
139142
<!-- Restore packages -->
140-
<Exec Command="$(NuGetCommand) restore %(CmdletSolutionsToBuild.FullPath) $(NuGetRestoreConfigSwitch)"
143+
<Exec Command="$(NuGetCommand) restore %(CmdletSolutionsToBuild.FullPath) $(NuGetRestoreConfigSwitch) $(NuGetRestorePackageSetting)"
141144
ContinueOnError="false" />
142145
<!-- Restore packages for static analysis-->
143146
<Exec Command="$(NuGetCommand) restore %(StaticAnalysis.FullPath) $(NuGetRestoreConfigSwitch)"

src/ResourceManager/OperationalInsights/Commands.OperationalInsights.Test/Commands.OperationalInsights.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
<HintPath>..\..\..\packages\Microsoft.Azure.Gallery.2.6.2-preview\lib\net40\Microsoft.Azure.Gallery.dll</HintPath>
5959
</Reference>
6060
<Reference Include="Microsoft.Azure.Management.OperationalInsights, Version=0.9.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
61-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.OperationalInsights.0.13.0-preview\lib\net40\Microsoft.Azure.Management.OperationalInsights.dll</HintPath>
61+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.OperationalInsights.0.14.0-preview\lib\net40\Microsoft.Azure.Management.OperationalInsights.dll</HintPath>
6262
<Private>True</Private>
6363
</Reference>
6464
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">

src/ResourceManager/OperationalInsights/Commands.OperationalInsights.Test/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<package id="Microsoft.Azure.Common.Dependencies" version="1.0.0" targetFramework="net45" />
66
<package id="Microsoft.Azure.Gallery" version="2.6.2-preview" targetFramework="net45" />
77
<package id="Microsoft.Azure.Management.Authorization" version="1.0.0" targetFramework="net45" />
8-
<package id="Microsoft.Azure.Management.OperationalInsights" version="0.13.0-preview" targetFramework="net45" />
8+
<package id="Microsoft.Azure.Management.OperationalInsights" version="0.14.0-preview" targetFramework="net45" />
99
<package id="Microsoft.Azure.Management.Resources" version="2.20.0-preview" targetFramework="net45" />
1010
<package id="Microsoft.Azure.Test.Framework" version="1.0.5945.28173-prerelease" targetFramework="net45" />
1111
<package id="Microsoft.Azure.Test.HttpRecorder" version="1.0.5945.28173-prerelease" targetFramework="net45" />

src/ResourceManager/OperationalInsights/Commands.OperationalInsights/Commands.OperationalInsights.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
<HintPath>..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll</HintPath>
5959
</Reference>
6060
<Reference Include="Microsoft.Azure.Management.OperationalInsights, Version=0.9.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
61-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.OperationalInsights.0.13.0-preview\lib\net40\Microsoft.Azure.Management.OperationalInsights.dll</HintPath>
61+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.OperationalInsights.0.14.0-preview\lib\net40\Microsoft.Azure.Management.OperationalInsights.dll</HintPath>
6262
<Private>True</Private>
6363
</Reference>
6464
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">

src/ResourceManager/OperationalInsights/Commands.OperationalInsights/Models/PSCoreSummary.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ public PSCoreSummary(CoreSummary coreSummary)
3131
}
3232
}
3333
public string Status { get; set; }
34-
public int NumberOfDocuments { get; set; }
34+
public long NumberOfDocuments { get; set; }
3535
}
3636
}

src/ResourceManager/OperationalInsights/Commands.OperationalInsights/Models/PSMetadataSchema.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ public PSMetadataSchema(MetadataSchema schema)
3232
}
3333

3434
public string Name { get; set; }
35-
public int Version { get; set; }
35+
public long Version { get; set; }
3636
}
3737
}

src/ResourceManager/OperationalInsights/Commands.OperationalInsights/Models/PSSavedSearchProperties.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public PSSavedSearchProperties(SavedSearchProperties properties)
4545
public string Category { get; set; }
4646
public string DisplayName { get; set; }
4747
public string Query { get; set; }
48-
public int? Version { get; set; }
48+
public long? Version { get; set; }
4949
public Hashtable Tags { get; set; }
5050
}
5151
}

src/ResourceManager/OperationalInsights/Commands.OperationalInsights/Models/PSSearchGetSearchResultsParameters.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ namespace Microsoft.Azure.Commands.OperationalInsights.Models
1818
{
1919
public class PSSearchGetSearchResultsParameters : OperationalInsightsParametersBase
2020
{
21-
public int Top { get; set; }
22-
public int Skip { get; set; }
21+
public long Top { get; set; }
22+
public long Skip { get; set; }
2323
public PSHighlight Highlight { get; set; }
2424
public bool IncludeArchive { get; set; }
2525
public string Query { get; set; }

src/ResourceManager/OperationalInsights/Commands.OperationalInsights/Models/PSSearchMetadata.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ public PSSearchMetadata(SearchMetadata metadata)
6363
}
6464
}
6565
public string ResultType { get; set; }
66-
public int? Total { get; set; }
67-
public int? Top { get; set; }
66+
public long? Total { get; set; }
67+
public long? Top { get; set; }
6868
public Guid? Id { get; set; }
6969
public IEnumerable<object> CoreResponses { get; set; }
7070
public List<PSCoreSummary> CoreSummaries { get; set; }
@@ -73,11 +73,11 @@ public PSSearchMetadata(SearchMetadata metadata)
7373
public DateTime? LastUpdated { get; set; }
7474
public string ETag { get; set; }
7575
public List<PSSearchSort> Sort { get; set; }
76-
public int? RequestTime { get; set; }
76+
public long? RequestTime { get; set; }
7777
public string AggregatedValueField { get; set; }
7878
public string AggregatedGroupingFields { get; set; }
79-
public int? Sum { get; set; }
80-
public int? Max { get; set; }
79+
public long? Sum { get; set; }
80+
public long? Max { get; set; }
8181
public PSMetadataSchema Schema { get; set; }
8282
}
8383
}

src/ResourceManager/OperationalInsights/Commands.OperationalInsights/Search/GetAzureOperationalInsightsSearchResultsCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class GetAzureOperationalInsightsSearchResultsCommand : OperationalInsigh
3535
[Parameter(Position = 2, Mandatory = false, ValueFromPipelineByPropertyName = true,
3636
HelpMessage = "The top search parameter.")]
3737
[ValidateNotNullOrEmpty]
38-
public int Top { get; set; }
38+
public long Top { get; set; }
3939

4040
[Parameter(Position = 3, Mandatory = false, ValueFromPipelineByPropertyName = true,
4141
HelpMessage = "The pre highlight search parameter.")]

src/ResourceManager/OperationalInsights/Commands.OperationalInsights/Search/NewAzureOperationalInsightsComputerGroupCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public class NewAzureOperationalInsightsComputerGroupCommand : OperationalInsigh
5757
[Parameter(Position = 6, Mandatory = false, ValueFromPipelineByPropertyName = true,
5858
HelpMessage = "The saved search version.")]
5959
[ValidateNotNullOrEmpty]
60-
public int Version { get; set; }
60+
public long Version { get; set; }
6161

6262
[Parameter(Mandatory = false, HelpMessage = "Don't ask for confirmation.")]
6363
public SwitchParameter Force { get; set; }

src/ResourceManager/OperationalInsights/Commands.OperationalInsights/Search/NewAzureOperationalInsightsSavedSearchCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public class NewAzureOperationalInsightsSavedSearchCommand : OperationalInsights
6060
[Parameter(Position = 7, Mandatory = false, ValueFromPipelineByPropertyName = true,
6161
HelpMessage = "The saved search version.")]
6262
[ValidateNotNullOrEmpty]
63-
public int Version { get; set; }
63+
public long Version { get; set; }
6464

6565
[Parameter(Mandatory = false, HelpMessage = "Don't ask for confirmation.")]
6666
public SwitchParameter Force { get; set; }

src/ResourceManager/OperationalInsights/Commands.OperationalInsights/Search/SetAzureOperationalInsightsSavedSearch.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public class SetAzureOperationalInsightsSavedSearchCommand : OperationalInsights
6060
[Parameter(Position = 7, Mandatory = false, ValueFromPipelineByPropertyName = true,
6161
HelpMessage = "The saved search version.")]
6262
[ValidateNotNullOrEmpty]
63-
public int Version { get; set; }
63+
public long Version { get; set; }
6464

6565
[Parameter(Position = 8, Mandatory = false, ValueFromPipelineByPropertyName = true,
6666
HelpMessage = "The ETag of the saved search.")]

src/ResourceManager/OperationalInsights/Commands.OperationalInsights/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<package id="Hyak.Common" version="1.0.3" targetFramework="net45" />
44
<package id="Microsoft.Azure.Common" version="2.1.0" targetFramework="net45" />
55
<package id="Microsoft.Azure.Common.Dependencies" version="1.0.0" targetFramework="net45" />
6-
<package id="Microsoft.Azure.Management.OperationalInsights" version="0.13.0-preview" targetFramework="net45" />
6+
<package id="Microsoft.Azure.Management.OperationalInsights" version="0.14.0-preview" targetFramework="net45" />
77
<package id="Microsoft.Azure.Management.Resources" version="2.20.0-preview" targetFramework="net45" />
88
<package id="Microsoft.Bcl" version="1.1.9" targetFramework="net45" />
99
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net45" />

src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Handlers/RetryHandler.cs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414

1515
namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Handlers
1616
{
17-
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Components;
18-
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Extensions;
19-
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Utilities;
2017
using System;
2118
using System.Net;
2219
using System.Net.Http;
2320
using System.Threading;
2421
using System.Threading.Tasks;
25-
22+
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Components;
23+
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Extensions;
24+
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Utilities;
25+
2626
/// <summary>
2727
/// A basic retry handler.
2828
/// </summary>
@@ -56,20 +56,21 @@ public class RetryHandler : DelegatingHandler
5656
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
5757
{
5858
HttpResponseMessage response = null;
59-
for (int attempt = 0; attempt < RetryHandler.MaxAttempts; ++attempt)
59+
60+
for (int attempt = 1; attempt <= RetryHandler.MaxAttempts; ++attempt)
6061
{
6162
try
6263
{
6364
response = await base
6465
.SendAsync(request: request, cancellationToken: cancellationToken)
6566
.ConfigureAwait(continueOnCapturedContext: false);
66-
67+
6768
if (attempt == RetryHandler.MaxAttempts ||
6869
(!response.StatusCode.IsServerFailureRequest() &&
6970
response.StatusCode != HttpStatusCode.RequestTimeout &&
7071
response.StatusCode != HttpStatusCodeExt.TooManyRequests))
7172
{
72-
return response;
73+
break;
7374
}
7475
}
7576
catch (Exception ex)
@@ -80,6 +81,11 @@ protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage
8081
}
8182
}
8283

84+
if (response != null)
85+
{
86+
response.Dispose();
87+
}
88+
8389
await Task.Delay(delay: RetryHandler.GetDelay(attempt), cancellationToken: cancellationToken)
8490
.ConfigureAwait(continueOnCapturedContext: false);
8591
}

src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Properties/Resources.Designer.cs

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/Properties/Resources.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,4 +396,7 @@
396396
<data name="UpdatedResourceGroup" xml:space="preserve">
397397
<value>Updated resource group '{0}' in location '{1}'</value>
398398
</data>
399+
<data name="OperationFailedWithTimeOut" xml:space="preserve">
400+
<value>Operation failed because a request timed out.</value>
401+
</data>
399402
</root>

src/ResourceManager/Resources/Commands.ResourceManager/Cmdlets/RestClients/ResourceManagerRestClientBase.cs

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,18 @@
1414

1515
namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.RestClients
1616
{
17+
using System;
18+
using System.Net.Http;
19+
using System.Text;
20+
using System.Threading;
21+
using System.Threading.Tasks;
1722
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Components;
1823
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Entities.ErrorResponses;
1924
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Extensions;
2025
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Utilities;
2126
using Newtonsoft.Json;
2227
using Newtonsoft.Json.Linq;
23-
using System;
24-
using System.Net.Http;
25-
using System.Text;
26-
using System.Threading;
27-
using System.Threading.Tasks;
28+
using ProjectResources = Microsoft.Azure.Commands.ResourceManager.Cmdlets.Properties.Resources;
2829

2930
/// <summary>
3031
/// A base class for Azure clients.
@@ -219,27 +220,39 @@ protected async Task<HttpResponseMessage> SendRequestAsync(HttpRequestMessage re
219220
{
220221
using (var httpClient = this.httpClientHelper.CreateHttpClient())
221222
{
222-
var response = await httpClient
223-
.SendAsync(request: request, cancellationToken: cancellationToken)
224-
.ConfigureAwait(continueOnCapturedContext: false);
225-
226-
if (!response.StatusCode.IsSuccessfulRequest())
223+
try
227224
{
228-
var errorResponse = await ResourceManagerRestClientBase
229-
.TryReadErrorResponseMessage(response, rewindContentStream: true)
225+
var response = await httpClient
226+
.SendAsync(request: request, cancellationToken: cancellationToken)
230227
.ConfigureAwait(continueOnCapturedContext: false);
231228

232-
var message = await ResourceManagerRestClientBase
233-
.GetErrorMessage(request: request, response: response, errorResponse: errorResponse)
234-
.ConfigureAwait(continueOnCapturedContext: false);
229+
if (!response.StatusCode.IsSuccessfulRequest())
230+
{
231+
var errorResponse = await ResourceManagerRestClientBase
232+
.TryReadErrorResponseMessage(response, rewindContentStream: true)
233+
.ConfigureAwait(continueOnCapturedContext: false);
235234

236-
throw new ErrorResponseMessageException(
237-
httpStatus: response.StatusCode,
238-
errorResponseMessage: errorResponse,
239-
errorMessage: message);
235+
var message = await ResourceManagerRestClientBase
236+
.GetErrorMessage(request: request, response: response, errorResponse: errorResponse)
237+
.ConfigureAwait(continueOnCapturedContext: false);
238+
239+
throw new ErrorResponseMessageException(
240+
httpStatus: response.StatusCode,
241+
errorResponseMessage: errorResponse,
242+
errorMessage: message);
243+
}
244+
245+
return response;
240246
}
247+
catch (Exception exception)
248+
{
249+
if (exception is OperationCanceledException && !cancellationToken.IsCancellationRequested)
250+
{
251+
throw new Exception(ProjectResources.OperationFailedWithTimeOut);
252+
}
241253

242-
return response;
254+
throw;
255+
}
243256
}
244257
}
245258

tools/NuGet.exe

2.17 MB
Binary file not shown.

0 commit comments

Comments
 (0)