Skip to content
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

How to set values for event grid advanced filters such for StringContainsAdvancedFilter #42087

Closed
waynebsx opened this issue Feb 20, 2024 · 4 comments
Assignees
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. Event Grid issue-addressed The Azure SDK team member assisting with this issue believes it to be addressed and ready to close. Mgmt This issue is related to a management-plane library. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@waynebsx
Copy link

Library name and version

Azure.ResourceManager.EventGrid 1.0.1

Query/Question

Creating an event grid subscription using Azure.ResourceManager.EventGrid - confused how to set values for advanced filters using SDK. Specifically for StringContainsAdvancedFilter. There's only a default parameterless constructor and the values list is read only. Ideally I'd like to do data.Filter.AdvancedFilters.Add(new StringContainsAdvancedFilter { Key = "subject", Values = new List() { "somevalue" } }); but Values is readonly - so how to set values?

Environment

Visual Studio 17.8.3

dotnet --info
.NET SDK:
Version: 8.0.100
Commit: 57efcf1350
Workload version: 8.0.100-manifests.8d38d0cc

Runtime Environment:
OS Name: Windows
OS Version: 10.0.22631
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\8.0.100\

.NET workloads installed:
Workload version: 8.0.100-manifests.8d38d0cc
There are no installed workloads to display.

Host:
Version: 8.0.0
Architecture: x64
Commit: 5535e31a71

.NET SDKs installed:
8.0.100 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
Not set

global.json file:
Not found

@github-actions github-actions bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-triage This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Feb 20, 2024
@jsquire jsquire added Event Grid Mgmt This issue is related to a management-plane library. needs-team-attention This issue needs attention from Azure service team or SDK team and removed needs-triage This is a new issue that needs to be triaged to the appropriate team. labels Feb 21, 2024
@jsquire
Copy link
Member

jsquire commented Feb 21, 2024

Thank you for your feedback. Tagging and routing to the team member best able to assist.

@melina5656
Copy link
Member

Hi @waynebsx .You can refer to the following sample code to implement the required functions.

 var data = new EventGridSubscriptionData()
 {
     Destination = new StorageQueueEventSubscriptionDestination()
     {
         ResourceId = storageAccount.Id,
         QueueName = storageQueue.Data.Name,

     },
     Filter = new EventSubscriptionFilter()
     {
         AdvancedFilters =
         {
             new StringContainsAdvancedFilter()
             {
                 Key = "subject",
                 Values =
                 {
                     "somevalue"
                 }
             }
         }
     }
 };
 var eventSubscription = (await eventSubscriptionCollection.CreateOrUpdateAsync(WaitUntil.Completed, eventSubscriptionName, data)).Value;

Thank you for your feedback.

@melina5656 melina5656 added the issue-addressed The Azure SDK team member assisting with this issue believes it to be addressed and ready to close. label Mar 26, 2024
@github-actions github-actions bot removed the needs-team-attention This issue needs attention from Azure service team or SDK team label Mar 26, 2024
Copy link

Hi @waynebsx. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text "/unresolve" to remove the "issue-addressed" label and continue the conversation.

@melina5656 melina5656 assigned melina5656 and unassigned HarveyLink Mar 26, 2024
Copy link

github-actions bot commented Apr 2, 2024

Hi @waynebsx, since you haven’t asked that we /unresolve the issue, we’ll close this out. If you believe further discussion is needed, please add a comment /unresolve to reopen the issue.

@github-actions github-actions bot closed this as completed Apr 2, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jul 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. Event Grid issue-addressed The Azure SDK team member assisting with this issue believes it to be addressed and ready to close. Mgmt This issue is related to a management-plane library. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
Development

No branches or pull requests

5 participants