EasmClient.ValidateDataConnection 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
ValidateDataConnection(DataConnectionPayload, CancellationToken) |
Validate a data connection with a given dataConnectionName. |
ValidateDataConnection(RequestContent, RequestContext) |
[Protocol Method] Validate a data connection with a given dataConnectionName.
|
ValidateDataConnection(DataConnectionPayload, CancellationToken)
- Source:
- EasmClient.cs
Validate a data connection with a given dataConnectionName.
public virtual Azure.Response<Azure.Analytics.Defender.Easm.ValidateResult> ValidateDataConnection (Azure.Analytics.Defender.Easm.DataConnectionPayload dataConnectionPayload, System.Threading.CancellationToken cancellationToken = default);
abstract member ValidateDataConnection : Azure.Analytics.Defender.Easm.DataConnectionPayload * System.Threading.CancellationToken -> Azure.Response<Azure.Analytics.Defender.Easm.ValidateResult>
override this.ValidateDataConnection : Azure.Analytics.Defender.Easm.DataConnectionPayload * System.Threading.CancellationToken -> Azure.Response<Azure.Analytics.Defender.Easm.ValidateResult>
Public Overridable Function ValidateDataConnection (dataConnectionPayload As DataConnectionPayload, Optional cancellationToken As CancellationToken = Nothing) As Response(Of ValidateResult)
Parameters
- dataConnectionPayload
- DataConnectionPayload
The DataConnectionPayload to use.
- cancellationToken
- CancellationToken
The cancellation token to use.
Returns
Exceptions
dataConnectionPayload
is null.
Examples
This sample shows how to call ValidateDataConnection.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
EasmClient client = new EasmClient(endpoint, credential);
DataConnectionPayload dataConnectionPayload = new LogAnalyticsDataConnectionPayload(new LogAnalyticsDataConnectionProperties());
Response<ValidateResult> response = client.ValidateDataConnection(dataConnectionPayload);
This sample shows how to call ValidateDataConnection with all parameters.
Uri endpoint = new Uri("<https://my-service.azure.com>");
TokenCredential credential = new DefaultAzureCredential();
EasmClient client = new EasmClient(endpoint, credential);
DataConnectionPayload dataConnectionPayload = new LogAnalyticsDataConnectionPayload(new LogAnalyticsDataConnectionProperties
{
ApiKey = "<apiKey>",
WorkspaceId = "<workspaceId>",
})
{
Name = "<name>",
Content = DataConnectionContent.Assets,
Frequency = DataConnectionFrequency.Daily,
FrequencyOffset = 1234,
};
Response<ValidateResult> response = client.ValidateDataConnection(dataConnectionPayload);
Applies to
ValidateDataConnection(RequestContent, RequestContext)
- Source:
- EasmClient.cs
[Protocol Method] Validate 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 ValidateDataConnection(DataConnectionPayload, CancellationToken) convenience overload with strongly typed models first.
public virtual Azure.Response ValidateDataConnection (Azure.Core.RequestContent content, Azure.RequestContext context = default);
abstract member ValidateDataConnection : Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
override this.ValidateDataConnection : Azure.Core.RequestContent * Azure.RequestContext -> Azure.Response
Public Overridable Function ValidateDataConnection (content As RequestContent, Optional context As RequestContext = Nothing) As Response
Parameters
- 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
content
is null.
Service returned a non-success status code.
Examples
This sample shows how to call ValidateDataConnection 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
{
properties = new object(),
kind = "logAnalytics",
});
Response response = client.ValidateDataConnection(content);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.ToString());
This sample shows how to call ValidateDataConnection with all 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
{
properties = new
{
apiKey = "<apiKey>",
workspaceId = "<workspaceId>",
},
kind = "logAnalytics",
name = "<name>",
content = "assets",
frequency = "daily",
frequencyOffset = 1234,
});
Response response = client.ValidateDataConnection(content);
JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("target").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("code").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("value").ToString());
Applies to
Azure SDK for .NET