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