Skip to content

Commit c091c90

Browse files
authored
Acr endpoints fix debug message filter (#226)
* add ACR domain suffix * fix * provide parameter to accepet list of regex filter * remove redundant constructor * correct variable name * move debugging filter to AzurePSCmdlet * Update AzurePSCmdlet.cs remove redundant line * Update AzurePSCmdlet.cs remove unnecessary decorator * Update AzurePSCmdlet.cs add comments * mark default matcher as static readonly * fix * bug fix * apply matchers to serviceclient interceptor * add containerregistry to endpoint * remove white space
1 parent 371887a commit c091c90

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

src/Authentication.Abstractions/AzureEnvironment.cs

+1
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,7 @@ public static class Endpoint
627627
AzureDataLakeAnalyticsCatalogAndJobEndpointSuffix = "AzureDataLakeAnalyticsCatalogAndJobEndpointSuffix",
628628
AzureDataLakeStoreFileSystemEndpointSuffix = "AzureDataLakeStoreFileSystemEndpointSuffix",
629629
DataLakeEndpointResourceId = "DataLakeEndpointResourceId",
630+
ContainerRegistryEndpointSuffix = "ContainerRegistryEndpointSuffix",
630631
BatchEndpointResourceId = "BatchEndpointResourceId";
631632
}
632633

src/Common/AzurePSCmdlet.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ public abstract class AzurePSCmdlet : PSCmdlet, IDisposable
4848
private object lockObject = new object();
4949
private AzurePSDataCollectionProfile _cachedProfile = null;
5050

51-
private IList<Regex> _matchers = new List<Regex>();
52-
private static readonly Regex _defaultMatcher = new Regex("(\\s*\"refresh_token\"\\s*:\\s*)\"[^\"]+\"");
51+
protected IList<Regex> _matchers { get; private set; } = new List<Regex>();
52+
private static readonly Regex _defaultMatcher = new Regex("(\\s*\"access_token\"\\s*:\\s*)\"[^\"]+\"");
5353

5454
protected AzurePSDataCollectionProfile _dataCollectionProfile
5555
{

src/ResourceManager/Version2016_09_01/AzureRMCmdlet.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ protected override void SetupDebuggingTraces()
310310
ServiceClientTracing.IsEnabled = true;
311311
base.SetupDebuggingTraces();
312312
_serviceClientTracingInterceptor = _serviceClientTracingInterceptor
313-
?? new ServiceClientTracingInterceptor(DebugMessages);
313+
?? new ServiceClientTracingInterceptor(DebugMessages, _matchers);
314314
ServiceClientTracing.AddTracingInterceptor(_serviceClientTracingInterceptor);
315315
}
316316

src/ResourceManager/Version2016_09_01/ServiceClientTracingInterceptor.cs

+7-3
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,22 @@
1818
using System;
1919
using System.Collections.Concurrent;
2020
using System.Collections.Generic;
21+
using System.Text.RegularExpressions;
2122

2223
namespace Microsoft.Azure.Commands.ResourceManager.Common
2324
{
2425
public class ServiceClientTracingInterceptor : IServiceClientTracingInterceptor
2526
{
26-
public ServiceClientTracingInterceptor(ConcurrentQueue<string> queue)
27+
public ServiceClientTracingInterceptor(ConcurrentQueue<string> queue, IList<Regex> matchers = null)
2728
{
2829
MessageQueue = queue;
30+
Matchers = matchers;
2931
}
3032

3133
public ConcurrentQueue<string> MessageQueue { get; private set; }
3234

35+
private IList<Regex> Matchers { get; set; }
36+
3337
public void Configuration(string source, string name, string value)
3438
{
3539
// Ignore
@@ -52,13 +56,13 @@ public void Information(string message)
5256

5357
public void ReceiveResponse(string invocationId, System.Net.Http.HttpResponseMessage response)
5458
{
55-
string responseAsString = response == null ? string.Empty : GeneralUtilities.GetLog(response);
59+
string responseAsString = response == null ? string.Empty : GeneralUtilities.GetLog(response, Matchers);
5660
MessageQueue.CheckAndEnqueue(responseAsString);
5761
}
5862

5963
public void SendRequest(string invocationId, System.Net.Http.HttpRequestMessage request)
6064
{
61-
string requestAsString = request == null ? string.Empty : GeneralUtilities.GetLog(request);
65+
string requestAsString = request == null ? string.Empty : GeneralUtilities.GetLog(request, Matchers);
6266
MessageQueue.CheckAndEnqueue(requestAsString);
6367
}
6468

0 commit comments

Comments
 (0)