Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added media/dark-mode-connection.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/dark-mode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/light-mode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 20 additions & 20 deletions src/EventGridExplorerLibrary/EventGridLibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public async Task<Response<EventGridNamespaceResource>> GetNamespacesAsync(strin
public async Task<AsyncPageable<NamespaceTopicResource>> GetTopicsAsync(string resourceGroupName, string namespaceName, string hostname)
{
NamespaceTopicCollection namespaceTopicCollection = eventGridControlPlaneClient.GetNamespaceResource(resourceGroupName, namespaceName).GetNamespaceTopics();
AsyncPageable<NamespaceTopicResource> pages = namespaceTopicCollection.GetAllAsync();
IAsyncEnumerator<NamespaceTopicResource> enumerator = pages.GetAsyncEnumerator();
var pages = namespaceTopicCollection.GetAllAsync();
var enumerator = pages.GetAsyncEnumerator();

try
{
Expand All @@ -71,7 +71,7 @@ public async Task<AsyncPageable<NamespaceTopicEventSubscriptionResource>> GetEve
{
NamespaceTopicResource namespaceTopicResource = (await eventGridControlPlaneClient.GetNamespaceResource(resourceGroupName, namespaceName).GetNamespaceTopicAsync(topicName)).Value;
NamespaceTopicEventSubscriptionCollection namespaceTopicEventSubscriptionCollection = namespaceTopicResource.GetNamespaceTopicEventSubscriptions();
AsyncPageable<NamespaceTopicEventSubscriptionResource> pages = namespaceTopicEventSubscriptionCollection.GetAllAsync();
var pages = namespaceTopicEventSubscriptionCollection.GetAllAsync();

return pages;
}
Expand Down Expand Up @@ -105,7 +105,7 @@ public async Task PublishEventAsync(string topicName, string eventSource, string

public async Task PublishEventsAsync(string topicName, string eventSource, string eventType, List<string> publishEvents)
{
CloudEvent[] cloudEvents = new CloudEvent[publishEvents.Count];
var cloudEvents = new CloudEvent[publishEvents.Count];

for (int i = 0; i < cloudEvents.Length; i++)
{
Expand Down Expand Up @@ -140,7 +140,7 @@ public async Task<ReceiveResult> ReceiveEventsAsync(string topicName, string sub
}
}

public async Task<bool> EventActionsAsync(string action, List<string> lockTokens, string topicName, string subscriptionName, WriteToLogDelegate writeToLog)
public async Task<bool> EventActionsAsync(string action, List<string> lockTokens, string topicName, string subscriptionName, WriteToLogDelegate logAction)
{
if (lockTokens.Count > 0)
{
Expand All @@ -150,45 +150,45 @@ public async Task<bool> EventActionsAsync(string action, List<string> lockTokens
switch (action)
{
case "Acknowledge":
AcknowledgeResult acknowledgeResult = await dataPlaneClients[topicName].AcknowledgeCloudEventsAsync(topicName, subscriptionName, new AcknowledgeOptions(lockTokens));
var acknowledgeResult = (await dataPlaneClients[topicName].AcknowledgeCloudEventsAsync(topicName, subscriptionName, new AcknowledgeOptions(lockTokens))).Value;
succeededLockTokens = acknowledgeResult.SucceededLockTokens;
failedLockTokens = acknowledgeResult.FailedLockTokens;
break;
case "Release":
ReleaseResult releaseResult = await dataPlaneClients[topicName].ReleaseCloudEventsAsync(topicName, subscriptionName, new ReleaseOptions(lockTokens));
var releaseResult = (await dataPlaneClients[topicName].ReleaseCloudEventsAsync(topicName, subscriptionName, new ReleaseOptions(lockTokens))).Value;
succeededLockTokens = releaseResult.SucceededLockTokens;
failedLockTokens = releaseResult.FailedLockTokens;
break;
case "Reject":
RejectResult rejectResult = await dataPlaneClients[topicName].RejectCloudEventsAsync(topicName, subscriptionName, new RejectOptions(lockTokens));
var rejectResult = (await dataPlaneClients[topicName].RejectCloudEventsAsync(topicName, subscriptionName, new RejectOptions(lockTokens))).Value;
succeededLockTokens = rejectResult.SucceededLockTokens;
failedLockTokens = rejectResult.FailedLockTokens;
break;
}

writeToLog($"Event Action: {action}");
logAction($"Event Action: {action}");

if (succeededLockTokens.Count > 0)
if (succeededLockTokens?.Count > 0)
{
writeToLog($"Success Count: {succeededLockTokens.Count}");
foreach (string lockToken in succeededLockTokens)
logAction($"Success Count: {succeededLockTokens.Count}");
foreach (var lockToken in succeededLockTokens)
{
writeToLog($"Lock Token: {lockToken}");
logAction($"Lock Token: {lockToken}");
}
}

if (failedLockTokens.Count > 0)
if (failedLockTokens?.Count > 0)
{
writeToLog($"Failed Count: {failedLockTokens.Count}");
foreach (FailedLockToken lockToken in failedLockTokens)
logAction($"Failed Count: {failedLockTokens.Count}");
foreach (var lockToken in failedLockTokens)
{
writeToLog($"Lock Token: {lockToken.LockToken}");
writeToLog($"Error Code: {lockToken.Error.Code}");
writeToLog($"Error Description: {lockToken.Error.Message}");
logAction($"Lock Token: {lockToken.LockToken}");
logAction($"Error Code: {lockToken.Error.Code}");
logAction($"Error Description: {lockToken.Error.Message}");
}
}

return failedLockTokens.Count == 0;
return failedLockTokens?.Count == 0;
}

return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public async Task<string> CreateNamespaceTopicAsync(string resourceGroupName, st
InputSchema = EventInputSchema.CloudEventSchemaV10,
};

ArmOperation<NamespaceTopicResource> azureOperation = await collection.CreateOrUpdateAsync(WaitUntil.Completed, namespaceTopicName, namespaceTopicData);
var azureOperation = await collection.CreateOrUpdateAsync(WaitUntil.Completed, namespaceTopicName, namespaceTopicData);
NamespaceTopicResource result = azureOperation.Value;
return result.Id;
}
Expand Down Expand Up @@ -134,7 +134,7 @@ public async Task<string> CreateNamespaceTopicEventSubscriptionAsync(string reso
return $"{subscriptionName} for topic {namespaceTopicName} already exists";
}

ArmOperation<NamespaceTopicEventSubscriptionResource> azureOperation = collection.CreateOrUpdate(WaitUntil.Completed, subscriptionName, namespaceTopicEventSubscriptionData);
var azureOperation = collection.CreateOrUpdate(WaitUntil.Completed, subscriptionName, namespaceTopicEventSubscriptionData);
return azureOperation.Value.Id;
}

Expand Down Expand Up @@ -183,11 +183,11 @@ private FiltersConfiguration GetFiltersConfiguration(List<Dictionary<string, str
FiltersConfiguration filtersConfiguration = new FiltersConfiguration();
EventGridFilterFactory eventGridFilterFactory = new EventGridFilterFactory(filtersConfiguration);

foreach (Dictionary<string, string> i in filters)
foreach (var i in filters)
{
eventGridFilterFactory.Key = i["Key"].ToString();
eventGridFilterFactory.Value = i["Value"].ToString();
eventGridFilterFactory.OperatorType = i["Operator"].ToString();
eventGridFilterFactory.Key = i["Key"];
eventGridFilterFactory.Value = i["Value"];
eventGridFilterFactory.OperatorType = i["Operator"];

eventGridFilterFactory.FilterSelection();
}
Expand Down
42 changes: 21 additions & 21 deletions src/EventGridExplorerLibrary/Management/EventGridFilterFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,25 @@ public EventGridFilterFactory(FiltersConfiguration filtersConfiguration)

public void FilterSelection()
{
if (OperatorType.Equals("Boolean equals")) { AddFilterForBoolEquals(); };
if (OperatorType.Equals("String is in")) { AddFilterForStringIn(); };
if (OperatorType.Equals("String is not in")) { AddFilterForStringNotIn(); };
if (OperatorType.Equals("String contains")) { AddFilterForStringContains(); };
if (OperatorType.Equals("String does not contain")) { AddFilterForStringNotContains(); };
if (OperatorType.Equals("String begins with")) { AddFilterForStringBeginsWith(); };
if (OperatorType.Equals("String does not begin with")) { AddFilterForStringNotBeginsWith(); };
if (OperatorType.Equals("String ends with")) { AddFilterForStringEndsWith(); };
if (OperatorType.Equals("String does not end with")) { AddFilterForStringNotEndsWith(); };
if (OperatorType.Equals("Number is less than")) { AddFilterForNumberLessThan(); };
if (OperatorType.Equals("Number is greater than")) { AddFilterForNumberGreaterThan(); };
if (OperatorType.Equals("Number is less than or equal to")) { AddFilterForNumberLessThanOrEquals(); };
if (OperatorType.Equals("Number is greater than or equal to")) { AddFilterForNumberGreaterThanOrEquals(); };
if (OperatorType.Equals("Number is in")) { AddFilterForNumberIn(); };
if (OperatorType.Equals("Number is not in")) { AddFilterForNumberNotIn(); };
if (OperatorType.Equals("Number is in range")) { AddFilterForNumberInRange(); };
if (OperatorType.Equals("Number is not in range")) { AddFilterForNumberNotInRange(); };
if (OperatorType.Equals("Is null or undefined")) { AddFilterForIsNullOrUndefined(); };
if (OperatorType.Equals("Is not null")) { AddFilterForIsNotNull(); };
if (OperatorType.Equals("Boolean equals")) { AddFilterForBoolEquals(); }
if (OperatorType.Equals("String is in")) { AddFilterForStringIn(); }
if (OperatorType.Equals("String is not in")) { AddFilterForStringNotIn(); }
if (OperatorType.Equals("String contains")) { AddFilterForStringContains(); }
if (OperatorType.Equals("String does not contain")) { AddFilterForStringNotContains(); }
if (OperatorType.Equals("String begins with")) { AddFilterForStringBeginsWith(); }
if (OperatorType.Equals("String does not begin with")) { AddFilterForStringNotBeginsWith(); }
if (OperatorType.Equals("String ends with")) { AddFilterForStringEndsWith(); }
if (OperatorType.Equals("String does not end with")) { AddFilterForStringNotEndsWith(); }
if (OperatorType.Equals("Number is less than")) { AddFilterForNumberLessThan(); }
if (OperatorType.Equals("Number is greater than")) { AddFilterForNumberGreaterThan(); }
if (OperatorType.Equals("Number is less than or equal to")) { AddFilterForNumberLessThanOrEquals(); }
if (OperatorType.Equals("Number is greater than or equal to")) { AddFilterForNumberGreaterThanOrEquals(); }
if (OperatorType.Equals("Number is in")) { AddFilterForNumberIn(); }
if (OperatorType.Equals("Number is not in")) { AddFilterForNumberNotIn(); }
if (OperatorType.Equals("Number is in range")) { AddFilterForNumberInRange(); }
if (OperatorType.Equals("Number is not in range")) { AddFilterForNumberNotInRange(); }
if (OperatorType.Equals("Is null or undefined")) { AddFilterForIsNullOrUndefined(); }
if (OperatorType.Equals("Is not null")) { AddFilterForIsNotNull(); }
}

/// <inheritdoc/>
Expand Down Expand Up @@ -228,7 +228,7 @@ public void AddFilterForNumberNotInRange()
string[] filterValuesList = Value.Split(',');
foreach (string filterValue in filterValuesList)
{
List<double> doubleRangeValues = new List<double>();
var doubleRangeValues = new List<double>();
var rangeValues = filterValue.Split('-');
foreach (string rangeValue in rangeValues)
{
Expand All @@ -246,7 +246,7 @@ public void AddFilterForNumberInRange()
string[] filterValuesList = Value.Split(',');
foreach (string filterValue in filterValuesList)
{
List<double> doubleRangeValues = new List<double>();
var doubleRangeValues = new List<double>();
var rangeValues = filterValue.Split('-');
foreach (string rangeValue in rangeValues)
{
Expand Down
Loading