diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ActionsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ActionsOperations.cs
index 8c0055f2654db..80efdaec56fe1 100644
--- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ActionsOperations.cs
+++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ActionsOperations.cs
@@ -54,8 +54,11 @@ internal ActionsOperations(SecurityInsightsClient client)
/// Gets all actions of alert rule.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -84,17 +87,28 @@ internal ActionsOperations(SecurityInsightsClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task>> ListByAlertRuleWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string ruleId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task>> ListByAlertRuleWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.ApiVersion != null)
+ {
+ if (Client.ApiVersion.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ }
+ }
if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
if (Client.SubscriptionId != null)
{
- if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"))
+ if (Client.SubscriptionId.Length < 1)
{
- throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$");
+ throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
}
}
if (resourceGroupName == null)
@@ -111,10 +125,10 @@ internal ActionsOperations(SecurityInsightsClient client)
{
throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
}
- if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$"))
- {
- throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
- }
+ }
+ if (operationalInsightsResourceProvider == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider");
}
if (workspaceName == null)
{
@@ -143,6 +157,7 @@ internal ActionsOperations(SecurityInsightsClient client)
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider);
tracingParameters.Add("workspaceName", workspaceName);
tracingParameters.Add("ruleId", ruleId);
tracingParameters.Add("cancellationToken", cancellationToken);
@@ -150,9 +165,10 @@ internal ActionsOperations(SecurityInsightsClient client)
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions").ToString();
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions").ToString();
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider));
_url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName));
_url = _url.Replace("{ruleId}", System.Uri.EscapeDataString(ruleId));
List _queryParameters = new List();
@@ -289,8 +305,11 @@ internal ActionsOperations(SecurityInsightsClient client)
/// Gets the action of alert rule.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -322,17 +341,28 @@ internal ActionsOperations(SecurityInsightsClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string ruleId, string actionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, string actionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.ApiVersion != null)
+ {
+ if (Client.ApiVersion.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ }
+ }
if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
if (Client.SubscriptionId != null)
{
- if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"))
+ if (Client.SubscriptionId.Length < 1)
{
- throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$");
+ throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
}
}
if (resourceGroupName == null)
@@ -349,10 +379,10 @@ internal ActionsOperations(SecurityInsightsClient client)
{
throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
}
- if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$"))
- {
- throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
- }
+ }
+ if (operationalInsightsResourceProvider == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider");
}
if (workspaceName == null)
{
@@ -385,6 +415,7 @@ internal ActionsOperations(SecurityInsightsClient client)
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider);
tracingParameters.Add("workspaceName", workspaceName);
tracingParameters.Add("ruleId", ruleId);
tracingParameters.Add("actionId", actionId);
@@ -393,9 +424,10 @@ internal ActionsOperations(SecurityInsightsClient client)
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}").ToString();
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}").ToString();
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider));
_url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName));
_url = _url.Replace("{ruleId}", System.Uri.EscapeDataString(ruleId));
_url = _url.Replace("{actionId}", System.Uri.EscapeDataString(actionId));
@@ -533,8 +565,11 @@ internal ActionsOperations(SecurityInsightsClient client)
/// Creates or updates the action of alert rule.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -569,17 +604,28 @@ internal ActionsOperations(SecurityInsightsClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string ruleId, string actionId, ActionRequest action, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, string actionId, ActionRequest action, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.ApiVersion != null)
+ {
+ if (Client.ApiVersion.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ }
+ }
if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
if (Client.SubscriptionId != null)
{
- if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"))
+ if (Client.SubscriptionId.Length < 1)
{
- throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$");
+ throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
}
}
if (resourceGroupName == null)
@@ -596,10 +642,10 @@ internal ActionsOperations(SecurityInsightsClient client)
{
throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
}
- if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$"))
- {
- throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
- }
+ }
+ if (operationalInsightsResourceProvider == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider");
}
if (workspaceName == null)
{
@@ -640,6 +686,7 @@ internal ActionsOperations(SecurityInsightsClient client)
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider);
tracingParameters.Add("workspaceName", workspaceName);
tracingParameters.Add("ruleId", ruleId);
tracingParameters.Add("actionId", actionId);
@@ -649,9 +696,10 @@ internal ActionsOperations(SecurityInsightsClient client)
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}").ToString();
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}").ToString();
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider));
_url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName));
_url = _url.Replace("{ruleId}", System.Uri.EscapeDataString(ruleId));
_url = _url.Replace("{actionId}", System.Uri.EscapeDataString(actionId));
@@ -813,8 +861,11 @@ internal ActionsOperations(SecurityInsightsClient client)
/// Delete the action of alert rule.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -843,17 +894,28 @@ internal ActionsOperations(SecurityInsightsClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string ruleId, string actionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, string actionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.ApiVersion != null)
+ {
+ if (Client.ApiVersion.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ }
+ }
if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
if (Client.SubscriptionId != null)
{
- if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"))
+ if (Client.SubscriptionId.Length < 1)
{
- throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$");
+ throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
}
}
if (resourceGroupName == null)
@@ -870,10 +932,10 @@ internal ActionsOperations(SecurityInsightsClient client)
{
throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
}
- if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$"))
- {
- throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
- }
+ }
+ if (operationalInsightsResourceProvider == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider");
}
if (workspaceName == null)
{
@@ -906,6 +968,7 @@ internal ActionsOperations(SecurityInsightsClient client)
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider);
tracingParameters.Add("workspaceName", workspaceName);
tracingParameters.Add("ruleId", ruleId);
tracingParameters.Add("actionId", actionId);
@@ -914,9 +977,10 @@ internal ActionsOperations(SecurityInsightsClient client)
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}").ToString();
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}").ToString();
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider));
_url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName));
_url = _url.Replace("{ruleId}", System.Uri.EscapeDataString(ruleId));
_url = _url.Replace("{actionId}", System.Uri.EscapeDataString(actionId));
diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ActionsOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ActionsOperationsExtensions.cs
index 2d58d876af271..efa7a1ec547b6 100644
--- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ActionsOperationsExtensions.cs
+++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ActionsOperationsExtensions.cs
@@ -28,8 +28,11 @@ public static partial class ActionsOperationsExtensions
/// The operations group for this extension method.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -37,9 +40,9 @@ public static partial class ActionsOperationsExtensions
///
/// Alert rule ID
///
- public static IPage ListByAlertRule(this IActionsOperations operations, string resourceGroupName, string workspaceName, string ruleId)
+ public static IPage ListByAlertRule(this IActionsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId)
{
- return operations.ListByAlertRuleAsync(resourceGroupName, workspaceName, ruleId).GetAwaiter().GetResult();
+ return operations.ListByAlertRuleAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, ruleId).GetAwaiter().GetResult();
}
///
@@ -49,8 +52,11 @@ public static IPage ListByAlertRule(this IActionsOperations oper
/// The operations group for this extension method.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -61,9 +67,9 @@ public static IPage ListByAlertRule(this IActionsOperations oper
///
/// The cancellation token.
///
- public static async Task> ListByAlertRuleAsync(this IActionsOperations operations, string resourceGroupName, string workspaceName, string ruleId, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task> ListByAlertRuleAsync(this IActionsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.ListByAlertRuleWithHttpMessagesAsync(resourceGroupName, workspaceName, ruleId, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.ListByAlertRuleWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, ruleId, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
@@ -76,8 +82,11 @@ public static IPage ListByAlertRule(this IActionsOperations oper
/// The operations group for this extension method.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -88,9 +97,9 @@ public static IPage ListByAlertRule(this IActionsOperations oper
///
/// Action ID
///
- public static ActionResponse Get(this IActionsOperations operations, string resourceGroupName, string workspaceName, string ruleId, string actionId)
+ public static ActionResponse Get(this IActionsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, string actionId)
{
- return operations.GetAsync(resourceGroupName, workspaceName, ruleId, actionId).GetAwaiter().GetResult();
+ return operations.GetAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, ruleId, actionId).GetAwaiter().GetResult();
}
///
@@ -100,8 +109,11 @@ public static ActionResponse Get(this IActionsOperations operations, string reso
/// The operations group for this extension method.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -115,9 +127,9 @@ public static ActionResponse Get(this IActionsOperations operations, string reso
///
/// The cancellation token.
///
- public static async Task GetAsync(this IActionsOperations operations, string resourceGroupName, string workspaceName, string ruleId, string actionId, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task GetAsync(this IActionsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, string actionId, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, workspaceName, ruleId, actionId, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, ruleId, actionId, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
@@ -130,8 +142,11 @@ public static ActionResponse Get(this IActionsOperations operations, string reso
/// The operations group for this extension method.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -145,9 +160,9 @@ public static ActionResponse Get(this IActionsOperations operations, string reso
///
/// The action
///
- public static ActionResponse CreateOrUpdate(this IActionsOperations operations, string resourceGroupName, string workspaceName, string ruleId, string actionId, ActionRequest action)
+ public static ActionResponse CreateOrUpdate(this IActionsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, string actionId, ActionRequest action)
{
- return operations.CreateOrUpdateAsync(resourceGroupName, workspaceName, ruleId, actionId, action).GetAwaiter().GetResult();
+ return operations.CreateOrUpdateAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, ruleId, actionId, action).GetAwaiter().GetResult();
}
///
@@ -157,8 +172,11 @@ public static ActionResponse CreateOrUpdate(this IActionsOperations operations,
/// The operations group for this extension method.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -175,9 +193,9 @@ public static ActionResponse CreateOrUpdate(this IActionsOperations operations,
///
/// The cancellation token.
///
- public static async Task CreateOrUpdateAsync(this IActionsOperations operations, string resourceGroupName, string workspaceName, string ruleId, string actionId, ActionRequest action, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task CreateOrUpdateAsync(this IActionsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, string actionId, ActionRequest action, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, ruleId, actionId, action, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, ruleId, actionId, action, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
@@ -190,8 +208,11 @@ public static ActionResponse CreateOrUpdate(this IActionsOperations operations,
/// The operations group for this extension method.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -202,9 +223,9 @@ public static ActionResponse CreateOrUpdate(this IActionsOperations operations,
///
/// Action ID
///
- public static void Delete(this IActionsOperations operations, string resourceGroupName, string workspaceName, string ruleId, string actionId)
+ public static void Delete(this IActionsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, string actionId)
{
- operations.DeleteAsync(resourceGroupName, workspaceName, ruleId, actionId).GetAwaiter().GetResult();
+ operations.DeleteAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, ruleId, actionId).GetAwaiter().GetResult();
}
///
@@ -214,8 +235,11 @@ public static void Delete(this IActionsOperations operations, string resourceGro
/// The operations group for this extension method.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -229,9 +253,9 @@ public static void Delete(this IActionsOperations operations, string resourceGro
///
/// The cancellation token.
///
- public static async Task DeleteAsync(this IActionsOperations operations, string resourceGroupName, string workspaceName, string ruleId, string actionId, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task DeleteAsync(this IActionsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, string actionId, CancellationToken cancellationToken = default(CancellationToken))
{
- (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, ruleId, actionId, null, cancellationToken).ConfigureAwait(false)).Dispose();
+ (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, ruleId, actionId, null, cancellationToken).ConfigureAwait(false)).Dispose();
}
///
diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AlertRuleTemplatesOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AlertRuleTemplatesOperations.cs
index f7c4e5f1d8e1e..0d15217e77451 100644
--- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AlertRuleTemplatesOperations.cs
+++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AlertRuleTemplatesOperations.cs
@@ -54,8 +54,11 @@ internal AlertRuleTemplatesOperations(SecurityInsightsClient client)
/// Gets all alert rule templates.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -81,17 +84,28 @@ internal AlertRuleTemplatesOperations(SecurityInsightsClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.ApiVersion != null)
+ {
+ if (Client.ApiVersion.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ }
+ }
if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
if (Client.SubscriptionId != null)
{
- if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"))
+ if (Client.SubscriptionId.Length < 1)
{
- throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$");
+ throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
}
}
if (resourceGroupName == null)
@@ -108,10 +122,10 @@ internal AlertRuleTemplatesOperations(SecurityInsightsClient client)
{
throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
}
- if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$"))
- {
- throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
- }
+ }
+ if (operationalInsightsResourceProvider == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider");
}
if (workspaceName == null)
{
@@ -136,15 +150,17 @@ internal AlertRuleTemplatesOperations(SecurityInsightsClient client)
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider);
tracingParameters.Add("workspaceName", workspaceName);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRuleTemplates").ToString();
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRuleTemplates").ToString();
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider));
_url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName));
List _queryParameters = new List();
if (Client.ApiVersion != null)
@@ -280,8 +296,11 @@ internal AlertRuleTemplatesOperations(SecurityInsightsClient client)
/// Gets the alert rule template.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -310,17 +329,28 @@ internal AlertRuleTemplatesOperations(SecurityInsightsClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string alertRuleTemplateId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string alertRuleTemplateId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.ApiVersion != null)
+ {
+ if (Client.ApiVersion.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ }
+ }
if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
if (Client.SubscriptionId != null)
{
- if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"))
+ if (Client.SubscriptionId.Length < 1)
{
- throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$");
+ throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
}
}
if (resourceGroupName == null)
@@ -337,10 +367,10 @@ internal AlertRuleTemplatesOperations(SecurityInsightsClient client)
{
throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
}
- if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$"))
- {
- throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
- }
+ }
+ if (operationalInsightsResourceProvider == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider");
}
if (workspaceName == null)
{
@@ -369,6 +399,7 @@ internal AlertRuleTemplatesOperations(SecurityInsightsClient client)
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider);
tracingParameters.Add("workspaceName", workspaceName);
tracingParameters.Add("alertRuleTemplateId", alertRuleTemplateId);
tracingParameters.Add("cancellationToken", cancellationToken);
@@ -376,9 +407,10 @@ internal AlertRuleTemplatesOperations(SecurityInsightsClient client)
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRuleTemplates/{alertRuleTemplateId}").ToString();
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRuleTemplates/{alertRuleTemplateId}").ToString();
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider));
_url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName));
_url = _url.Replace("{alertRuleTemplateId}", System.Uri.EscapeDataString(alertRuleTemplateId));
List _queryParameters = new List();
diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AlertRuleTemplatesOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AlertRuleTemplatesOperationsExtensions.cs
index 8db2e5377500c..ba86a99b9694e 100644
--- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AlertRuleTemplatesOperationsExtensions.cs
+++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AlertRuleTemplatesOperationsExtensions.cs
@@ -28,15 +28,18 @@ public static partial class AlertRuleTemplatesOperationsExtensions
/// The operations group for this extension method.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
///
- public static IPage List(this IAlertRuleTemplatesOperations operations, string resourceGroupName, string workspaceName)
+ public static IPage List(this IAlertRuleTemplatesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName)
{
- return operations.ListAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult();
+ return operations.ListAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName).GetAwaiter().GetResult();
}
///
@@ -46,8 +49,11 @@ public static IPage List(this IAlertRuleTemplatesOperations o
/// The operations group for this extension method.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -55,9 +61,9 @@ public static IPage List(this IAlertRuleTemplatesOperations o
///
/// The cancellation token.
///
- public static async Task> ListAsync(this IAlertRuleTemplatesOperations operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task> ListAsync(this IAlertRuleTemplatesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
@@ -70,8 +76,11 @@ public static IPage List(this IAlertRuleTemplatesOperations o
/// The operations group for this extension method.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -79,9 +88,9 @@ public static IPage List(this IAlertRuleTemplatesOperations o
///
/// Alert rule template ID
///
- public static AlertRuleTemplate Get(this IAlertRuleTemplatesOperations operations, string resourceGroupName, string workspaceName, string alertRuleTemplateId)
+ public static AlertRuleTemplate Get(this IAlertRuleTemplatesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string alertRuleTemplateId)
{
- return operations.GetAsync(resourceGroupName, workspaceName, alertRuleTemplateId).GetAwaiter().GetResult();
+ return operations.GetAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, alertRuleTemplateId).GetAwaiter().GetResult();
}
///
@@ -91,8 +100,11 @@ public static AlertRuleTemplate Get(this IAlertRuleTemplatesOperations operation
/// The operations group for this extension method.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -103,9 +115,9 @@ public static AlertRuleTemplate Get(this IAlertRuleTemplatesOperations operation
///
/// The cancellation token.
///
- public static async Task GetAsync(this IAlertRuleTemplatesOperations operations, string resourceGroupName, string workspaceName, string alertRuleTemplateId, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task GetAsync(this IAlertRuleTemplatesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string alertRuleTemplateId, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, workspaceName, alertRuleTemplateId, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, alertRuleTemplateId, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AlertRulesOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AlertRulesOperations.cs
index 81b3fcd83e961..a4aeb61636c41 100644
--- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AlertRulesOperations.cs
+++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AlertRulesOperations.cs
@@ -54,8 +54,11 @@ internal AlertRulesOperations(SecurityInsightsClient client)
/// Gets all alert rules.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -81,17 +84,28 @@ internal AlertRulesOperations(SecurityInsightsClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.ApiVersion != null)
+ {
+ if (Client.ApiVersion.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ }
+ }
if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
if (Client.SubscriptionId != null)
{
- if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"))
+ if (Client.SubscriptionId.Length < 1)
{
- throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$");
+ throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
}
}
if (resourceGroupName == null)
@@ -108,10 +122,10 @@ internal AlertRulesOperations(SecurityInsightsClient client)
{
throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
}
- if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$"))
- {
- throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
- }
+ }
+ if (operationalInsightsResourceProvider == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider");
}
if (workspaceName == null)
{
@@ -136,15 +150,17 @@ internal AlertRulesOperations(SecurityInsightsClient client)
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider);
tracingParameters.Add("workspaceName", workspaceName);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules").ToString();
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules").ToString();
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider));
_url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName));
List _queryParameters = new List();
if (Client.ApiVersion != null)
@@ -280,8 +296,11 @@ internal AlertRulesOperations(SecurityInsightsClient client)
/// Gets the alert rule.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -310,17 +329,28 @@ internal AlertRulesOperations(SecurityInsightsClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string ruleId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.ApiVersion != null)
+ {
+ if (Client.ApiVersion.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ }
+ }
if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
if (Client.SubscriptionId != null)
{
- if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"))
+ if (Client.SubscriptionId.Length < 1)
{
- throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$");
+ throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
}
}
if (resourceGroupName == null)
@@ -337,10 +367,10 @@ internal AlertRulesOperations(SecurityInsightsClient client)
{
throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
}
- if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$"))
- {
- throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
- }
+ }
+ if (operationalInsightsResourceProvider == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider");
}
if (workspaceName == null)
{
@@ -369,6 +399,7 @@ internal AlertRulesOperations(SecurityInsightsClient client)
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider);
tracingParameters.Add("workspaceName", workspaceName);
tracingParameters.Add("ruleId", ruleId);
tracingParameters.Add("cancellationToken", cancellationToken);
@@ -376,9 +407,10 @@ internal AlertRulesOperations(SecurityInsightsClient client)
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}").ToString();
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}").ToString();
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider));
_url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName));
_url = _url.Replace("{ruleId}", System.Uri.EscapeDataString(ruleId));
List _queryParameters = new List();
@@ -515,8 +547,11 @@ internal AlertRulesOperations(SecurityInsightsClient client)
/// Creates or updates the alert rule.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -548,17 +583,28 @@ internal AlertRulesOperations(SecurityInsightsClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string ruleId, AlertRule alertRule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, AlertRule alertRule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.ApiVersion != null)
+ {
+ if (Client.ApiVersion.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ }
+ }
if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
if (Client.SubscriptionId != null)
{
- if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"))
+ if (Client.SubscriptionId.Length < 1)
{
- throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$");
+ throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
}
}
if (resourceGroupName == null)
@@ -575,10 +621,10 @@ internal AlertRulesOperations(SecurityInsightsClient client)
{
throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
}
- if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$"))
- {
- throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
- }
+ }
+ if (operationalInsightsResourceProvider == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider");
}
if (workspaceName == null)
{
@@ -611,6 +657,7 @@ internal AlertRulesOperations(SecurityInsightsClient client)
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider);
tracingParameters.Add("workspaceName", workspaceName);
tracingParameters.Add("ruleId", ruleId);
tracingParameters.Add("alertRule", alertRule);
@@ -619,9 +666,10 @@ internal AlertRulesOperations(SecurityInsightsClient client)
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}").ToString();
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}").ToString();
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider));
_url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName));
_url = _url.Replace("{ruleId}", System.Uri.EscapeDataString(ruleId));
List _queryParameters = new List();
@@ -782,8 +830,11 @@ internal AlertRulesOperations(SecurityInsightsClient client)
/// Delete the alert rule.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -809,17 +860,28 @@ internal AlertRulesOperations(SecurityInsightsClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string ruleId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.ApiVersion != null)
+ {
+ if (Client.ApiVersion.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ }
+ }
if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
if (Client.SubscriptionId != null)
{
- if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"))
+ if (Client.SubscriptionId.Length < 1)
{
- throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$");
+ throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
}
}
if (resourceGroupName == null)
@@ -836,10 +898,10 @@ internal AlertRulesOperations(SecurityInsightsClient client)
{
throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
}
- if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$"))
- {
- throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
- }
+ }
+ if (operationalInsightsResourceProvider == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider");
}
if (workspaceName == null)
{
@@ -868,6 +930,7 @@ internal AlertRulesOperations(SecurityInsightsClient client)
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider);
tracingParameters.Add("workspaceName", workspaceName);
tracingParameters.Add("ruleId", ruleId);
tracingParameters.Add("cancellationToken", cancellationToken);
@@ -875,9 +938,10 @@ internal AlertRulesOperations(SecurityInsightsClient client)
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}").ToString();
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}").ToString();
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider));
_url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName));
_url = _url.Replace("{ruleId}", System.Uri.EscapeDataString(ruleId));
List _queryParameters = new List();
diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AlertRulesOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AlertRulesOperationsExtensions.cs
index 9aa94cc42f9dd..a6674b89b5a2f 100644
--- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AlertRulesOperationsExtensions.cs
+++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AlertRulesOperationsExtensions.cs
@@ -28,15 +28,18 @@ public static partial class AlertRulesOperationsExtensions
/// The operations group for this extension method.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
///
- public static IPage List(this IAlertRulesOperations operations, string resourceGroupName, string workspaceName)
+ public static IPage List(this IAlertRulesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName)
{
- return operations.ListAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult();
+ return operations.ListAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName).GetAwaiter().GetResult();
}
///
@@ -46,8 +49,11 @@ public static IPage List(this IAlertRulesOperations operations, strin
/// The operations group for this extension method.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -55,9 +61,9 @@ public static IPage List(this IAlertRulesOperations operations, strin
///
/// The cancellation token.
///
- public static async Task> ListAsync(this IAlertRulesOperations operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task> ListAsync(this IAlertRulesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
@@ -70,8 +76,11 @@ public static IPage List(this IAlertRulesOperations operations, strin
/// The operations group for this extension method.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -79,9 +88,9 @@ public static IPage List(this IAlertRulesOperations operations, strin
///
/// Alert rule ID
///
- public static AlertRule Get(this IAlertRulesOperations operations, string resourceGroupName, string workspaceName, string ruleId)
+ public static AlertRule Get(this IAlertRulesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId)
{
- return operations.GetAsync(resourceGroupName, workspaceName, ruleId).GetAwaiter().GetResult();
+ return operations.GetAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, ruleId).GetAwaiter().GetResult();
}
///
@@ -91,8 +100,11 @@ public static AlertRule Get(this IAlertRulesOperations operations, string resour
/// The operations group for this extension method.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -103,9 +115,9 @@ public static AlertRule Get(this IAlertRulesOperations operations, string resour
///
/// The cancellation token.
///
- public static async Task GetAsync(this IAlertRulesOperations operations, string resourceGroupName, string workspaceName, string ruleId, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task GetAsync(this IAlertRulesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, workspaceName, ruleId, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, ruleId, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
@@ -118,8 +130,11 @@ public static AlertRule Get(this IAlertRulesOperations operations, string resour
/// The operations group for this extension method.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -130,9 +145,9 @@ public static AlertRule Get(this IAlertRulesOperations operations, string resour
///
/// The alert rule
///
- public static AlertRule CreateOrUpdate(this IAlertRulesOperations operations, string resourceGroupName, string workspaceName, string ruleId, AlertRule alertRule)
+ public static AlertRule CreateOrUpdate(this IAlertRulesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, AlertRule alertRule)
{
- return operations.CreateOrUpdateAsync(resourceGroupName, workspaceName, ruleId, alertRule).GetAwaiter().GetResult();
+ return operations.CreateOrUpdateAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, ruleId, alertRule).GetAwaiter().GetResult();
}
///
@@ -142,8 +157,11 @@ public static AlertRule CreateOrUpdate(this IAlertRulesOperations operations, st
/// The operations group for this extension method.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -157,9 +175,9 @@ public static AlertRule CreateOrUpdate(this IAlertRulesOperations operations, st
///
/// The cancellation token.
///
- public static async Task CreateOrUpdateAsync(this IAlertRulesOperations operations, string resourceGroupName, string workspaceName, string ruleId, AlertRule alertRule, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task CreateOrUpdateAsync(this IAlertRulesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, AlertRule alertRule, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, ruleId, alertRule, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, ruleId, alertRule, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
@@ -172,8 +190,11 @@ public static AlertRule CreateOrUpdate(this IAlertRulesOperations operations, st
/// The operations group for this extension method.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -181,9 +202,9 @@ public static AlertRule CreateOrUpdate(this IAlertRulesOperations operations, st
///
/// Alert rule ID
///
- public static void Delete(this IAlertRulesOperations operations, string resourceGroupName, string workspaceName, string ruleId)
+ public static void Delete(this IAlertRulesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId)
{
- operations.DeleteAsync(resourceGroupName, workspaceName, ruleId).GetAwaiter().GetResult();
+ operations.DeleteAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, ruleId).GetAwaiter().GetResult();
}
///
@@ -193,8 +214,11 @@ public static void Delete(this IAlertRulesOperations operations, string resource
/// The operations group for this extension method.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -205,9 +229,9 @@ public static void Delete(this IAlertRulesOperations operations, string resource
///
/// The cancellation token.
///
- public static async Task DeleteAsync(this IAlertRulesOperations operations, string resourceGroupName, string workspaceName, string ruleId, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task DeleteAsync(this IAlertRulesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, CancellationToken cancellationToken = default(CancellationToken))
{
- (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, ruleId, null, cancellationToken).ConfigureAwait(false)).Dispose();
+ (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, ruleId, null, cancellationToken).ConfigureAwait(false)).Dispose();
}
///
diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AutomationRulesOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AutomationRulesOperations.cs
new file mode 100644
index 0000000000000..f3c2132c863ad
--- /dev/null
+++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AutomationRulesOperations.cs
@@ -0,0 +1,1237 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.SecurityInsights
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Net;
+ using System.Net.Http;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// AutomationRulesOperations operations.
+ ///
+ internal partial class AutomationRulesOperations : IServiceOperations, IAutomationRulesOperations
+ {
+ ///
+ /// Initializes a new instance of the AutomationRulesOperations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ internal AutomationRulesOperations(SecurityInsightsClient client)
+ {
+ if (client == null)
+ {
+ throw new System.ArgumentNullException("client");
+ }
+ Client = client;
+ }
+
+ ///
+ /// Gets a reference to the SecurityInsightsClient
+ ///
+ public SecurityInsightsClient Client { get; private set; }
+
+ ///
+ /// Gets all automation rules.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.ApiVersion != null)
+ {
+ if (Client.ApiVersion.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ }
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (Client.SubscriptionId != null)
+ {
+ if (Client.SubscriptionId.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
+ }
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (resourceGroupName != null)
+ {
+ if (resourceGroupName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
+ }
+ if (resourceGroupName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
+ }
+ }
+ if (operationalInsightsResourceProvider == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider");
+ }
+ if (workspaceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName");
+ }
+ if (workspaceName != null)
+ {
+ if (workspaceName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90);
+ }
+ if (workspaceName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1);
+ }
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider);
+ tracingParameters.Add("workspaceName", workspaceName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/automationRules").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider));
+ _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Gets the automation rule.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// Automation rule ID
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string automationRuleId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.ApiVersion != null)
+ {
+ if (Client.ApiVersion.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ }
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (Client.SubscriptionId != null)
+ {
+ if (Client.SubscriptionId.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
+ }
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (resourceGroupName != null)
+ {
+ if (resourceGroupName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
+ }
+ if (resourceGroupName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
+ }
+ }
+ if (operationalInsightsResourceProvider == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider");
+ }
+ if (workspaceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName");
+ }
+ if (workspaceName != null)
+ {
+ if (workspaceName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90);
+ }
+ if (workspaceName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1);
+ }
+ }
+ if (automationRuleId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "automationRuleId");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider);
+ tracingParameters.Add("workspaceName", workspaceName);
+ tracingParameters.Add("automationRuleId", automationRuleId);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/automationRules/{automationRuleId}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider));
+ _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName));
+ _url = _url.Replace("{automationRuleId}", System.Uri.EscapeDataString(automationRuleId));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Creates or updates the automation rule.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// Automation rule ID
+ ///
+ ///
+ /// The automation rule
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string automationRuleId, AutomationRule automationRule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.ApiVersion != null)
+ {
+ if (Client.ApiVersion.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ }
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (Client.SubscriptionId != null)
+ {
+ if (Client.SubscriptionId.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
+ }
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (resourceGroupName != null)
+ {
+ if (resourceGroupName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
+ }
+ if (resourceGroupName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
+ }
+ }
+ if (operationalInsightsResourceProvider == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider");
+ }
+ if (workspaceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName");
+ }
+ if (workspaceName != null)
+ {
+ if (workspaceName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90);
+ }
+ if (workspaceName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1);
+ }
+ }
+ if (automationRuleId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "automationRuleId");
+ }
+ if (automationRule == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "automationRule");
+ }
+ if (automationRule != null)
+ {
+ automationRule.Validate();
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider);
+ tracingParameters.Add("workspaceName", workspaceName);
+ tracingParameters.Add("automationRuleId", automationRuleId);
+ tracingParameters.Add("automationRule", automationRule);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/automationRules/{automationRuleId}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider));
+ _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName));
+ _url = _url.Replace("{automationRuleId}", System.Uri.EscapeDataString(automationRuleId));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("PUT");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ if(automationRule != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(automationRule, Client.SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ }
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200 && (int)_statusCode != 201)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 201)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Delete the automation rule.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// Automation rule ID
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string automationRuleId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.ApiVersion != null)
+ {
+ if (Client.ApiVersion.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ }
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (Client.SubscriptionId != null)
+ {
+ if (Client.SubscriptionId.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
+ }
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (resourceGroupName != null)
+ {
+ if (resourceGroupName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
+ }
+ if (resourceGroupName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
+ }
+ }
+ if (operationalInsightsResourceProvider == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider");
+ }
+ if (workspaceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName");
+ }
+ if (workspaceName != null)
+ {
+ if (workspaceName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90);
+ }
+ if (workspaceName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1);
+ }
+ }
+ if (automationRuleId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "automationRuleId");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider);
+ tracingParameters.Add("workspaceName", workspaceName);
+ tracingParameters.Add("automationRuleId", automationRuleId);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/automationRules/{automationRuleId}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider));
+ _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName));
+ _url = _url.Replace("{automationRuleId}", System.Uri.EscapeDataString(automationRuleId));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("DELETE");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200 && (int)_statusCode != 204)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Gets all automation rules.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (nextPageLink == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("nextPageLink", nextPageLink);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters);
+ }
+ // Construct URL
+ string _url = "{nextLink}";
+ _url = _url.Replace("{nextLink}", nextPageLink);
+ List _queryParameters = new List();
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ }
+}
diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AutomationRulesOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AutomationRulesOperationsExtensions.cs
new file mode 100644
index 0000000000000..5616e10a28283
--- /dev/null
+++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AutomationRulesOperationsExtensions.cs
@@ -0,0 +1,272 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.SecurityInsights
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// Extension methods for AutomationRulesOperations.
+ ///
+ public static partial class AutomationRulesOperationsExtensions
+ {
+ ///
+ /// Gets all automation rules.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ public static IPage List(this IAutomationRulesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName)
+ {
+ return operations.ListAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Gets all automation rules.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task> ListAsync(this IAutomationRulesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Gets the automation rule.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// Automation rule ID
+ ///
+ public static AutomationRule Get(this IAutomationRulesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string automationRuleId)
+ {
+ return operations.GetAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, automationRuleId).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Gets the automation rule.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// Automation rule ID
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task GetAsync(this IAutomationRulesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string automationRuleId, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, automationRuleId, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Creates or updates the automation rule.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// Automation rule ID
+ ///
+ ///
+ /// The automation rule
+ ///
+ public static AutomationRule CreateOrUpdate(this IAutomationRulesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string automationRuleId, AutomationRule automationRule)
+ {
+ return operations.CreateOrUpdateAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, automationRuleId, automationRule).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Creates or updates the automation rule.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// Automation rule ID
+ ///
+ ///
+ /// The automation rule
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task CreateOrUpdateAsync(this IAutomationRulesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string automationRuleId, AutomationRule automationRule, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, automationRuleId, automationRule, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Delete the automation rule.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// Automation rule ID
+ ///
+ public static void Delete(this IAutomationRulesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string automationRuleId)
+ {
+ operations.DeleteAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, automationRuleId).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Delete the automation rule.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// Automation rule ID
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task DeleteAsync(this IAutomationRulesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string automationRuleId, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, automationRuleId, null, cancellationToken).ConfigureAwait(false)).Dispose();
+ }
+
+ ///
+ /// Gets all automation rules.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ public static IPage ListNext(this IAutomationRulesOperations operations, string nextPageLink)
+ {
+ return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Gets all automation rules.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task> ListNextAsync(this IAutomationRulesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ }
+}
diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/BookmarkOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/BookmarkOperations.cs
new file mode 100644
index 0000000000000..80f57ad3206d5
--- /dev/null
+++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/BookmarkOperations.cs
@@ -0,0 +1,320 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.SecurityInsights
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Net;
+ using System.Net.Http;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// BookmarkOperations operations.
+ ///
+ internal partial class BookmarkOperations : IServiceOperations, IBookmarkOperations
+ {
+ ///
+ /// Initializes a new instance of the BookmarkOperations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ internal BookmarkOperations(SecurityInsightsClient client)
+ {
+ if (client == null)
+ {
+ throw new System.ArgumentNullException("client");
+ }
+ Client = client;
+ }
+
+ ///
+ /// Gets a reference to the SecurityInsightsClient
+ ///
+ public SecurityInsightsClient Client { get; private set; }
+
+ ///
+ /// Expand an bookmark
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// Bookmark ID
+ ///
+ ///
+ /// The parameters required to execute an expand operation on the given
+ /// bookmark.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> ExpandWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, BookmarkExpandParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.ApiVersion != null)
+ {
+ if (Client.ApiVersion.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ }
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (Client.SubscriptionId != null)
+ {
+ if (Client.SubscriptionId.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
+ }
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (resourceGroupName != null)
+ {
+ if (resourceGroupName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
+ }
+ if (resourceGroupName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
+ }
+ }
+ if (operationalInsightsResourceProvider == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider");
+ }
+ if (workspaceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName");
+ }
+ if (workspaceName != null)
+ {
+ if (workspaceName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90);
+ }
+ if (workspaceName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1);
+ }
+ }
+ if (bookmarkId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "bookmarkId");
+ }
+ if (parameters == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider);
+ tracingParameters.Add("workspaceName", workspaceName);
+ tracingParameters.Add("bookmarkId", bookmarkId);
+ tracingParameters.Add("parameters", parameters);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "Expand", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/expand").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider));
+ _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName));
+ _url = _url.Replace("{bookmarkId}", System.Uri.EscapeDataString(bookmarkId));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("POST");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ if(parameters != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ }
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ }
+}
diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/BookmarkOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/BookmarkOperationsExtensions.cs
new file mode 100644
index 0000000000000..e3264bf2c4a1e
--- /dev/null
+++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/BookmarkOperationsExtensions.cs
@@ -0,0 +1,87 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.SecurityInsights
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// Extension methods for BookmarkOperations.
+ ///
+ public static partial class BookmarkOperationsExtensions
+ {
+ ///
+ /// Expand an bookmark
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// Bookmark ID
+ ///
+ ///
+ /// The parameters required to execute an expand operation on the given
+ /// bookmark.
+ ///
+ public static BookmarkExpandResponse Expand(this IBookmarkOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, BookmarkExpandParameters parameters)
+ {
+ return operations.ExpandAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, bookmarkId, parameters).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Expand an bookmark
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// Bookmark ID
+ ///
+ ///
+ /// The parameters required to execute an expand operation on the given
+ /// bookmark.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task ExpandAsync(this IBookmarkOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, BookmarkExpandParameters parameters, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ExpandWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, bookmarkId, parameters, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ }
+}
diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/BookmarkRelationsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/BookmarkRelationsOperations.cs
new file mode 100644
index 0000000000000..b33907feeeb81
--- /dev/null
+++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/BookmarkRelationsOperations.cs
@@ -0,0 +1,1302 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.SecurityInsights
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Microsoft.Rest.Azure.OData;
+ using Models;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Net;
+ using System.Net.Http;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// BookmarkRelationsOperations operations.
+ ///
+ internal partial class BookmarkRelationsOperations : IServiceOperations, IBookmarkRelationsOperations
+ {
+ ///
+ /// Initializes a new instance of the BookmarkRelationsOperations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ internal BookmarkRelationsOperations(SecurityInsightsClient client)
+ {
+ if (client == null)
+ {
+ throw new System.ArgumentNullException("client");
+ }
+ Client = client;
+ }
+
+ ///
+ /// Gets a reference to the SecurityInsightsClient
+ ///
+ public SecurityInsightsClient Client { get; private set; }
+
+ ///
+ /// Gets all bookmark relations.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// Bookmark ID
+ ///
+ ///
+ /// OData parameters to apply to the operation.
+ ///
+ ///
+ /// Skiptoken is only used if a previous operation returned a partial result.
+ /// If a previous response contains a nextLink element, the value of the
+ /// nextLink element will include a skiptoken parameter that specifies a
+ /// starting point to use for subsequent calls. Optional.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.ApiVersion != null)
+ {
+ if (Client.ApiVersion.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ }
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (Client.SubscriptionId != null)
+ {
+ if (Client.SubscriptionId.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
+ }
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (resourceGroupName != null)
+ {
+ if (resourceGroupName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
+ }
+ if (resourceGroupName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
+ }
+ }
+ if (operationalInsightsResourceProvider == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider");
+ }
+ if (workspaceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName");
+ }
+ if (workspaceName != null)
+ {
+ if (workspaceName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90);
+ }
+ if (workspaceName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1);
+ }
+ }
+ if (bookmarkId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "bookmarkId");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("odataQuery", odataQuery);
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider);
+ tracingParameters.Add("workspaceName", workspaceName);
+ tracingParameters.Add("bookmarkId", bookmarkId);
+ tracingParameters.Add("skipToken", skipToken);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/relations").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider));
+ _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName));
+ _url = _url.Replace("{bookmarkId}", System.Uri.EscapeDataString(bookmarkId));
+ List _queryParameters = new List();
+ if (odataQuery != null)
+ {
+ var _odataFilter = odataQuery.ToString();
+ if (!string.IsNullOrEmpty(_odataFilter))
+ {
+ _queryParameters.Add(_odataFilter);
+ }
+ }
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (skipToken != null)
+ {
+ _queryParameters.Add(string.Format("$skipToken={0}", System.Uri.EscapeDataString(skipToken)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Gets a bookmark relation.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// Bookmark ID
+ ///
+ ///
+ /// Relation Name
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, string relationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.ApiVersion != null)
+ {
+ if (Client.ApiVersion.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ }
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (Client.SubscriptionId != null)
+ {
+ if (Client.SubscriptionId.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
+ }
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (resourceGroupName != null)
+ {
+ if (resourceGroupName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
+ }
+ if (resourceGroupName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
+ }
+ }
+ if (operationalInsightsResourceProvider == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider");
+ }
+ if (workspaceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName");
+ }
+ if (workspaceName != null)
+ {
+ if (workspaceName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90);
+ }
+ if (workspaceName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1);
+ }
+ }
+ if (bookmarkId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "bookmarkId");
+ }
+ if (relationName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "relationName");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider);
+ tracingParameters.Add("workspaceName", workspaceName);
+ tracingParameters.Add("bookmarkId", bookmarkId);
+ tracingParameters.Add("relationName", relationName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/relations/{relationName}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider));
+ _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName));
+ _url = _url.Replace("{bookmarkId}", System.Uri.EscapeDataString(bookmarkId));
+ _url = _url.Replace("{relationName}", System.Uri.EscapeDataString(relationName));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Creates the bookmark relation.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// Bookmark ID
+ ///
+ ///
+ /// Relation Name
+ ///
+ ///
+ /// The resource ID of the related resource
+ ///
+ ///
+ /// Etag of the azure resource
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, string relationName, string relatedResourceId, string etag = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.ApiVersion != null)
+ {
+ if (Client.ApiVersion.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ }
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (Client.SubscriptionId != null)
+ {
+ if (Client.SubscriptionId.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
+ }
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (resourceGroupName != null)
+ {
+ if (resourceGroupName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
+ }
+ if (resourceGroupName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
+ }
+ }
+ if (operationalInsightsResourceProvider == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider");
+ }
+ if (workspaceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName");
+ }
+ if (workspaceName != null)
+ {
+ if (workspaceName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90);
+ }
+ if (workspaceName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1);
+ }
+ }
+ if (bookmarkId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "bookmarkId");
+ }
+ if (relationName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "relationName");
+ }
+ if (relatedResourceId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "relatedResourceId");
+ }
+ Relation relation = new Relation();
+ if (etag != null || relatedResourceId != null)
+ {
+ relation.Etag = etag;
+ relation.RelatedResourceId = relatedResourceId;
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider);
+ tracingParameters.Add("workspaceName", workspaceName);
+ tracingParameters.Add("bookmarkId", bookmarkId);
+ tracingParameters.Add("relationName", relationName);
+ tracingParameters.Add("relation", relation);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/relations/{relationName}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider));
+ _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName));
+ _url = _url.Replace("{bookmarkId}", System.Uri.EscapeDataString(bookmarkId));
+ _url = _url.Replace("{relationName}", System.Uri.EscapeDataString(relationName));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("PUT");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ if(relation != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(relation, Client.SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ }
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200 && (int)_statusCode != 201)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 201)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Delete the bookmark relation.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// Bookmark ID
+ ///
+ ///
+ /// Relation Name
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, string relationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.ApiVersion != null)
+ {
+ if (Client.ApiVersion.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ }
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (Client.SubscriptionId != null)
+ {
+ if (Client.SubscriptionId.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
+ }
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (resourceGroupName != null)
+ {
+ if (resourceGroupName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
+ }
+ if (resourceGroupName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
+ }
+ }
+ if (operationalInsightsResourceProvider == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider");
+ }
+ if (workspaceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName");
+ }
+ if (workspaceName != null)
+ {
+ if (workspaceName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90);
+ }
+ if (workspaceName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1);
+ }
+ }
+ if (bookmarkId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "bookmarkId");
+ }
+ if (relationName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "relationName");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider);
+ tracingParameters.Add("workspaceName", workspaceName);
+ tracingParameters.Add("bookmarkId", bookmarkId);
+ tracingParameters.Add("relationName", relationName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}/relations/{relationName}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider));
+ _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName));
+ _url = _url.Replace("{bookmarkId}", System.Uri.EscapeDataString(bookmarkId));
+ _url = _url.Replace("{relationName}", System.Uri.EscapeDataString(relationName));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("DELETE");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200 && (int)_statusCode != 204)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Gets all bookmark relations.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (nextPageLink == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("nextPageLink", nextPageLink);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters);
+ }
+ // Construct URL
+ string _url = "{nextLink}";
+ _url = _url.Replace("{nextLink}", nextPageLink);
+ List _queryParameters = new List();
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ }
+}
diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/BookmarkRelationsOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/BookmarkRelationsOperationsExtensions.cs
new file mode 100644
index 0000000000000..383585c669da4
--- /dev/null
+++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/BookmarkRelationsOperationsExtensions.cs
@@ -0,0 +1,321 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.SecurityInsights
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Microsoft.Rest.Azure.OData;
+ using Models;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// Extension methods for BookmarkRelationsOperations.
+ ///
+ public static partial class BookmarkRelationsOperationsExtensions
+ {
+ ///
+ /// Gets all bookmark relations.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// Bookmark ID
+ ///
+ ///
+ /// OData parameters to apply to the operation.
+ ///
+ ///
+ /// Skiptoken is only used if a previous operation returned a partial result.
+ /// If a previous response contains a nextLink element, the value of the
+ /// nextLink element will include a skiptoken parameter that specifies a
+ /// starting point to use for subsequent calls. Optional.
+ ///
+ public static IPage List(this IBookmarkRelationsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string))
+ {
+ return operations.ListAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, bookmarkId, odataQuery, skipToken).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Gets all bookmark relations.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// Bookmark ID
+ ///
+ ///
+ /// OData parameters to apply to the operation.
+ ///
+ ///
+ /// Skiptoken is only used if a previous operation returned a partial result.
+ /// If a previous response contains a nextLink element, the value of the
+ /// nextLink element will include a skiptoken parameter that specifies a
+ /// starting point to use for subsequent calls. Optional.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task> ListAsync(this IBookmarkRelationsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, bookmarkId, odataQuery, skipToken, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Gets a bookmark relation.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// Bookmark ID
+ ///
+ ///
+ /// Relation Name
+ ///
+ public static Relation Get(this IBookmarkRelationsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, string relationName)
+ {
+ return operations.GetAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, bookmarkId, relationName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Gets a bookmark relation.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// Bookmark ID
+ ///
+ ///
+ /// Relation Name
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task GetAsync(this IBookmarkRelationsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, string relationName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, bookmarkId, relationName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Creates the bookmark relation.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// Bookmark ID
+ ///
+ ///
+ /// Relation Name
+ ///
+ ///
+ /// The resource ID of the related resource
+ ///
+ ///
+ /// Etag of the azure resource
+ ///
+ public static Relation CreateOrUpdate(this IBookmarkRelationsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, string relationName, string relatedResourceId, string etag = default(string))
+ {
+ return operations.CreateOrUpdateAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, bookmarkId, relationName, relatedResourceId, etag).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Creates the bookmark relation.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// Bookmark ID
+ ///
+ ///
+ /// Relation Name
+ ///
+ ///
+ /// The resource ID of the related resource
+ ///
+ ///
+ /// Etag of the azure resource
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task CreateOrUpdateAsync(this IBookmarkRelationsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, string relationName, string relatedResourceId, string etag = default(string), CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, bookmarkId, relationName, relatedResourceId, etag, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Delete the bookmark relation.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// Bookmark ID
+ ///
+ ///
+ /// Relation Name
+ ///
+ public static void Delete(this IBookmarkRelationsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, string relationName)
+ {
+ operations.DeleteAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, bookmarkId, relationName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Delete the bookmark relation.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// Bookmark ID
+ ///
+ ///
+ /// Relation Name
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task DeleteAsync(this IBookmarkRelationsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, string relationName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, bookmarkId, relationName, null, cancellationToken).ConfigureAwait(false)).Dispose();
+ }
+
+ ///
+ /// Gets all bookmark relations.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ public static IPage ListNext(this IBookmarkRelationsOperations operations, string nextPageLink)
+ {
+ return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Gets all bookmark relations.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task> ListNextAsync(this IBookmarkRelationsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ }
+}
diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/BookmarksOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/BookmarksOperations.cs
index d5543ca885972..f674e24bebdb8 100644
--- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/BookmarksOperations.cs
+++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/BookmarksOperations.cs
@@ -54,8 +54,11 @@ internal BookmarksOperations(SecurityInsightsClient client)
/// Gets all bookmarks.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -81,17 +84,28 @@ internal BookmarksOperations(SecurityInsightsClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.ApiVersion != null)
+ {
+ if (Client.ApiVersion.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ }
+ }
if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
if (Client.SubscriptionId != null)
{
- if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"))
+ if (Client.SubscriptionId.Length < 1)
{
- throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$");
+ throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
}
}
if (resourceGroupName == null)
@@ -108,10 +122,10 @@ internal BookmarksOperations(SecurityInsightsClient client)
{
throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
}
- if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$"))
- {
- throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
- }
+ }
+ if (operationalInsightsResourceProvider == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider");
}
if (workspaceName == null)
{
@@ -136,15 +150,17 @@ internal BookmarksOperations(SecurityInsightsClient client)
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider);
tracingParameters.Add("workspaceName", workspaceName);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks").ToString();
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks").ToString();
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider));
_url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName));
List _queryParameters = new List();
if (Client.ApiVersion != null)
@@ -280,8 +296,11 @@ internal BookmarksOperations(SecurityInsightsClient client)
/// Gets a bookmark.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -310,17 +329,28 @@ internal BookmarksOperations(SecurityInsightsClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string bookmarkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.ApiVersion != null)
+ {
+ if (Client.ApiVersion.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ }
+ }
if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
if (Client.SubscriptionId != null)
{
- if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"))
+ if (Client.SubscriptionId.Length < 1)
{
- throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$");
+ throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
}
}
if (resourceGroupName == null)
@@ -337,10 +367,10 @@ internal BookmarksOperations(SecurityInsightsClient client)
{
throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
}
- if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$"))
- {
- throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
- }
+ }
+ if (operationalInsightsResourceProvider == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider");
}
if (workspaceName == null)
{
@@ -369,6 +399,7 @@ internal BookmarksOperations(SecurityInsightsClient client)
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider);
tracingParameters.Add("workspaceName", workspaceName);
tracingParameters.Add("bookmarkId", bookmarkId);
tracingParameters.Add("cancellationToken", cancellationToken);
@@ -376,9 +407,10 @@ internal BookmarksOperations(SecurityInsightsClient client)
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}").ToString();
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}").ToString();
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider));
_url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName));
_url = _url.Replace("{bookmarkId}", System.Uri.EscapeDataString(bookmarkId));
List _queryParameters = new List();
@@ -515,8 +547,11 @@ internal BookmarksOperations(SecurityInsightsClient client)
/// Creates or updates the bookmark.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -548,17 +583,28 @@ internal BookmarksOperations(SecurityInsightsClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string bookmarkId, Bookmark bookmark, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, Bookmark bookmark, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.ApiVersion != null)
+ {
+ if (Client.ApiVersion.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ }
+ }
if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
if (Client.SubscriptionId != null)
{
- if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"))
+ if (Client.SubscriptionId.Length < 1)
{
- throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$");
+ throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
}
}
if (resourceGroupName == null)
@@ -575,10 +621,10 @@ internal BookmarksOperations(SecurityInsightsClient client)
{
throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
}
- if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$"))
- {
- throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
- }
+ }
+ if (operationalInsightsResourceProvider == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider");
}
if (workspaceName == null)
{
@@ -615,6 +661,7 @@ internal BookmarksOperations(SecurityInsightsClient client)
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider);
tracingParameters.Add("workspaceName", workspaceName);
tracingParameters.Add("bookmarkId", bookmarkId);
tracingParameters.Add("bookmark", bookmark);
@@ -623,9 +670,10 @@ internal BookmarksOperations(SecurityInsightsClient client)
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}").ToString();
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}").ToString();
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider));
_url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName));
_url = _url.Replace("{bookmarkId}", System.Uri.EscapeDataString(bookmarkId));
List _queryParameters = new List();
@@ -786,8 +834,11 @@ internal BookmarksOperations(SecurityInsightsClient client)
/// Delete the bookmark.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -813,17 +864,28 @@ internal BookmarksOperations(SecurityInsightsClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string bookmarkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.ApiVersion != null)
+ {
+ if (Client.ApiVersion.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ }
+ }
if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
if (Client.SubscriptionId != null)
{
- if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"))
+ if (Client.SubscriptionId.Length < 1)
{
- throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$");
+ throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
}
}
if (resourceGroupName == null)
@@ -840,10 +902,10 @@ internal BookmarksOperations(SecurityInsightsClient client)
{
throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
}
- if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$"))
- {
- throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
- }
+ }
+ if (operationalInsightsResourceProvider == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider");
}
if (workspaceName == null)
{
@@ -872,6 +934,7 @@ internal BookmarksOperations(SecurityInsightsClient client)
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider);
tracingParameters.Add("workspaceName", workspaceName);
tracingParameters.Add("bookmarkId", bookmarkId);
tracingParameters.Add("cancellationToken", cancellationToken);
@@ -879,9 +942,10 @@ internal BookmarksOperations(SecurityInsightsClient client)
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}").ToString();
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/bookmarks/{bookmarkId}").ToString();
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider));
_url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName));
_url = _url.Replace("{bookmarkId}", System.Uri.EscapeDataString(bookmarkId));
List _queryParameters = new List();
diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/BookmarksOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/BookmarksOperationsExtensions.cs
index 00b4bf29cc5ad..9b2549152be61 100644
--- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/BookmarksOperationsExtensions.cs
+++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/BookmarksOperationsExtensions.cs
@@ -28,15 +28,18 @@ public static partial class BookmarksOperationsExtensions
/// The operations group for this extension method.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
///
- public static IPage List(this IBookmarksOperations operations, string resourceGroupName, string workspaceName)
+ public static IPage List(this IBookmarksOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName)
{
- return operations.ListAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult();
+ return operations.ListAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName).GetAwaiter().GetResult();
}
///
@@ -46,8 +49,11 @@ public static IPage List(this IBookmarksOperations operations, string
/// The operations group for this extension method.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -55,9 +61,9 @@ public static IPage List(this IBookmarksOperations operations, string
///
/// The cancellation token.
///
- public static async Task> ListAsync(this IBookmarksOperations operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task> ListAsync(this IBookmarksOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
@@ -70,8 +76,11 @@ public static IPage List(this IBookmarksOperations operations, string
/// The operations group for this extension method.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -79,9 +88,9 @@ public static IPage List(this IBookmarksOperations operations, string
///
/// Bookmark ID
///
- public static Bookmark Get(this IBookmarksOperations operations, string resourceGroupName, string workspaceName, string bookmarkId)
+ public static Bookmark Get(this IBookmarksOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId)
{
- return operations.GetAsync(resourceGroupName, workspaceName, bookmarkId).GetAwaiter().GetResult();
+ return operations.GetAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, bookmarkId).GetAwaiter().GetResult();
}
///
@@ -91,8 +100,11 @@ public static Bookmark Get(this IBookmarksOperations operations, string resource
/// The operations group for this extension method.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -103,9 +115,9 @@ public static Bookmark Get(this IBookmarksOperations operations, string resource
///
/// The cancellation token.
///
- public static async Task GetAsync(this IBookmarksOperations operations, string resourceGroupName, string workspaceName, string bookmarkId, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task GetAsync(this IBookmarksOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, workspaceName, bookmarkId, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, bookmarkId, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
@@ -118,8 +130,11 @@ public static Bookmark Get(this IBookmarksOperations operations, string resource
/// The operations group for this extension method.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -130,9 +145,9 @@ public static Bookmark Get(this IBookmarksOperations operations, string resource
///
/// The bookmark
///
- public static Bookmark CreateOrUpdate(this IBookmarksOperations operations, string resourceGroupName, string workspaceName, string bookmarkId, Bookmark bookmark)
+ public static Bookmark CreateOrUpdate(this IBookmarksOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, Bookmark bookmark)
{
- return operations.CreateOrUpdateAsync(resourceGroupName, workspaceName, bookmarkId, bookmark).GetAwaiter().GetResult();
+ return operations.CreateOrUpdateAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, bookmarkId, bookmark).GetAwaiter().GetResult();
}
///
@@ -142,8 +157,11 @@ public static Bookmark CreateOrUpdate(this IBookmarksOperations operations, stri
/// The operations group for this extension method.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -157,9 +175,9 @@ public static Bookmark CreateOrUpdate(this IBookmarksOperations operations, stri
///
/// The cancellation token.
///
- public static async Task CreateOrUpdateAsync(this IBookmarksOperations operations, string resourceGroupName, string workspaceName, string bookmarkId, Bookmark bookmark, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task CreateOrUpdateAsync(this IBookmarksOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, Bookmark bookmark, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, bookmarkId, bookmark, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, bookmarkId, bookmark, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
@@ -172,8 +190,11 @@ public static Bookmark CreateOrUpdate(this IBookmarksOperations operations, stri
/// The operations group for this extension method.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -181,9 +202,9 @@ public static Bookmark CreateOrUpdate(this IBookmarksOperations operations, stri
///
/// Bookmark ID
///
- public static void Delete(this IBookmarksOperations operations, string resourceGroupName, string workspaceName, string bookmarkId)
+ public static void Delete(this IBookmarksOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId)
{
- operations.DeleteAsync(resourceGroupName, workspaceName, bookmarkId).GetAwaiter().GetResult();
+ operations.DeleteAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, bookmarkId).GetAwaiter().GetResult();
}
///
@@ -193,8 +214,11 @@ public static void Delete(this IBookmarksOperations operations, string resourceG
/// The operations group for this extension method.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -205,9 +229,9 @@ public static void Delete(this IBookmarksOperations operations, string resourceG
///
/// The cancellation token.
///
- public static async Task DeleteAsync(this IBookmarksOperations operations, string resourceGroupName, string workspaceName, string bookmarkId, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task DeleteAsync(this IBookmarksOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, CancellationToken cancellationToken = default(CancellationToken))
{
- (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, bookmarkId, null, cancellationToken).ConfigureAwait(false)).Dispose();
+ (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, bookmarkId, null, cancellationToken).ConfigureAwait(false)).Dispose();
}
///
diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/DataConnectorsCheckRequirementsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/DataConnectorsCheckRequirementsOperations.cs
new file mode 100644
index 0000000000000..1e371210ca1fc
--- /dev/null
+++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/DataConnectorsCheckRequirementsOperations.cs
@@ -0,0 +1,310 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.SecurityInsights
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Net;
+ using System.Net.Http;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// DataConnectorsCheckRequirementsOperations operations.
+ ///
+ internal partial class DataConnectorsCheckRequirementsOperations : IServiceOperations, IDataConnectorsCheckRequirementsOperations
+ {
+ ///
+ /// Initializes a new instance of the DataConnectorsCheckRequirementsOperations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ internal DataConnectorsCheckRequirementsOperations(SecurityInsightsClient client)
+ {
+ if (client == null)
+ {
+ throw new System.ArgumentNullException("client");
+ }
+ Client = client;
+ }
+
+ ///
+ /// Gets a reference to the SecurityInsightsClient
+ ///
+ public SecurityInsightsClient Client { get; private set; }
+
+ ///
+ /// Get requirements state for a data connector type.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// The parameters for requirements check message
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> PostWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, DataConnectorsCheckRequirements dataConnectorsCheckRequirements, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.ApiVersion != null)
+ {
+ if (Client.ApiVersion.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ }
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (Client.SubscriptionId != null)
+ {
+ if (Client.SubscriptionId.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
+ }
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (resourceGroupName != null)
+ {
+ if (resourceGroupName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
+ }
+ if (resourceGroupName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
+ }
+ }
+ if (operationalInsightsResourceProvider == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider");
+ }
+ if (workspaceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName");
+ }
+ if (workspaceName != null)
+ {
+ if (workspaceName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90);
+ }
+ if (workspaceName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1);
+ }
+ }
+ if (dataConnectorsCheckRequirements == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "dataConnectorsCheckRequirements");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider);
+ tracingParameters.Add("workspaceName", workspaceName);
+ tracingParameters.Add("dataConnectorsCheckRequirements", dataConnectorsCheckRequirements);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "Post", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectorsCheckRequirements").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider));
+ _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("POST");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ if(dataConnectorsCheckRequirements != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(dataConnectorsCheckRequirements, Client.SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ }
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ }
+}
diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/DataConnectorsCheckRequirementsOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/DataConnectorsCheckRequirementsOperationsExtensions.cs
new file mode 100644
index 0000000000000..e62b380bd141b
--- /dev/null
+++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/DataConnectorsCheckRequirementsOperationsExtensions.cs
@@ -0,0 +1,79 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.SecurityInsights
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// Extension methods for DataConnectorsCheckRequirementsOperations.
+ ///
+ public static partial class DataConnectorsCheckRequirementsOperationsExtensions
+ {
+ ///
+ /// Get requirements state for a data connector type.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// The parameters for requirements check message
+ ///
+ public static DataConnectorRequirementsState Post(this IDataConnectorsCheckRequirementsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, DataConnectorsCheckRequirements dataConnectorsCheckRequirements)
+ {
+ return operations.PostAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, dataConnectorsCheckRequirements).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Get requirements state for a data connector type.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// The parameters for requirements check message
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task PostAsync(this IDataConnectorsCheckRequirementsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, DataConnectorsCheckRequirements dataConnectorsCheckRequirements, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.PostWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, dataConnectorsCheckRequirements, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ }
+}
diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/DataConnectorsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/DataConnectorsOperations.cs
index bd4235e711488..0eedfc40aab78 100644
--- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/DataConnectorsOperations.cs
+++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/DataConnectorsOperations.cs
@@ -54,8 +54,11 @@ internal DataConnectorsOperations(SecurityInsightsClient client)
/// Gets all data connectors.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -81,17 +84,28 @@ internal DataConnectorsOperations(SecurityInsightsClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.ApiVersion != null)
+ {
+ if (Client.ApiVersion.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ }
+ }
if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
if (Client.SubscriptionId != null)
{
- if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"))
+ if (Client.SubscriptionId.Length < 1)
{
- throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$");
+ throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
}
}
if (resourceGroupName == null)
@@ -108,10 +122,10 @@ internal DataConnectorsOperations(SecurityInsightsClient client)
{
throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
}
- if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$"))
- {
- throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
- }
+ }
+ if (operationalInsightsResourceProvider == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider");
}
if (workspaceName == null)
{
@@ -136,15 +150,17 @@ internal DataConnectorsOperations(SecurityInsightsClient client)
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider);
tracingParameters.Add("workspaceName", workspaceName);
tracingParameters.Add("cancellationToken", cancellationToken);
ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors").ToString();
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors").ToString();
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider));
_url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName));
List _queryParameters = new List();
if (Client.ApiVersion != null)
@@ -280,8 +296,11 @@ internal DataConnectorsOperations(SecurityInsightsClient client)
/// Gets a data connector.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -310,17 +329,28 @@ internal DataConnectorsOperations(SecurityInsightsClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string dataConnectorId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string dataConnectorId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.ApiVersion != null)
+ {
+ if (Client.ApiVersion.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ }
+ }
if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
if (Client.SubscriptionId != null)
{
- if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"))
+ if (Client.SubscriptionId.Length < 1)
{
- throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$");
+ throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
}
}
if (resourceGroupName == null)
@@ -337,10 +367,10 @@ internal DataConnectorsOperations(SecurityInsightsClient client)
{
throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
}
- if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$"))
- {
- throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
- }
+ }
+ if (operationalInsightsResourceProvider == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider");
}
if (workspaceName == null)
{
@@ -369,6 +399,7 @@ internal DataConnectorsOperations(SecurityInsightsClient client)
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider);
tracingParameters.Add("workspaceName", workspaceName);
tracingParameters.Add("dataConnectorId", dataConnectorId);
tracingParameters.Add("cancellationToken", cancellationToken);
@@ -376,9 +407,10 @@ internal DataConnectorsOperations(SecurityInsightsClient client)
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}").ToString();
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}").ToString();
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider));
_url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName));
_url = _url.Replace("{dataConnectorId}", System.Uri.EscapeDataString(dataConnectorId));
List _queryParameters = new List();
@@ -515,8 +547,11 @@ internal DataConnectorsOperations(SecurityInsightsClient client)
/// Creates or updates the data connector.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -548,17 +583,28 @@ internal DataConnectorsOperations(SecurityInsightsClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string dataConnectorId, DataConnector dataConnector, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string dataConnectorId, DataConnector dataConnector, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.ApiVersion != null)
+ {
+ if (Client.ApiVersion.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ }
+ }
if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
if (Client.SubscriptionId != null)
{
- if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"))
+ if (Client.SubscriptionId.Length < 1)
{
- throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$");
+ throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
}
}
if (resourceGroupName == null)
@@ -575,10 +621,10 @@ internal DataConnectorsOperations(SecurityInsightsClient client)
{
throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
}
- if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$"))
- {
- throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
- }
+ }
+ if (operationalInsightsResourceProvider == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider");
}
if (workspaceName == null)
{
@@ -611,6 +657,7 @@ internal DataConnectorsOperations(SecurityInsightsClient client)
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider);
tracingParameters.Add("workspaceName", workspaceName);
tracingParameters.Add("dataConnectorId", dataConnectorId);
tracingParameters.Add("dataConnector", dataConnector);
@@ -619,9 +666,10 @@ internal DataConnectorsOperations(SecurityInsightsClient client)
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}").ToString();
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}").ToString();
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider));
_url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName));
_url = _url.Replace("{dataConnectorId}", System.Uri.EscapeDataString(dataConnectorId));
List _queryParameters = new List();
@@ -782,8 +830,11 @@ internal DataConnectorsOperations(SecurityInsightsClient client)
/// Delete the data connector.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -809,17 +860,28 @@ internal DataConnectorsOperations(SecurityInsightsClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string dataConnectorId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string dataConnectorId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.ApiVersion != null)
+ {
+ if (Client.ApiVersion.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ }
+ }
if (Client.SubscriptionId == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
if (Client.SubscriptionId != null)
{
- if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"))
+ if (Client.SubscriptionId.Length < 1)
{
- throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$");
+ throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
}
}
if (resourceGroupName == null)
@@ -836,10 +898,10 @@ internal DataConnectorsOperations(SecurityInsightsClient client)
{
throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
}
- if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$"))
- {
- throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
- }
+ }
+ if (operationalInsightsResourceProvider == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider");
}
if (workspaceName == null)
{
@@ -868,6 +930,7 @@ internal DataConnectorsOperations(SecurityInsightsClient client)
_invocationId = ServiceClientTracing.NextInvocationId.ToString();
Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider);
tracingParameters.Add("workspaceName", workspaceName);
tracingParameters.Add("dataConnectorId", dataConnectorId);
tracingParameters.Add("cancellationToken", cancellationToken);
@@ -875,9 +938,10 @@ internal DataConnectorsOperations(SecurityInsightsClient client)
}
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
- var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}").ToString();
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}").ToString();
_url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider));
_url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName));
_url = _url.Replace("{dataConnectorId}", System.Uri.EscapeDataString(dataConnectorId));
List _queryParameters = new List();
@@ -992,6 +1056,470 @@ internal DataConnectorsOperations(SecurityInsightsClient client)
return _result;
}
+ ///
+ /// Connects a data connector.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// Connector ID
+ ///
+ ///
+ /// The data connector
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task ConnectWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string dataConnectorId, DataConnectorConnectBody connectBody, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.ApiVersion != null)
+ {
+ if (Client.ApiVersion.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ }
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (Client.SubscriptionId != null)
+ {
+ if (Client.SubscriptionId.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
+ }
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (resourceGroupName != null)
+ {
+ if (resourceGroupName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
+ }
+ if (resourceGroupName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
+ }
+ }
+ if (operationalInsightsResourceProvider == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider");
+ }
+ if (workspaceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName");
+ }
+ if (workspaceName != null)
+ {
+ if (workspaceName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90);
+ }
+ if (workspaceName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1);
+ }
+ }
+ if (dataConnectorId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "dataConnectorId");
+ }
+ if (connectBody == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "connectBody");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider);
+ tracingParameters.Add("workspaceName", workspaceName);
+ tracingParameters.Add("dataConnectorId", dataConnectorId);
+ tracingParameters.Add("connectBody", connectBody);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "Connect", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}/connect").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider));
+ _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName));
+ _url = _url.Replace("{dataConnectorId}", System.Uri.EscapeDataString(dataConnectorId));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("POST");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ if(connectBody != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(connectBody, Client.SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ }
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Disconnect a data connector.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// Connector ID
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task DisconnectWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string dataConnectorId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.ApiVersion != null)
+ {
+ if (Client.ApiVersion.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ }
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (Client.SubscriptionId != null)
+ {
+ if (Client.SubscriptionId.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
+ }
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (resourceGroupName != null)
+ {
+ if (resourceGroupName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
+ }
+ if (resourceGroupName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
+ }
+ }
+ if (operationalInsightsResourceProvider == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider");
+ }
+ if (workspaceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName");
+ }
+ if (workspaceName != null)
+ {
+ if (workspaceName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90);
+ }
+ if (workspaceName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1);
+ }
+ }
+ if (dataConnectorId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "dataConnectorId");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider);
+ tracingParameters.Add("workspaceName", workspaceName);
+ tracingParameters.Add("dataConnectorId", dataConnectorId);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "Disconnect", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/dataConnectors/{dataConnectorId}/disconnect").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider));
+ _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName));
+ _url = _url.Replace("{dataConnectorId}", System.Uri.EscapeDataString(dataConnectorId));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("POST");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
///
/// Gets all data connectors.
///
diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/DataConnectorsOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/DataConnectorsOperationsExtensions.cs
index 63790d1dae244..f910aada24f3c 100644
--- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/DataConnectorsOperationsExtensions.cs
+++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/DataConnectorsOperationsExtensions.cs
@@ -28,15 +28,18 @@ public static partial class DataConnectorsOperationsExtensions
/// The operations group for this extension method.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
///
- public static IPage List(this IDataConnectorsOperations operations, string resourceGroupName, string workspaceName)
+ public static IPage List(this IDataConnectorsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName)
{
- return operations.ListAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult();
+ return operations.ListAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName).GetAwaiter().GetResult();
}
///
@@ -46,8 +49,11 @@ public static IPage List(this IDataConnectorsOperations operation
/// The operations group for this extension method.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -55,9 +61,9 @@ public static IPage List(this IDataConnectorsOperations operation
///
/// The cancellation token.
///
- public static async Task> ListAsync(this IDataConnectorsOperations operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task> ListAsync(this IDataConnectorsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
@@ -70,8 +76,11 @@ public static IPage List(this IDataConnectorsOperations operation
/// The operations group for this extension method.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -79,9 +88,9 @@ public static IPage List(this IDataConnectorsOperations operation
///
/// Connector ID
///
- public static DataConnector Get(this IDataConnectorsOperations operations, string resourceGroupName, string workspaceName, string dataConnectorId)
+ public static DataConnector Get(this IDataConnectorsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string dataConnectorId)
{
- return operations.GetAsync(resourceGroupName, workspaceName, dataConnectorId).GetAwaiter().GetResult();
+ return operations.GetAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, dataConnectorId).GetAwaiter().GetResult();
}
///
@@ -91,8 +100,11 @@ public static DataConnector Get(this IDataConnectorsOperations operations, strin
/// The operations group for this extension method.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -103,9 +115,9 @@ public static DataConnector Get(this IDataConnectorsOperations operations, strin
///
/// The cancellation token.
///
- public static async Task GetAsync(this IDataConnectorsOperations operations, string resourceGroupName, string workspaceName, string dataConnectorId, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task GetAsync(this IDataConnectorsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string dataConnectorId, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, workspaceName, dataConnectorId, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, dataConnectorId, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
@@ -118,8 +130,11 @@ public static DataConnector Get(this IDataConnectorsOperations operations, strin
/// The operations group for this extension method.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -130,9 +145,9 @@ public static DataConnector Get(this IDataConnectorsOperations operations, strin
///
/// The data connector
///
- public static DataConnector CreateOrUpdate(this IDataConnectorsOperations operations, string resourceGroupName, string workspaceName, string dataConnectorId, DataConnector dataConnector)
+ public static DataConnector CreateOrUpdate(this IDataConnectorsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string dataConnectorId, DataConnector dataConnector)
{
- return operations.CreateOrUpdateAsync(resourceGroupName, workspaceName, dataConnectorId, dataConnector).GetAwaiter().GetResult();
+ return operations.CreateOrUpdateAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, dataConnectorId, dataConnector).GetAwaiter().GetResult();
}
///
@@ -142,8 +157,11 @@ public static DataConnector CreateOrUpdate(this IDataConnectorsOperations operat
/// The operations group for this extension method.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -157,9 +175,9 @@ public static DataConnector CreateOrUpdate(this IDataConnectorsOperations operat
///
/// The cancellation token.
///
- public static async Task CreateOrUpdateAsync(this IDataConnectorsOperations operations, string resourceGroupName, string workspaceName, string dataConnectorId, DataConnector dataConnector, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task CreateOrUpdateAsync(this IDataConnectorsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string dataConnectorId, DataConnector dataConnector, CancellationToken cancellationToken = default(CancellationToken))
{
- using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, dataConnectorId, dataConnector, null, cancellationToken).ConfigureAwait(false))
+ using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, dataConnectorId, dataConnector, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
@@ -172,8 +190,11 @@ public static DataConnector CreateOrUpdate(this IDataConnectorsOperations operat
/// The operations group for this extension method.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -181,9 +202,9 @@ public static DataConnector CreateOrUpdate(this IDataConnectorsOperations operat
///
/// Connector ID
///
- public static void Delete(this IDataConnectorsOperations operations, string resourceGroupName, string workspaceName, string dataConnectorId)
+ public static void Delete(this IDataConnectorsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string dataConnectorId)
{
- operations.DeleteAsync(resourceGroupName, workspaceName, dataConnectorId).GetAwaiter().GetResult();
+ operations.DeleteAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, dataConnectorId).GetAwaiter().GetResult();
}
///
@@ -193,8 +214,119 @@ public static void Delete(this IDataConnectorsOperations operations, string reso
/// The operations group for this extension method.
///
///
- /// The name of the resource group within the user's subscription. The name is
- /// case insensitive.
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// Connector ID
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task DeleteAsync(this IDataConnectorsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string dataConnectorId, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, dataConnectorId, null, cancellationToken).ConfigureAwait(false)).Dispose();
+ }
+
+ ///
+ /// Connects a data connector.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// Connector ID
+ ///
+ ///
+ /// The data connector
+ ///
+ public static void Connect(this IDataConnectorsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string dataConnectorId, DataConnectorConnectBody connectBody)
+ {
+ operations.ConnectAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, dataConnectorId, connectBody).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Connects a data connector.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// Connector ID
+ ///
+ ///
+ /// The data connector
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task ConnectAsync(this IDataConnectorsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string dataConnectorId, DataConnectorConnectBody connectBody, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ (await operations.ConnectWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, dataConnectorId, connectBody, null, cancellationToken).ConfigureAwait(false)).Dispose();
+ }
+
+ ///
+ /// Disconnect a data connector.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// Connector ID
+ ///
+ public static void Disconnect(this IDataConnectorsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string dataConnectorId)
+ {
+ operations.DisconnectAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, dataConnectorId).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Disconnect a data connector.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
///
///
/// The name of the workspace.
@@ -205,9 +337,9 @@ public static void Delete(this IDataConnectorsOperations operations, string reso
///
/// The cancellation token.
///
- public static async Task DeleteAsync(this IDataConnectorsOperations operations, string resourceGroupName, string workspaceName, string dataConnectorId, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task DisconnectAsync(this IDataConnectorsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string dataConnectorId, CancellationToken cancellationToken = default(CancellationToken))
{
- (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, dataConnectorId, null, cancellationToken).ConfigureAwait(false)).Dispose();
+ (await operations.DisconnectWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, dataConnectorId, null, cancellationToken).ConfigureAwait(false)).Dispose();
}
///
diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/DomainWhoisOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/DomainWhoisOperations.cs
new file mode 100644
index 0000000000000..4e8e6ef93d310
--- /dev/null
+++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/DomainWhoisOperations.cs
@@ -0,0 +1,278 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.SecurityInsights
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Net;
+ using System.Net.Http;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// DomainWhoisOperations operations.
+ ///
+ internal partial class DomainWhoisOperations : IServiceOperations, IDomainWhoisOperations
+ {
+ ///
+ /// Initializes a new instance of the DomainWhoisOperations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ internal DomainWhoisOperations(SecurityInsightsClient client)
+ {
+ if (client == null)
+ {
+ throw new System.ArgumentNullException("client");
+ }
+ Client = client;
+ }
+
+ ///
+ /// Gets a reference to the SecurityInsightsClient
+ ///
+ public SecurityInsightsClient Client { get; private set; }
+
+ ///
+ /// Get whois information for a single domain name
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// Domain name to be enriched
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string domain, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.ApiVersion != null)
+ {
+ if (Client.ApiVersion.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ }
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (Client.SubscriptionId != null)
+ {
+ if (Client.SubscriptionId.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
+ }
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (resourceGroupName != null)
+ {
+ if (resourceGroupName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
+ }
+ if (resourceGroupName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
+ }
+ }
+ if (domain == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "domain");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("domain", domain);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecurityInsights/enrichment/domain/whois/").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (domain != null)
+ {
+ _queryParameters.Add(string.Format("domain={0}", System.Uri.EscapeDataString(domain)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ }
+}
diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/DomainWhoisOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/DomainWhoisOperationsExtensions.cs
new file mode 100644
index 0000000000000..592a6ba7a9d10
--- /dev/null
+++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/DomainWhoisOperationsExtensions.cs
@@ -0,0 +1,65 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.SecurityInsights
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// Extension methods for DomainWhoisOperations.
+ ///
+ public static partial class DomainWhoisOperationsExtensions
+ {
+ ///
+ /// Get whois information for a single domain name
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// Domain name to be enriched
+ ///
+ public static EnrichmentDomainWhois Get(this IDomainWhoisOperations operations, string resourceGroupName, string domain)
+ {
+ return operations.GetAsync(resourceGroupName, domain).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Get whois information for a single domain name
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// Domain name to be enriched
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task GetAsync(this IDomainWhoisOperations operations, string resourceGroupName, string domain, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, domain, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ }
+}
diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntitiesGetTimelineOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntitiesGetTimelineOperations.cs
new file mode 100644
index 0000000000000..87d6cc3fd553f
--- /dev/null
+++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntitiesGetTimelineOperations.cs
@@ -0,0 +1,324 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.SecurityInsights
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Net;
+ using System.Net.Http;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// EntitiesGetTimelineOperations operations.
+ ///
+ internal partial class EntitiesGetTimelineOperations : IServiceOperations, IEntitiesGetTimelineOperations
+ {
+ ///
+ /// Initializes a new instance of the EntitiesGetTimelineOperations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ internal EntitiesGetTimelineOperations(SecurityInsightsClient client)
+ {
+ if (client == null)
+ {
+ throw new System.ArgumentNullException("client");
+ }
+ Client = client;
+ }
+
+ ///
+ /// Gets a reference to the SecurityInsightsClient
+ ///
+ public SecurityInsightsClient Client { get; private set; }
+
+ ///
+ /// Timeline for an entity.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// entity ID
+ ///
+ ///
+ /// The parameters required to execute an timeline operation on the given
+ /// entity.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityId, EntityTimelineParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.ApiVersion != null)
+ {
+ if (Client.ApiVersion.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ }
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (Client.SubscriptionId != null)
+ {
+ if (Client.SubscriptionId.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
+ }
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (resourceGroupName != null)
+ {
+ if (resourceGroupName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
+ }
+ if (resourceGroupName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
+ }
+ }
+ if (operationalInsightsResourceProvider == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider");
+ }
+ if (workspaceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName");
+ }
+ if (workspaceName != null)
+ {
+ if (workspaceName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90);
+ }
+ if (workspaceName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1);
+ }
+ }
+ if (entityId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "entityId");
+ }
+ if (parameters == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
+ }
+ if (parameters != null)
+ {
+ parameters.Validate();
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider);
+ tracingParameters.Add("workspaceName", workspaceName);
+ tracingParameters.Add("entityId", entityId);
+ tracingParameters.Add("parameters", parameters);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/getTimeline").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider));
+ _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName));
+ _url = _url.Replace("{entityId}", System.Uri.EscapeDataString(entityId));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("POST");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ if(parameters != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ }
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ }
+}
diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntitiesGetTimelineOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntitiesGetTimelineOperationsExtensions.cs
new file mode 100644
index 0000000000000..53684433da339
--- /dev/null
+++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntitiesGetTimelineOperationsExtensions.cs
@@ -0,0 +1,87 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.SecurityInsights
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// Extension methods for EntitiesGetTimelineOperations.
+ ///
+ public static partial class EntitiesGetTimelineOperationsExtensions
+ {
+ ///
+ /// Timeline for an entity.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// entity ID
+ ///
+ ///
+ /// The parameters required to execute an timeline operation on the given
+ /// entity.
+ ///
+ public static EntityTimelineResponse List(this IEntitiesGetTimelineOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityId, EntityTimelineParameters parameters)
+ {
+ return operations.ListAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, entityId, parameters).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Timeline for an entity.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// entity ID
+ ///
+ ///
+ /// The parameters required to execute an timeline operation on the given
+ /// entity.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task ListAsync(this IEntitiesGetTimelineOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityId, EntityTimelineParameters parameters, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, entityId, parameters, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ }
+}
diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntitiesOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntitiesOperations.cs
new file mode 100644
index 0000000000000..41ae2b8aa90c8
--- /dev/null
+++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntitiesOperations.cs
@@ -0,0 +1,1511 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.SecurityInsights
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Net;
+ using System.Net.Http;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// EntitiesOperations operations.
+ ///
+ internal partial class EntitiesOperations : IServiceOperations, IEntitiesOperations
+ {
+ ///
+ /// Initializes a new instance of the EntitiesOperations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ internal EntitiesOperations(SecurityInsightsClient client)
+ {
+ if (client == null)
+ {
+ throw new System.ArgumentNullException("client");
+ }
+ Client = client;
+ }
+
+ ///
+ /// Gets a reference to the SecurityInsightsClient
+ ///
+ public SecurityInsightsClient Client { get; private set; }
+
+ ///
+ /// Gets all entities.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.ApiVersion != null)
+ {
+ if (Client.ApiVersion.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ }
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (Client.SubscriptionId != null)
+ {
+ if (Client.SubscriptionId.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
+ }
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (resourceGroupName != null)
+ {
+ if (resourceGroupName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
+ }
+ if (resourceGroupName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
+ }
+ }
+ if (operationalInsightsResourceProvider == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider");
+ }
+ if (workspaceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName");
+ }
+ if (workspaceName != null)
+ {
+ if (workspaceName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90);
+ }
+ if (workspaceName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1);
+ }
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider);
+ tracingParameters.Add("workspaceName", workspaceName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider));
+ _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Gets an entity.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// entity ID
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.ApiVersion != null)
+ {
+ if (Client.ApiVersion.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ }
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (Client.SubscriptionId != null)
+ {
+ if (Client.SubscriptionId.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
+ }
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (resourceGroupName != null)
+ {
+ if (resourceGroupName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
+ }
+ if (resourceGroupName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
+ }
+ }
+ if (operationalInsightsResourceProvider == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider");
+ }
+ if (workspaceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName");
+ }
+ if (workspaceName != null)
+ {
+ if (workspaceName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90);
+ }
+ if (workspaceName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1);
+ }
+ }
+ if (entityId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "entityId");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider);
+ tracingParameters.Add("workspaceName", workspaceName);
+ tracingParameters.Add("entityId", entityId);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider));
+ _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName));
+ _url = _url.Replace("{entityId}", System.Uri.EscapeDataString(entityId));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Expands an entity.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// entity ID
+ ///
+ ///
+ /// The parameters required to execute an expand operation on the given entity.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> ExpandWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityId, EntityExpandParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.ApiVersion != null)
+ {
+ if (Client.ApiVersion.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ }
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (Client.SubscriptionId != null)
+ {
+ if (Client.SubscriptionId.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
+ }
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (resourceGroupName != null)
+ {
+ if (resourceGroupName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
+ }
+ if (resourceGroupName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
+ }
+ }
+ if (operationalInsightsResourceProvider == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider");
+ }
+ if (workspaceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName");
+ }
+ if (workspaceName != null)
+ {
+ if (workspaceName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90);
+ }
+ if (workspaceName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1);
+ }
+ }
+ if (entityId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "entityId");
+ }
+ if (parameters == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider);
+ tracingParameters.Add("workspaceName", workspaceName);
+ tracingParameters.Add("entityId", entityId);
+ tracingParameters.Add("parameters", parameters);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "Expand", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/expand").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider));
+ _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName));
+ _url = _url.Replace("{entityId}", System.Uri.EscapeDataString(entityId));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("POST");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ if(parameters != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ }
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Get Insights and Activities for an entity.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// entity ID
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> QueriesWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.ApiVersion != null)
+ {
+ if (Client.ApiVersion.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ }
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (Client.SubscriptionId != null)
+ {
+ if (Client.SubscriptionId.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
+ }
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (resourceGroupName != null)
+ {
+ if (resourceGroupName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
+ }
+ if (resourceGroupName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
+ }
+ }
+ if (operationalInsightsResourceProvider == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider");
+ }
+ if (workspaceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName");
+ }
+ if (workspaceName != null)
+ {
+ if (workspaceName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90);
+ }
+ if (workspaceName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1);
+ }
+ }
+ if (entityId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "entityId");
+ }
+ string kind = "Insight";
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider);
+ tracingParameters.Add("workspaceName", workspaceName);
+ tracingParameters.Add("entityId", entityId);
+ tracingParameters.Add("kind", kind);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "Queries", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/queries").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider));
+ _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName));
+ _url = _url.Replace("{entityId}", System.Uri.EscapeDataString(entityId));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (kind != null)
+ {
+ _queryParameters.Add(string.Format("kind={0}", System.Uri.EscapeDataString(kind)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Execute Insights for an entity.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// entity ID
+ ///
+ ///
+ /// The parameters required to execute insights on the given entity.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> GetInsightsWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityId, EntityGetInsightsParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.ApiVersion != null)
+ {
+ if (Client.ApiVersion.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ }
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (Client.SubscriptionId != null)
+ {
+ if (Client.SubscriptionId.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
+ }
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (resourceGroupName != null)
+ {
+ if (resourceGroupName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
+ }
+ if (resourceGroupName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
+ }
+ }
+ if (operationalInsightsResourceProvider == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider");
+ }
+ if (workspaceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName");
+ }
+ if (workspaceName != null)
+ {
+ if (workspaceName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90);
+ }
+ if (workspaceName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1);
+ }
+ }
+ if (entityId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "entityId");
+ }
+ if (parameters == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
+ }
+ if (parameters != null)
+ {
+ parameters.Validate();
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider);
+ tracingParameters.Add("workspaceName", workspaceName);
+ tracingParameters.Add("entityId", entityId);
+ tracingParameters.Add("parameters", parameters);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "GetInsights", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/getInsights").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider));
+ _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName));
+ _url = _url.Replace("{entityId}", System.Uri.EscapeDataString(entityId));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("POST");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ if(parameters != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ }
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Gets all entities.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (nextPageLink == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("nextPageLink", nextPageLink);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters);
+ }
+ // Construct URL
+ string _url = "{nextLink}";
+ _url = _url.Replace("{nextLink}", nextPageLink);
+ List _queryParameters = new List();
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ }
+}
diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntitiesOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntitiesOperationsExtensions.cs
new file mode 100644
index 0000000000000..d001301d087bd
--- /dev/null
+++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntitiesOperationsExtensions.cs
@@ -0,0 +1,335 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.SecurityInsights
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// Extension methods for EntitiesOperations.
+ ///
+ public static partial class EntitiesOperationsExtensions
+ {
+ ///
+ /// Gets all entities.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ public static IPage List(this IEntitiesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName)
+ {
+ return operations.ListAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Gets all entities.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task> ListAsync(this IEntitiesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Gets an entity.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// entity ID
+ ///
+ public static Entity Get(this IEntitiesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityId)
+ {
+ return operations.GetAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, entityId).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Gets an entity.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// entity ID
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task GetAsync(this IEntitiesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityId, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, entityId, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Expands an entity.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// entity ID
+ ///
+ ///
+ /// The parameters required to execute an expand operation on the given entity.
+ ///
+ public static EntityExpandResponse Expand(this IEntitiesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityId, EntityExpandParameters parameters)
+ {
+ return operations.ExpandAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, entityId, parameters).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Expands an entity.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// entity ID
+ ///
+ ///
+ /// The parameters required to execute an expand operation on the given entity.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task ExpandAsync(this IEntitiesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityId, EntityExpandParameters parameters, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ExpandWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, entityId, parameters, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Get Insights and Activities for an entity.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// entity ID
+ ///
+ public static GetQueriesResponse Queries(this IEntitiesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityId)
+ {
+ return operations.QueriesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, entityId).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Get Insights and Activities for an entity.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// entity ID
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task QueriesAsync(this IEntitiesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityId, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.QueriesWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, entityId, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Execute Insights for an entity.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// entity ID
+ ///
+ ///
+ /// The parameters required to execute insights on the given entity.
+ ///
+ public static EntityGetInsightsResponse GetInsights(this IEntitiesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityId, EntityGetInsightsParameters parameters)
+ {
+ return operations.GetInsightsAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, entityId, parameters).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Execute Insights for an entity.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// entity ID
+ ///
+ ///
+ /// The parameters required to execute insights on the given entity.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task GetInsightsAsync(this IEntitiesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityId, EntityGetInsightsParameters parameters, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.GetInsightsWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, entityId, parameters, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Gets all entities.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ public static IPage ListNext(this IEntitiesOperations operations, string nextPageLink)
+ {
+ return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Gets all entities.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task> ListNextAsync(this IEntitiesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ }
+}
diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntitiesRelationsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntitiesRelationsOperations.cs
new file mode 100644
index 0000000000000..b7955f9d22627
--- /dev/null
+++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntitiesRelationsOperations.cs
@@ -0,0 +1,502 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.SecurityInsights
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Microsoft.Rest.Azure.OData;
+ using Models;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Net;
+ using System.Net.Http;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// EntitiesRelationsOperations operations.
+ ///
+ internal partial class EntitiesRelationsOperations : IServiceOperations, IEntitiesRelationsOperations
+ {
+ ///
+ /// Initializes a new instance of the EntitiesRelationsOperations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ internal EntitiesRelationsOperations(SecurityInsightsClient client)
+ {
+ if (client == null)
+ {
+ throw new System.ArgumentNullException("client");
+ }
+ Client = client;
+ }
+
+ ///
+ /// Gets a reference to the SecurityInsightsClient
+ ///
+ public SecurityInsightsClient Client { get; private set; }
+
+ ///
+ /// Gets all relations of an entity.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// entity ID
+ ///
+ ///
+ /// OData parameters to apply to the operation.
+ ///
+ ///
+ /// Skiptoken is only used if a previous operation returned a partial result.
+ /// If a previous response contains a nextLink element, the value of the
+ /// nextLink element will include a skiptoken parameter that specifies a
+ /// starting point to use for subsequent calls. Optional.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityId, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.ApiVersion != null)
+ {
+ if (Client.ApiVersion.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ }
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (Client.SubscriptionId != null)
+ {
+ if (Client.SubscriptionId.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
+ }
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (resourceGroupName != null)
+ {
+ if (resourceGroupName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
+ }
+ if (resourceGroupName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
+ }
+ }
+ if (operationalInsightsResourceProvider == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider");
+ }
+ if (workspaceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName");
+ }
+ if (workspaceName != null)
+ {
+ if (workspaceName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90);
+ }
+ if (workspaceName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1);
+ }
+ }
+ if (entityId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "entityId");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("odataQuery", odataQuery);
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider);
+ tracingParameters.Add("workspaceName", workspaceName);
+ tracingParameters.Add("entityId", entityId);
+ tracingParameters.Add("skipToken", skipToken);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entities/{entityId}/relations").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider));
+ _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName));
+ _url = _url.Replace("{entityId}", System.Uri.EscapeDataString(entityId));
+ List _queryParameters = new List();
+ if (odataQuery != null)
+ {
+ var _odataFilter = odataQuery.ToString();
+ if (!string.IsNullOrEmpty(_odataFilter))
+ {
+ _queryParameters.Add(_odataFilter);
+ }
+ }
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (skipToken != null)
+ {
+ _queryParameters.Add(string.Format("$skipToken={0}", System.Uri.EscapeDataString(skipToken)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Gets all relations of an entity.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (nextPageLink == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("nextPageLink", nextPageLink);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters);
+ }
+ // Construct URL
+ string _url = "{nextLink}";
+ _url = _url.Replace("{nextLink}", nextPageLink);
+ List _queryParameters = new List();
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ }
+}
diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntitiesRelationsOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntitiesRelationsOperationsExtensions.cs
new file mode 100644
index 0000000000000..6428a6f7e0ff9
--- /dev/null
+++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntitiesRelationsOperationsExtensions.cs
@@ -0,0 +1,132 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.SecurityInsights
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Microsoft.Rest.Azure.OData;
+ using Models;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// Extension methods for EntitiesRelationsOperations.
+ ///
+ public static partial class EntitiesRelationsOperationsExtensions
+ {
+ ///
+ /// Gets all relations of an entity.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// entity ID
+ ///
+ ///
+ /// OData parameters to apply to the operation.
+ ///
+ ///
+ /// Skiptoken is only used if a previous operation returned a partial result.
+ /// If a previous response contains a nextLink element, the value of the
+ /// nextLink element will include a skiptoken parameter that specifies a
+ /// starting point to use for subsequent calls. Optional.
+ ///
+ public static IPage List(this IEntitiesRelationsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityId, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string))
+ {
+ return operations.ListAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, entityId, odataQuery, skipToken).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Gets all relations of an entity.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// entity ID
+ ///
+ ///
+ /// OData parameters to apply to the operation.
+ ///
+ ///
+ /// Skiptoken is only used if a previous operation returned a partial result.
+ /// If a previous response contains a nextLink element, the value of the
+ /// nextLink element will include a skiptoken parameter that specifies a
+ /// starting point to use for subsequent calls. Optional.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task> ListAsync(this IEntitiesRelationsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityId, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, entityId, odataQuery, skipToken, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ ///
+ /// Gets all relations of an entity.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ public static IPage ListNext(this IEntitiesRelationsOperations operations, string nextPageLink)
+ {
+ return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Gets all relations of an entity.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The NextLink from the previous successful call to List operation.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task> ListNextAsync(this IEntitiesRelationsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ }
+}
diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntityQueriesOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntityQueriesOperations.cs
new file mode 100644
index 0000000000000..00ddede367c30
--- /dev/null
+++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntityQueriesOperations.cs
@@ -0,0 +1,1242 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.SecurityInsights
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Net;
+ using System.Net.Http;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// EntityQueriesOperations operations.
+ ///
+ internal partial class EntityQueriesOperations : IServiceOperations, IEntityQueriesOperations
+ {
+ ///
+ /// Initializes a new instance of the EntityQueriesOperations class.
+ ///
+ ///
+ /// Reference to the service client.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ internal EntityQueriesOperations(SecurityInsightsClient client)
+ {
+ if (client == null)
+ {
+ throw new System.ArgumentNullException("client");
+ }
+ Client = client;
+ }
+
+ ///
+ /// Gets a reference to the SecurityInsightsClient
+ ///
+ public SecurityInsightsClient Client { get; private set; }
+
+ ///
+ /// Gets all entity queries.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// The entity query kind we want to fetch. Possible values include:
+ /// 'Expansion', 'Activity'
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string kind = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.ApiVersion != null)
+ {
+ if (Client.ApiVersion.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ }
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (Client.SubscriptionId != null)
+ {
+ if (Client.SubscriptionId.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
+ }
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (resourceGroupName != null)
+ {
+ if (resourceGroupName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
+ }
+ if (resourceGroupName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
+ }
+ }
+ if (operationalInsightsResourceProvider == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider");
+ }
+ if (workspaceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName");
+ }
+ if (workspaceName != null)
+ {
+ if (workspaceName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90);
+ }
+ if (workspaceName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1);
+ }
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("kind", kind);
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider);
+ tracingParameters.Add("workspaceName", workspaceName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueries").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider));
+ _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName));
+ List _queryParameters = new List();
+ if (kind != null)
+ {
+ _queryParameters.Add(string.Format("kind={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(kind, Client.SerializationSettings).Trim('"'))));
+ }
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Gets an entity query.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// entity query ID
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityQueryId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.ApiVersion != null)
+ {
+ if (Client.ApiVersion.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ }
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (Client.SubscriptionId != null)
+ {
+ if (Client.SubscriptionId.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
+ }
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (resourceGroupName != null)
+ {
+ if (resourceGroupName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
+ }
+ if (resourceGroupName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
+ }
+ }
+ if (operationalInsightsResourceProvider == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider");
+ }
+ if (workspaceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName");
+ }
+ if (workspaceName != null)
+ {
+ if (workspaceName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90);
+ }
+ if (workspaceName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1);
+ }
+ }
+ if (entityQueryId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "entityQueryId");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider);
+ tracingParameters.Add("workspaceName", workspaceName);
+ tracingParameters.Add("entityQueryId", entityQueryId);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueries/{entityQueryId}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider));
+ _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName));
+ _url = _url.Replace("{entityQueryId}", System.Uri.EscapeDataString(entityQueryId));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Creates or updates the entity query.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// entity query ID
+ ///
+ ///
+ /// The entity query we want to create or update
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityQueryId, CustomEntityQuery entityQuery, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.ApiVersion != null)
+ {
+ if (Client.ApiVersion.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ }
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (Client.SubscriptionId != null)
+ {
+ if (Client.SubscriptionId.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
+ }
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (resourceGroupName != null)
+ {
+ if (resourceGroupName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
+ }
+ if (resourceGroupName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
+ }
+ }
+ if (operationalInsightsResourceProvider == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider");
+ }
+ if (workspaceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName");
+ }
+ if (workspaceName != null)
+ {
+ if (workspaceName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90);
+ }
+ if (workspaceName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1);
+ }
+ }
+ if (entityQueryId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "entityQueryId");
+ }
+ if (entityQuery == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "entityQuery");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider);
+ tracingParameters.Add("workspaceName", workspaceName);
+ tracingParameters.Add("entityQueryId", entityQueryId);
+ tracingParameters.Add("entityQuery", entityQuery);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/entityQueries/{entityQueryId}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{operationalInsightsResourceProvider}", System.Uri.EscapeDataString(operationalInsightsResourceProvider));
+ _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName));
+ _url = _url.Replace("{entityQueryId}", System.Uri.EscapeDataString(entityQueryId));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("PUT");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ if(entityQuery != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(entityQuery, Client.SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ }
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200 && (int)_statusCode != 201)
+ {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 201)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Delete the entity query.
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// The namespace of workspaces resource provider-
+ /// Microsoft.OperationalInsights.
+ ///
+ ///
+ /// The name of the workspace.
+ ///
+ ///
+ /// entity query ID
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityQueryId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.ApiVersion != null)
+ {
+ if (Client.ApiVersion.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ }
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (Client.SubscriptionId != null)
+ {
+ if (Client.SubscriptionId.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
+ }
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (resourceGroupName != null)
+ {
+ if (resourceGroupName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
+ }
+ if (resourceGroupName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
+ }
+ }
+ if (operationalInsightsResourceProvider == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "operationalInsightsResourceProvider");
+ }
+ if (workspaceName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName");
+ }
+ if (workspaceName != null)
+ {
+ if (workspaceName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 90);
+ }
+ if (workspaceName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1);
+ }
+ }
+ if (entityQueryId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "entityQueryId");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary