EasmClient.CreateOrReplaceSavedFilterAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
CreateOrReplaceSavedFilterAsync(String, SavedFilterPayload, CancellationToken) |
Create or replace a saved filter with a given filterName. |
CreateOrReplaceSavedFilterAsync(String, RequestContent, RequestContext) |
[Protocol Method] Create or replace a saved filter with a given filterName.
|
CreateOrReplaceSavedFilterAsync(String, SavedFilterPayload, CancellationToken)
- Source:
- EasmClient.cs
Create or replace a saved filter with a given filterName.
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Analytics.Defender.Easm.SavedFilter>> CreateOrReplaceSavedFilterAsync (string filterName, Azure.Analytics.Defender.Easm.SavedFilterPayload savedFilterPayload, System.Threading.CancellationToken cancellationToken = default);
abstract member CreateOrReplaceSavedFilterAsync : string * Azure.Analytics.Defender.Easm.SavedFilterPayload * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Analytics.Defender.Easm.SavedFilter>>
override this.CreateOrReplaceSavedFilterAsync : string * Azure.Analytics.Defender.Easm.SavedFilterPayload * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Analytics.Defender.Easm.SavedFilter>>
Public Overridable Function CreateOrReplaceSavedFilterAsync (filterName As String, savedFilterPayload As SavedFilterPayload, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of SavedFilter))
Parameters
- filterName
- String
The caller provided unique name for the resource.
- savedFilterPayload
- SavedFilterPayload
A request body used to create a saved filter.
- cancellationToken
- CancellationToken
The cancellation token to use.
Returns
Exceptions
filterName
or savedFilterPayload
is null.
filterName
is an empty string, and was expected to be non-empty.
Examples
This sample shows how to call CreateOrReplaceSavedFilterAsync.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
EasmClient client = new EasmClient(endpoint, credential);
SavedFilterPayload savedFilterPayload = new SavedFilterPayload("<filter>", "<description>");
Response<SavedFilter> response = await client.CreateOrReplaceSavedFilterAsync("<filterName>", savedFilterPayload);
This sample shows how to call CreateOrReplaceSavedFilterAsync with all parameters.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
EasmClient client = new EasmClient(endpoint, credential);
SavedFilterPayload savedFilterPayload = new SavedFilterPayload("<filter>", "<description>");
Response<SavedFilter> response = await client.CreateOrReplaceSavedFilterAsync("<filterName>", savedFilterPayload);
Applies to
CreateOrReplaceSavedFilterAsync(String, RequestContent, RequestContext)
- Source:
- EasmClient.cs
[Protocol Method] Create or replace a saved filter with a given filterName.
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- Please try the simpler CreateOrReplaceSavedFilterAsync(String, SavedFilterPayload, CancellationToken) convenience overload with strongly typed models first.
public virtual System.Threading.Tasks.Task<Azure.Response> CreateOrReplaceSavedFilterAsync (string filterName, Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member CreateOrReplaceSavedFilterAsync : string * Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.CreateOrReplaceSavedFilterAsync : string * Azure.Core.RequestContent * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function CreateOrReplaceSavedFilterAsync (filterName As String, content As RequestContent, Optional context As RequestContext = Nothing) As Task(Of Response)
Parameters
- filterName
- String
The caller provided unique name for the resource.
- content
- RequestContent
The content to send as the body of the request.
- context
- RequestContext
The request context, which can override default behaviors of the client pipeline on a per-call basis.
Returns
The response returned from the service.
Exceptions
filterName
or content
is null.
filterName
is an empty string, and was expected to be non-empty.
Service returned a non-success status code.
Examples
This sample shows how to call CreateOrReplaceSavedFilterAsync and parse the result.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
EasmClient client = new EasmClient(endpoint, credential);
using RequestContent content = RequestContent.Create(new
{
filter = "<filter>",
description = "<description>",
});
Response response = await client.CreateOrReplaceSavedFilterAsync("<filterName>", content);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("name").ToString());
This sample shows how to call CreateOrReplaceSavedFilterAsync with all parameters and request content and parse the result.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
EasmClient client = new EasmClient(endpoint, credential);
using RequestContent content = RequestContent.Create(new
{
filter = "<filter>",
description = "<description>",
});
Response response = await client.CreateOrReplaceSavedFilterAsync("<filterName>", content);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("id").ToString());
Console.WriteLine(result.GetProperty("name").ToString());
Console.WriteLine(result.GetProperty("displayName").ToString());
Console.WriteLine(result.GetProperty("filter").ToString());
Console.WriteLine(result.GetProperty("description").ToString());
Applies to
Azure SDK for .NET
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for