EasmClient.GetDiscoveryTemplateAsync 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
GetDiscoveryTemplateAsync(String, RequestContext) |
[Protocol Method] Retrieve a disco template with a given templateId.
|
GetDiscoveryTemplateAsync(String, CancellationToken) |
Retrieve a disco template with a given templateId. |
GetDiscoveryTemplateAsync(String, RequestContext)
- Source:
- EasmClient.cs
[Protocol Method] Retrieve a disco template with a given templateId.
- This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
- Please try the simpler GetDiscoveryTemplateAsync(String, CancellationToken) convenience overload with strongly typed models first.
public virtual System.Threading.Tasks.Task<Azure.Response> GetDiscoveryTemplateAsync (string templateId, Azure.RequestContext context);
abstract member GetDiscoveryTemplateAsync : string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
override this.GetDiscoveryTemplateAsync : string * Azure.RequestContext -> System.Threading.Tasks.Task<Azure.Response>
Public Overridable Function GetDiscoveryTemplateAsync (templateId As String, context As RequestContext) As Task(Of Response)
Parameters
- templateId
- String
The system generated unique id for the resource.
- 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
templateId
is null.
templateId
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 GetDiscoveryTemplateAsync and parse the result.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
EasmClient client = new EasmClient(endpoint, credential);
Response response = await client.GetDiscoveryTemplateAsync("<templateId>", null);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("id").ToString());
This sample shows how to call GetDiscoveryTemplateAsync with all parameters and parse the result.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
EasmClient client = new EasmClient(endpoint, credential);
Response response = await client.GetDiscoveryTemplateAsync("<templateId>", null);
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("industry").ToString());
Console.WriteLine(result.GetProperty("region").ToString());
Console.WriteLine(result.GetProperty("countryCode").ToString());
Console.WriteLine(result.GetProperty("stateCode").ToString());
Console.WriteLine(result.GetProperty("city").ToString());
Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("kind").ToString());
Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("name").ToString());
Console.WriteLine(result.GetProperty("names")[0].ToString());
Applies to
GetDiscoveryTemplateAsync(String, CancellationToken)
- Source:
- EasmClient.cs
Retrieve a disco template with a given templateId.
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.Analytics.Defender.Easm.DiscoveryTemplate>> GetDiscoveryTemplateAsync (string templateId, System.Threading.CancellationToken cancellationToken = default);
abstract member GetDiscoveryTemplateAsync : string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Analytics.Defender.Easm.DiscoveryTemplate>>
override this.GetDiscoveryTemplateAsync : string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.Analytics.Defender.Easm.DiscoveryTemplate>>
Public Overridable Function GetDiscoveryTemplateAsync (templateId As String, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of DiscoveryTemplate))
Parameters
- templateId
- String
The system generated unique id for the resource.
- cancellationToken
- CancellationToken
The cancellation token to use.
Returns
Exceptions
templateId
is null.
templateId
is an empty string, and was expected to be non-empty.
Examples
This sample shows how to call GetDiscoveryTemplateAsync.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
EasmClient client = new EasmClient(endpoint, credential);
Response<DiscoveryTemplate> response = await client.GetDiscoveryTemplateAsync("<templateId>");
This sample shows how to call GetDiscoveryTemplateAsync with all parameters.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
EasmClient client = new EasmClient(endpoint, credential);
Response<DiscoveryTemplate> response = await client.GetDiscoveryTemplateAsync("<templateId>");
Applies to
Azure SDK for .NET