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(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("entityQueryId", entityQueryId); + 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/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("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 entity queries. + /// + /// + /// 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/EntityQueriesOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntityQueriesOperationsExtensions.cs new file mode 100644 index 0000000000000..84a2a3c36eaed --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntityQueriesOperationsExtensions.cs @@ -0,0 +1,280 @@ +// +// 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 EntityQueriesOperations. + /// + public static partial class EntityQueriesOperationsExtensions + { + /// + /// Gets all entity queries. + /// + /// + /// 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 entity query kind we want to fetch. Possible values include: + /// 'Expansion', 'Activity' + /// + public static IPage List(this IEntityQueriesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string kind = default(string)) + { + return operations.ListAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, kind).GetAwaiter().GetResult(); + } + + /// + /// Gets all entity queries. + /// + /// + /// 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 entity query kind we want to fetch. Possible values include: + /// 'Expansion', 'Activity' + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IEntityQueriesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string kind = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, kind, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets an entity query. + /// + /// + /// 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 query ID + /// + public static EntityQuery Get(this IEntityQueriesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityQueryId) + { + return operations.GetAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, entityQueryId).GetAwaiter().GetResult(); + } + + /// + /// Gets an entity query. + /// + /// + /// 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 query ID + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IEntityQueriesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityQueryId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, entityQueryId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates the entity query. + /// + /// + /// 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 query ID + /// + /// + /// The entity query we want to create or update + /// + public static EntityQuery CreateOrUpdate(this IEntityQueriesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityQueryId, CustomEntityQuery entityQuery) + { + return operations.CreateOrUpdateAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, entityQueryId, entityQuery).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates the entity query. + /// + /// + /// 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 query ID + /// + /// + /// The entity query we want to create or update + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IEntityQueriesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityQueryId, CustomEntityQuery entityQuery, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, entityQueryId, entityQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete the entity query. + /// + /// + /// 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 query ID + /// + public static void Delete(this IEntityQueriesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityQueryId) + { + operations.DeleteAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, entityQueryId).GetAwaiter().GetResult(); + } + + /// + /// Delete the entity query. + /// + /// + /// 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 query ID + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IEntityQueriesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityQueryId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, entityQueryId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets all entity queries. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IEntityQueriesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all entity queries. + /// + /// + /// 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 IEntityQueriesOperations 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/EntityQueryTemplatesOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntityQueryTemplatesOperations.cs new file mode 100644 index 0000000000000..84d365bfc3c26 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntityQueryTemplatesOperations.cs @@ -0,0 +1,729 @@ +// +// 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; + + /// + /// EntityQueryTemplatesOperations operations. + /// + internal partial class EntityQueryTemplatesOperations : IServiceOperations, IEntityQueryTemplatesOperations + { + /// + /// Initializes a new instance of the EntityQueryTemplatesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal EntityQueryTemplatesOperations(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 query templates. + /// + /// + /// 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 template query kind we want to fetch. Possible values include: + /// '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/entityQueryTemplates").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 template 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 entityQueryTemplateId, 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 (entityQueryTemplateId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "entityQueryTemplateId"); + } + // 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("entityQueryTemplateId", entityQueryTemplateId); + 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/entityQueryTemplates/{entityQueryTemplateId}").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("{entityQueryTemplateId}", System.Uri.EscapeDataString(entityQueryTemplateId)); + 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 all entity query templates. + /// + /// + /// 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/EntityQueryTemplatesOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntityQueryTemplatesOperationsExtensions.cs new file mode 100644 index 0000000000000..2e8157e8b587b --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntityQueryTemplatesOperationsExtensions.cs @@ -0,0 +1,169 @@ +// +// 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 EntityQueryTemplatesOperations. + /// + public static partial class EntityQueryTemplatesOperationsExtensions + { + /// + /// Gets all entity query templates. + /// + /// + /// 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 entity template query kind we want to fetch. Possible values include: + /// 'Activity' + /// + public static IPage List(this IEntityQueryTemplatesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string kind = default(string)) + { + return operations.ListAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, kind).GetAwaiter().GetResult(); + } + + /// + /// Gets all entity query templates. + /// + /// + /// 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 entity template query kind we want to fetch. Possible values include: + /// 'Activity' + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IEntityQueryTemplatesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string kind = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, kind, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets an entity query. + /// + /// + /// 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 query template ID + /// + public static EntityQueryTemplate Get(this IEntityQueryTemplatesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityQueryTemplateId) + { + return operations.GetAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, entityQueryTemplateId).GetAwaiter().GetResult(); + } + + /// + /// Gets an entity query. + /// + /// + /// 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 query template ID + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IEntityQueryTemplatesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityQueryTemplateId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, entityQueryTemplateId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all entity query templates. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IEntityQueryTemplatesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all entity query templates. + /// + /// + /// 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 IEntityQueryTemplatesOperations 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/EntityRelationsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntityRelationsOperations.cs new file mode 100644 index 0000000000000..abc844b903acb --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntityRelationsOperations.cs @@ -0,0 +1,314 @@ +// +// 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; + + /// + /// EntityRelationsOperations operations. + /// + internal partial class EntityRelationsOperations : IServiceOperations, IEntityRelationsOperations + { + /// + /// Initializes a new instance of the EntityRelationsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal EntityRelationsOperations(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 an entity 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. + /// + /// + /// entity 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> GetRelationWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityId, 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 (entityId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "entityId"); + } + 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("entityId", entityId); + tracingParameters.Add("relationName", relationName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetRelation", 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/{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("{entityId}", System.Uri.EscapeDataString(entityId)); + _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; + } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntityRelationsOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntityRelationsOperationsExtensions.cs new file mode 100644 index 0000000000000..1ec5dacf5fe27 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/EntityRelationsOperationsExtensions.cs @@ -0,0 +1,85 @@ +// +// 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 EntityRelationsOperations. + /// + public static partial class EntityRelationsOperationsExtensions + { + /// + /// Gets an entity 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. + /// + /// + /// entity ID + /// + /// + /// Relation Name + /// + public static Relation GetRelation(this IEntityRelationsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityId, string relationName) + { + return operations.GetRelationAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, entityId, relationName).GetAwaiter().GetResult(); + } + + /// + /// Gets an entity 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. + /// + /// + /// entity ID + /// + /// + /// Relation Name + /// + /// + /// The cancellation token. + /// + public static async Task GetRelationAsync(this IEntityRelationsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityId, string relationName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetRelationWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, entityId, relationName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IActionsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IActionsOperations.cs index f42d11eaf67f9..20d8b62f35be9 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IActionsOperations.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IActionsOperations.cs @@ -27,8 +27,11 @@ public partial interface IActionsOperations /// 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. @@ -51,13 +54,16 @@ public partial interface IActionsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByAlertRuleWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string ruleId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByAlertRuleWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// 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. @@ -83,13 +89,16 @@ public partial interface IActionsOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string ruleId, string actionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, string actionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// 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. @@ -118,13 +127,16 @@ public partial interface IActionsOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string ruleId, string actionId, ActionRequest action, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, string actionId, ActionRequest action, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// 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. @@ -147,7 +159,7 @@ public partial interface IActionsOperations /// /// Thrown when a required parameter is null /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string ruleId, string actionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, string actionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets all actions of alert rule. /// diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IAlertRuleTemplatesOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IAlertRuleTemplatesOperations.cs index 0ad2eb676cff9..c459029b59c8d 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IAlertRuleTemplatesOperations.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IAlertRuleTemplatesOperations.cs @@ -27,8 +27,11 @@ public partial interface IAlertRuleTemplatesOperations /// 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. @@ -48,13 +51,16 @@ public partial interface IAlertRuleTemplatesOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// 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. @@ -77,7 +83,7 @@ public partial interface IAlertRuleTemplatesOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string alertRuleTemplateId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string alertRuleTemplateId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets all alert rule templates. /// diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IAlertRulesOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IAlertRulesOperations.cs index cf07ca8d976fa..470a77d2d9339 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IAlertRulesOperations.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IAlertRulesOperations.cs @@ -27,8 +27,11 @@ public partial interface IAlertRulesOperations /// 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. @@ -48,13 +51,16 @@ public partial interface IAlertRulesOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// 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. @@ -77,13 +83,16 @@ public partial interface IAlertRulesOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string ruleId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// 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. @@ -109,13 +118,16 @@ public partial interface IAlertRulesOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string ruleId, AlertRule alertRule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, AlertRule alertRule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// 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. @@ -135,7 +147,7 @@ public partial interface IAlertRulesOperations /// /// Thrown when a required parameter is null /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string ruleId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string ruleId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets all alert rules. /// diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IAutomationRulesOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IAutomationRulesOperations.cs new file mode 100644 index 0000000000000..b6c3160e851af --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IAutomationRulesOperations.cs @@ -0,0 +1,174 @@ +// +// 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.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// AutomationRulesOperations operations. + /// + public partial interface IAutomationRulesOperations + { + /// + /// 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. + /// + /// + /// The 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 + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 + /// + /// + /// The 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 + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string automationRuleId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 + /// + /// + /// The 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 + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string automationRuleId, AutomationRule automationRule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 + /// + /// + /// The 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 + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string automationRuleId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all automation rules. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The 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 + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IBookmarkOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IBookmarkOperations.cs new file mode 100644 index 0000000000000..1147b703b5f45 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IBookmarkOperations.cs @@ -0,0 +1,63 @@ +// +// 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.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// BookmarkOperations operations. + /// + public partial interface IBookmarkOperations + { + /// + /// 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. + /// + /// + /// The 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 + /// + Task> ExpandWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, BookmarkExpandParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IBookmarkRelationsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IBookmarkRelationsOperations.cs new file mode 100644 index 0000000000000..1623041c025cc --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IBookmarkRelationsOperations.cs @@ -0,0 +1,200 @@ +// +// 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.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// BookmarkRelationsOperations operations. + /// + public partial interface IBookmarkRelationsOperations + { + /// + /// 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. + /// + /// + /// The 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 + /// + 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)); + /// + /// 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 + /// + /// + /// The 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 + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, string relationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 + /// + /// + /// The 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 + /// + 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)); + /// + /// 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 + /// + /// + /// The 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 + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, string relationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all bookmark relations. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The 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 + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IBookmarksOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IBookmarksOperations.cs index 13d1d9379a05e..cb7f86313ccd0 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IBookmarksOperations.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IBookmarksOperations.cs @@ -27,8 +27,11 @@ public partial interface IBookmarksOperations /// 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. @@ -48,13 +51,16 @@ public partial interface IBookmarksOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// 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. @@ -77,13 +83,16 @@ public partial interface IBookmarksOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string bookmarkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// 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. @@ -109,13 +118,16 @@ public partial interface IBookmarksOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string bookmarkId, Bookmark bookmark, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, Bookmark bookmark, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// 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. @@ -135,7 +147,7 @@ public partial interface IBookmarksOperations /// /// Thrown when a required parameter is null /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string bookmarkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string bookmarkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets all bookmarks. /// diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IDataConnectorsCheckRequirementsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IDataConnectorsCheckRequirementsOperations.cs new file mode 100644 index 0000000000000..9573b908da44d --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IDataConnectorsCheckRequirementsOperations.cs @@ -0,0 +1,59 @@ +// +// 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.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DataConnectorsCheckRequirementsOperations operations. + /// + public partial interface IDataConnectorsCheckRequirementsOperations + { + /// + /// 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 + /// + /// + /// The 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 + /// + Task> PostWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, DataConnectorsCheckRequirements dataConnectorsCheckRequirements, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IDataConnectorsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IDataConnectorsOperations.cs index 22ae7053616e8..575dc9f928354 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IDataConnectorsOperations.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IDataConnectorsOperations.cs @@ -27,8 +27,11 @@ public partial interface IDataConnectorsOperations /// 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. @@ -48,13 +51,16 @@ public partial interface IDataConnectorsOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// 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. @@ -77,13 +83,16 @@ public partial interface IDataConnectorsOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string dataConnectorId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string dataConnectorId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// 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. @@ -109,13 +118,16 @@ public partial interface IDataConnectorsOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string dataConnectorId, DataConnector dataConnector, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string dataConnectorId, DataConnector dataConnector, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// 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. @@ -135,7 +147,68 @@ public partial interface IDataConnectorsOperations /// /// Thrown when a required parameter is null /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string dataConnectorId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string dataConnectorId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 + /// + /// + /// The 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 + /// + Task ConnectWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string dataConnectorId, DataConnectorConnectBody connectBody, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 + /// + /// + /// The 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 + /// + Task DisconnectWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string dataConnectorId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets all data connectors. /// diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IDomainWhoisOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IDomainWhoisOperations.cs new file mode 100644 index 0000000000000..973e79f84f89a --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IDomainWhoisOperations.cs @@ -0,0 +1,52 @@ +// +// 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.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DomainWhoisOperations operations. + /// + public partial interface IDomainWhoisOperations + { + /// + /// Get whois information for a single domain name + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Domain name to be enriched + /// + /// + /// The 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 + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string domain, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IEntitiesGetTimelineOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IEntitiesGetTimelineOperations.cs new file mode 100644 index 0000000000000..3bb3ffe8e6a36 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IEntitiesGetTimelineOperations.cs @@ -0,0 +1,63 @@ +// +// 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.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// EntitiesGetTimelineOperations operations. + /// + public partial interface IEntitiesGetTimelineOperations + { + /// + /// 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. + /// + /// + /// The 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 + /// + Task> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityId, EntityTimelineParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IEntitiesOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IEntitiesOperations.cs new file mode 100644 index 0000000000000..cef2297bee41f --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IEntitiesOperations.cs @@ -0,0 +1,213 @@ +// +// 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.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// EntitiesOperations operations. + /// + public partial interface IEntitiesOperations + { + /// + /// 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. + /// + /// + /// The 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 + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 + /// + /// + /// The 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 + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// The 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 + /// + Task> ExpandWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityId, EntityExpandParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 + /// + /// + /// The 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 + /// + Task> QueriesWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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. + /// + /// + /// The 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 + /// + Task> GetInsightsWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityId, EntityGetInsightsParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all entities. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The 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 + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IEntitiesRelationsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IEntitiesRelationsOperations.cs new file mode 100644 index 0000000000000..62e3262744f99 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IEntitiesRelationsOperations.cs @@ -0,0 +1,92 @@ +// +// 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.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// EntitiesRelationsOperations operations. + /// + public partial interface IEntitiesRelationsOperations + { + /// + /// 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. + /// + /// + /// The 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 + /// + 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)); + /// + /// Gets all relations of an entity. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The 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 + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IEntityQueriesOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IEntityQueriesOperations.cs new file mode 100644 index 0000000000000..e894a907b698f --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IEntityQueriesOperations.cs @@ -0,0 +1,178 @@ +// +// 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.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// EntityQueriesOperations operations. + /// + public partial interface IEntityQueriesOperations + { + /// + /// 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' + /// + /// + /// The 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 + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string kind = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 + /// + /// + /// The 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 + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityQueryId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 + /// + /// + /// The 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 + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityQueryId, CustomEntityQuery entityQuery, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 + /// + /// + /// The 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 + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityQueryId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all entity queries. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The 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 + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IEntityQueryTemplatesOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IEntityQueryTemplatesOperations.cs new file mode 100644 index 0000000000000..d40f0218b4d30 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IEntityQueryTemplatesOperations.cs @@ -0,0 +1,114 @@ +// +// 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.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// EntityQueryTemplatesOperations operations. + /// + public partial interface IEntityQueryTemplatesOperations + { + /// + /// Gets all entity query templates. + /// + /// + /// 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 template query kind we want to fetch. Possible values + /// include: 'Activity' + /// + /// + /// The 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 + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string kind = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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 template ID + /// + /// + /// The 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 + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityQueryTemplateId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all entity query templates. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The 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 + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IEntityRelationsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IEntityRelationsOperations.cs new file mode 100644 index 0000000000000..759e1d944a506 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IEntityRelationsOperations.cs @@ -0,0 +1,62 @@ +// +// 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.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// EntityRelationsOperations operations. + /// + public partial interface IEntityRelationsOperations + { + /// + /// Gets an entity 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. + /// + /// + /// entity ID + /// + /// + /// Relation Name + /// + /// + /// The 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 + /// + Task> GetRelationWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string entityId, string relationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IIPGeodataOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IIPGeodataOperations.cs new file mode 100644 index 0000000000000..2976916878e57 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IIPGeodataOperations.cs @@ -0,0 +1,52 @@ +// +// 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.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// IPGeodataOperations operations. + /// + public partial interface IIPGeodataOperations + { + /// + /// Get geodata for a single IP address + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// IP address (v4 or v6) to be enriched + /// + /// + /// The 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 + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string ipAddress, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IIncidentCommentsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IIncidentCommentsOperations.cs index b631e37547e1e..f9f977f2e6a0b 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IIncidentCommentsOperations.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IIncidentCommentsOperations.cs @@ -28,8 +28,11 @@ public partial interface IIncidentCommentsOperations /// Gets all incident comments. /// /// - /// 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. @@ -62,13 +65,16 @@ public partial interface IIncidentCommentsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByIncidentWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string incidentId, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets an incident comment. /// /// - /// 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. @@ -94,13 +100,16 @@ public partial interface IIncidentCommentsOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string incidentId, string incidentCommentId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, string incidentCommentId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Creates the incident comment. + /// Creates or updates the incident comment. /// /// - /// 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. @@ -114,6 +123,9 @@ public partial interface IIncidentCommentsOperations /// /// The comment message /// + /// + /// Etag of the azure resource + /// /// /// The headers that will be added to request. /// @@ -129,7 +141,39 @@ public partial interface IIncidentCommentsOperations /// /// Thrown when a required parameter is null /// - Task> CreateCommentWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string incidentId, string incidentCommentId, string message, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, string incidentCommentId, string message, string etag = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete the incident comment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Incident ID + /// + /// + /// Incident comment ID + /// + /// + /// The 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 + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, string incidentCommentId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets all incident comments. /// @@ -151,6 +195,6 @@ public partial interface IIncidentCommentsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByIncidentNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IIncidentRelationsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IIncidentRelationsOperations.cs new file mode 100644 index 0000000000000..92aa3ebef3de2 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IIncidentRelationsOperations.cs @@ -0,0 +1,200 @@ +// +// 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.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// IncidentRelationsOperations operations. + /// + public partial interface IIncidentRelationsOperations + { + /// + /// Gets all incident 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. + /// + /// + /// Incident 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 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 + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets an incident 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. + /// + /// + /// Incident ID + /// + /// + /// Relation Name + /// + /// + /// The 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 + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, string relationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates the incident 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. + /// + /// + /// Incident ID + /// + /// + /// Relation Name + /// + /// + /// The resource ID of the related resource + /// + /// + /// Etag of the azure resource + /// + /// + /// The 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 + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, string relationName, string relatedResourceId, string etag = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete the incident 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. + /// + /// + /// Incident ID + /// + /// + /// Relation Name + /// + /// + /// The 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 + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, string relationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all incident relations. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The 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 + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IIncidentsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IIncidentsOperations.cs index ff001b53476e0..3fdb8846ee46b 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IIncidentsOperations.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IIncidentsOperations.cs @@ -27,8 +27,11 @@ public partial interface IIncidentsOperations /// Gets all incidents. /// /// - /// 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. @@ -64,13 +67,16 @@ public partial interface IIncidentsOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string filter = default(string), string orderby = default(string), int? top = default(int?), string skipToken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string filter = default(string), string orderby = default(string), int? top = default(int?), string skipToken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets an incident. /// /// - /// 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. @@ -93,13 +99,16 @@ public partial interface IIncidentsOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string incidentId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates or updates the incident. /// /// - /// 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. @@ -125,13 +134,46 @@ public partial interface IIncidentsOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string incidentId, Incident incident, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, Incident incident, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete the incident. /// /// - /// 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. + /// + /// + /// Incident ID + /// + /// + /// The 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 + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates a Microsoft team to investigate the incident by sharing + /// information and insights between participants. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. /// /// /// The name of the workspace. @@ -139,6 +181,9 @@ public partial interface IIncidentsOperations /// /// Incident ID /// + /// + /// Team properties + /// /// /// The headers that will be added to request. /// @@ -148,10 +193,109 @@ public partial interface IIncidentsOperations /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateTeamWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, TeamProperties teamProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all incident alerts. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Incident ID + /// + /// + /// The 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 + /// + Task> ListAlertsWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all incident bookmarks. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Incident ID + /// + /// + /// The 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 + /// + Task> ListBookmarksWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all incident related 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. + /// + /// + /// Incident ID + /// + /// + /// The 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 /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string incidentId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListEntitiesWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets all incidents. /// diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IMetadataOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IMetadataOperations.cs new file mode 100644 index 0000000000000..831e2d34e8ab8 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IMetadataOperations.cs @@ -0,0 +1,222 @@ +// +// 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.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// MetadataOperations operations. + /// + public partial interface IMetadataOperations + { + /// + /// List of all metadata + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Filters the results, based on a Boolean condition. Optional. + /// + /// + /// Sorts the results. Optional. + /// + /// + /// Returns only the first n results. Optional. + /// + /// + /// Used to skip n elements in the OData query (offset). Returns a + /// nextLink to the next page of results if there are any left. + /// + /// + /// The 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 + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string filter = default(string), string orderby = default(string), int? top = default(int?), int? skip = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get a Metadata. + /// + /// + /// 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 Metadata name. + /// + /// + /// The 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 + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string metadataName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a Metadata. + /// + /// + /// 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 Metadata name. + /// + /// + /// The 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 + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string metadataName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create a Metadata. + /// + /// + /// 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 Metadata name. + /// + /// + /// Metadata resource. + /// + /// + /// The 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 + /// + Task> CreateWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string metadataName, MetadataModel metadata, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update an existing Metadata. + /// + /// + /// 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 Metadata name. + /// + /// + /// Partial metadata request. + /// + /// + /// The 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 + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string metadataName, MetadataPatch metadataPatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List of all metadata + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The 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 + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IOfficeConsentsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IOfficeConsentsOperations.cs new file mode 100644 index 0000000000000..102bf27f73e45 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IOfficeConsentsOperations.cs @@ -0,0 +1,139 @@ +// +// 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.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// OfficeConsentsOperations operations. + /// + public partial interface IOfficeConsentsOperations + { + /// + /// Gets all office365 consents. + /// + /// + /// 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 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 + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets an office365 consent. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// consent ID + /// + /// + /// The 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 + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string consentId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete the office365 consent. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// consent ID + /// + /// + /// The 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 + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string consentId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all office365 consents. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The 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 + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IPGeodataOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IPGeodataOperations.cs new file mode 100644 index 0000000000000..e1a36829d4b5c --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IPGeodataOperations.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; + + /// + /// IPGeodataOperations operations. + /// + internal partial class IPGeodataOperations : IServiceOperations, IIPGeodataOperations + { + /// + /// Initializes a new instance of the IPGeodataOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal IPGeodataOperations(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 geodata for a single IP address + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// IP address (v4 or v6) 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 ipAddress, 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 (ipAddress == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ipAddress"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("ipAddress", ipAddress); + 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/ip/geodata/").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 (ipAddress != null) + { + _queryParameters.Add(string.Format("ipAddress={0}", System.Uri.EscapeDataString(ipAddress))); + } + 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/IPGeodataOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IPGeodataOperationsExtensions.cs new file mode 100644 index 0000000000000..398f6f9cac951 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IPGeodataOperationsExtensions.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 IPGeodataOperations. + /// + public static partial class IPGeodataOperationsExtensions + { + /// + /// Get geodata for a single IP address + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// IP address (v4 or v6) to be enriched + /// + public static EnrichmentIpGeodata Get(this IIPGeodataOperations operations, string resourceGroupName, string ipAddress) + { + return operations.GetAsync(resourceGroupName, ipAddress).GetAwaiter().GetResult(); + } + + /// + /// Get geodata for a single IP address + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// IP address (v4 or v6) to be enriched + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IIPGeodataOperations operations, string resourceGroupName, string ipAddress, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, ipAddress, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IProductSettingsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IProductSettingsOperations.cs new file mode 100644 index 0000000000000..7db5068e48e8d --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IProductSettingsOperations.cs @@ -0,0 +1,155 @@ +// +// 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.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ProductSettingsOperations operations. + /// + public partial interface IProductSettingsOperations + { + /// + /// List of all the settings + /// + /// + /// 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 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 + /// + Task> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a setting. + /// + /// + /// 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 setting name. Supports - Anomalies, EyesOn, EntityAnalytics, + /// Ueba + /// + /// + /// The 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 + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string settingsName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete setting of the product. + /// + /// + /// 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 setting name. Supports - Anomalies, EyesOn, EntityAnalytics, + /// Ueba + /// + /// + /// The 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 + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string settingsName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates setting. + /// + /// + /// 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 setting name. Supports - Anomalies, EyesOn, EntityAnalytics, + /// Ueba + /// + /// + /// The setting + /// + /// + /// The 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 + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string settingsName, Settings settings, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ISecurityInsightsClient.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ISecurityInsightsClient.cs index 5b212079b6286..27a082817ee66 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ISecurityInsightsClient.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ISecurityInsightsClient.cs @@ -42,14 +42,14 @@ public partial interface ISecurityInsightsClient : System.IDisposable ServiceClientCredentials Credentials { get; } /// - /// API version for the operation + /// The ID of the target subscription. /// - string ApiVersion { get; } + string SubscriptionId { get; set; } /// - /// Azure subscription ID + /// The API version to use for this operation. /// - string SubscriptionId { get; set; } + string ApiVersion { get; } /// /// The preferred language for the response. @@ -70,11 +70,6 @@ public partial interface ISecurityInsightsClient : System.IDisposable bool? GenerateClientRequestId { get; set; } - /// - /// Gets the IOperations. - /// - IOperations Operations { get; } - /// /// Gets the IAlertRulesOperations. /// @@ -90,15 +85,60 @@ public partial interface ISecurityInsightsClient : System.IDisposable /// IAlertRuleTemplatesOperations AlertRuleTemplates { get; } + /// + /// Gets the IAutomationRulesOperations. + /// + IAutomationRulesOperations AutomationRules { get; } + /// /// Gets the IBookmarksOperations. /// IBookmarksOperations Bookmarks { get; } /// - /// Gets the IDataConnectorsOperations. + /// Gets the IBookmarkRelationsOperations. /// - IDataConnectorsOperations DataConnectors { get; } + IBookmarkRelationsOperations BookmarkRelations { get; } + + /// + /// Gets the IBookmarkOperations. + /// + IBookmarkOperations Bookmark { get; } + + /// + /// Gets the IIPGeodataOperations. + /// + IIPGeodataOperations IPGeodata { get; } + + /// + /// Gets the IDomainWhoisOperations. + /// + IDomainWhoisOperations DomainWhois { get; } + + /// + /// Gets the IEntityQueriesOperations. + /// + IEntityQueriesOperations EntityQueries { get; } + + /// + /// Gets the IEntitiesOperations. + /// + IEntitiesOperations Entities { get; } + + /// + /// Gets the IEntitiesGetTimelineOperations. + /// + IEntitiesGetTimelineOperations EntitiesGetTimeline { get; } + + /// + /// Gets the IEntitiesRelationsOperations. + /// + IEntitiesRelationsOperations EntitiesRelations { get; } + + /// + /// Gets the IEntityRelationsOperations. + /// + IEntityRelationsOperations EntityRelations { get; } /// /// Gets the IIncidentsOperations. @@ -110,5 +150,85 @@ public partial interface ISecurityInsightsClient : System.IDisposable /// IIncidentCommentsOperations IncidentComments { get; } + /// + /// Gets the IIncidentRelationsOperations. + /// + IIncidentRelationsOperations IncidentRelations { get; } + + /// + /// Gets the IMetadataOperations. + /// + IMetadataOperations Metadata { get; } + + /// + /// Gets the ISentinelOnboardingStatesOperations. + /// + ISentinelOnboardingStatesOperations SentinelOnboardingStates { get; } + + /// + /// Gets the IProductSettingsOperations. + /// + IProductSettingsOperations ProductSettings { get; } + + /// + /// Gets the ISourceControlOperations. + /// + ISourceControlOperations SourceControl { get; } + + /// + /// Gets the ISourceControlsOperations. + /// + ISourceControlsOperations SourceControls { get; } + + /// + /// Gets the IWatchlistsOperations. + /// + IWatchlistsOperations Watchlists { get; } + + /// + /// Gets the IWatchlistItemsOperations. + /// + IWatchlistItemsOperations WatchlistItems { get; } + + /// + /// Gets the IDataConnectorsOperations. + /// + IDataConnectorsOperations DataConnectors { get; } + + /// + /// Gets the IDataConnectorsCheckRequirementsOperations. + /// + IDataConnectorsCheckRequirementsOperations DataConnectorsCheckRequirements { get; } + + /// + /// Gets the IThreatIntelligenceIndicatorOperations. + /// + IThreatIntelligenceIndicatorOperations ThreatIntelligenceIndicator { get; } + + /// + /// Gets the IThreatIntelligenceIndicatorsOperations. + /// + IThreatIntelligenceIndicatorsOperations ThreatIntelligenceIndicators { get; } + + /// + /// Gets the IThreatIntelligenceIndicatorMetricsOperations. + /// + IThreatIntelligenceIndicatorMetricsOperations ThreatIntelligenceIndicatorMetrics { get; } + + /// + /// Gets the IOperations. + /// + IOperations Operations { get; } + + /// + /// Gets the IOfficeConsentsOperations. + /// + IOfficeConsentsOperations OfficeConsents { get; } + + /// + /// Gets the IEntityQueryTemplatesOperations. + /// + IEntityQueryTemplatesOperations EntityQueryTemplates { get; } + } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ISentinelOnboardingStatesOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ISentinelOnboardingStatesOperations.cs new file mode 100644 index 0000000000000..8e0709e00b196 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ISentinelOnboardingStatesOperations.cs @@ -0,0 +1,155 @@ +// +// 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.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SentinelOnboardingStatesOperations operations. + /// + public partial interface ISentinelOnboardingStatesOperations + { + /// + /// Get Sentinel onboarding state + /// + /// + /// 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 Sentinel onboarding state name. Supports - default + /// + /// + /// The 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 + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string sentinelOnboardingStateName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create Sentinel onboarding state + /// + /// + /// 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 Sentinel onboarding state name. Supports - default + /// + /// + /// Etag of the azure resource + /// + /// + /// Flag that indicates the status of the CMK setting + /// + /// + /// The 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 + /// + Task> CreateWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string sentinelOnboardingStateName, string etag = default(string), bool? customerManagedKey = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete Sentinel onboarding state + /// + /// + /// 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 Sentinel onboarding state name. Supports - default + /// + /// + /// The 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 + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string sentinelOnboardingStateName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all Sentinel onboarding states + /// + /// + /// 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 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 + /// + Task> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ISourceControlOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ISourceControlOperations.cs new file mode 100644 index 0000000000000..0aabedfa5b7c8 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ISourceControlOperations.cs @@ -0,0 +1,81 @@ +// +// 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.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SourceControlOperations operations. + /// + public partial interface ISourceControlOperations + { + /// + /// Gets a list of repositories metadata. + /// + /// + /// 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 repo type. Possible values include: 'Github', 'DevOps' + /// + /// + /// The 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 + /// + Task>> ListRepositoriesWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string repoType, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of repositories metadata. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The 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 + /// + Task>> ListRepositoriesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ISourceControlsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ISourceControlsOperations.cs new file mode 100644 index 0000000000000..7042bd02637a9 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ISourceControlsOperations.cs @@ -0,0 +1,174 @@ +// +// 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.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SourceControlsOperations operations. + /// + public partial interface ISourceControlsOperations + { + /// + /// Gets all source controls, without source control items. + /// + /// + /// 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 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 + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a source control byt its identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Source control Id + /// + /// + /// The 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 + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string sourceControlId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a source control. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Source control Id + /// + /// + /// The 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 + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string sourceControlId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates a source control. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Source control Id + /// + /// + /// The SourceControl + /// + /// + /// The 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 + /// + Task> CreateWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string sourceControlId, SourceControl sourceControl, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all source controls, without source control items. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The 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 + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IThreatIntelligenceIndicatorMetricsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IThreatIntelligenceIndicatorMetricsOperations.cs new file mode 100644 index 0000000000000..fb07f22429a12 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IThreatIntelligenceIndicatorMetricsOperations.cs @@ -0,0 +1,57 @@ +// +// 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.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ThreatIntelligenceIndicatorMetricsOperations operations. + /// + public partial interface IThreatIntelligenceIndicatorMetricsOperations + { + /// + /// Get threat intelligence indicators metrics (Indicators counts by + /// Type, Threat Type, Source). + /// + /// + /// 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 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 + /// + Task> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IThreatIntelligenceIndicatorOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IThreatIntelligenceIndicatorOperations.cs new file mode 100644 index 0000000000000..a16aa7786a9e3 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IThreatIntelligenceIndicatorOperations.cs @@ -0,0 +1,276 @@ +// +// 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.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ThreatIntelligenceIndicatorOperations operations. + /// + public partial interface IThreatIntelligenceIndicatorOperations + { + /// + /// Create a new threat intelligence indicator. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Properties of threat intelligence indicators to create and update. + /// + /// + /// The 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 + /// + Task> CreateIndicatorWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, ThreatIntelligenceIndicatorModelForRequestBody threatIntelligenceProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// View a threat intelligence indicator by name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Threat intelligence indicator name field. + /// + /// + /// The 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 + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a threat Intelligence indicator. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Threat intelligence indicator name field. + /// + /// + /// Properties of threat intelligence indicators to create and update. + /// + /// + /// The 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 + /// + Task> CreateWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string name, ThreatIntelligenceIndicatorModelForRequestBody threatIntelligenceProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a threat intelligence indicator. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Threat intelligence indicator name field. + /// + /// + /// The 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 + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Query threat intelligence indicators as per filtering criteria. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Filtering criteria for querying threat intelligence indicators. + /// + /// + /// The 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 + /// + Task>> QueryIndicatorsWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, ThreatIntelligenceFilteringCriteria threatIntelligenceFilteringCriteria, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Append tags to a threat intelligence indicator. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Threat intelligence indicator name field. + /// + /// + /// List of tags to be appended. + /// + /// + /// The 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 + /// + Task AppendTagsWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string name, IList threatIntelligenceTags = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Replace tags added to a threat intelligence indicator. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Threat intelligence indicator name field. + /// + /// + /// Tags in the threat intelligence indicator to be replaced. + /// + /// + /// The 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 + /// + Task> ReplaceTagsWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string name, ThreatIntelligenceIndicatorModelForRequestBody threatIntelligenceReplaceTags, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Query threat intelligence indicators as per filtering criteria. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The 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 + /// + Task>> QueryIndicatorsNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IThreatIntelligenceIndicatorsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IThreatIntelligenceIndicatorsOperations.cs new file mode 100644 index 0000000000000..39eae0db3211c --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IThreatIntelligenceIndicatorsOperations.cs @@ -0,0 +1,94 @@ +// +// 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.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ThreatIntelligenceIndicatorsOperations operations. + /// + public partial interface IThreatIntelligenceIndicatorsOperations + { + /// + /// Get all threat intelligence indicators. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Filters the results, based on a Boolean condition. Optional. + /// + /// + /// Sorts the results. Optional. + /// + /// + /// Returns only the first n results. Optional. + /// + /// + /// 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 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 + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string filter = default(string), string orderby = default(string), int? top = default(int?), string skipToken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get all threat intelligence indicators. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The 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 + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IWatchlistItemsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IWatchlistItemsOperations.cs new file mode 100644 index 0000000000000..db2e5fcb029fa --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IWatchlistItemsOperations.cs @@ -0,0 +1,186 @@ +// +// 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.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// WatchlistItemsOperations operations. + /// + public partial interface IWatchlistItemsOperations + { + /// + /// Gets all watchlist Items. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Watchlist Alias + /// + /// + /// The 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 + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string watchlistAlias, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a watchlist, without its watchlist items. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Watchlist Alias + /// + /// + /// Watchlist Item Id (GUID) + /// + /// + /// The 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 + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string watchlistAlias, string watchlistItemId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a watchlist item. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Watchlist Alias + /// + /// + /// Watchlist Item Id (GUID) + /// + /// + /// The 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 + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string watchlistAlias, string watchlistItemId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a watchlist item. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Watchlist Alias + /// + /// + /// Watchlist Item Id (GUID) + /// + /// + /// The watchlist item + /// + /// + /// The 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 + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string watchlistAlias, string watchlistItemId, WatchlistItem watchlistItem, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all watchlist Items. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The 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 + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IWatchlistsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IWatchlistsOperations.cs new file mode 100644 index 0000000000000..6b659690c533e --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IWatchlistsOperations.cs @@ -0,0 +1,177 @@ +// +// 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.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// WatchlistsOperations operations. + /// + public partial interface IWatchlistsOperations + { + /// + /// Gets all watchlists, without watchlist items. + /// + /// + /// 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 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 + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a watchlist, without its watchlist items. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Watchlist Alias + /// + /// + /// The 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 + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string watchlistAlias, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a watchlist. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Watchlist Alias + /// + /// + /// The 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 + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string watchlistAlias, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a watchlist and its watchlist items (bulk + /// creation, e.g. through text/csv content type). To create a + /// Watchlist and its items, we should call this endpoint with + /// rawContent and contentType properties. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Watchlist Alias + /// + /// + /// The watchlist + /// + /// + /// The 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 + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string watchlistAlias, Watchlist watchlist, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all watchlists, without watchlist items. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The 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 + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IncidentCommentsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IncidentCommentsOperations.cs index f41d71bf75ab6..655123e6bfed8 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IncidentCommentsOperations.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IncidentCommentsOperations.cs @@ -55,8 +55,11 @@ internal IncidentCommentsOperations(SecurityInsightsClient client) /// Gets all incident comments. /// /// - /// 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. @@ -94,17 +97,28 @@ internal IncidentCommentsOperations(SecurityInsightsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByIncidentWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string incidentId, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, 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 (!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) @@ -121,10 +135,10 @@ internal IncidentCommentsOperations(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) { @@ -154,17 +168,19 @@ internal IncidentCommentsOperations(SecurityInsightsClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); tracingParameters.Add("workspaceName", workspaceName); tracingParameters.Add("incidentId", incidentId); tracingParameters.Add("skipToken", skipToken); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByIncident", tracingParameters); + 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/incidents/{incidentId}/comments").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments").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("{incidentId}", System.Uri.EscapeDataString(incidentId)); List _queryParameters = new List(); @@ -313,8 +329,11 @@ internal IncidentCommentsOperations(SecurityInsightsClient client) /// Gets an incident comment. /// /// - /// 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. @@ -346,17 +365,28 @@ internal IncidentCommentsOperations(SecurityInsightsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string incidentId, string incidentCommentId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, string incidentCommentId, 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) @@ -373,10 +403,10 @@ internal IncidentCommentsOperations(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) { @@ -409,6 +439,7 @@ internal IncidentCommentsOperations(SecurityInsightsClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); tracingParameters.Add("workspaceName", workspaceName); tracingParameters.Add("incidentId", incidentId); tracingParameters.Add("incidentCommentId", incidentCommentId); @@ -417,9 +448,10 @@ internal IncidentCommentsOperations(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/incidents/{incidentId}/comments/{incidentCommentId}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments/{incidentCommentId}").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("{incidentId}", System.Uri.EscapeDataString(incidentId)); _url = _url.Replace("{incidentCommentId}", System.Uri.EscapeDataString(incidentCommentId)); @@ -554,11 +586,14 @@ internal IncidentCommentsOperations(SecurityInsightsClient client) } /// - /// Creates the incident comment. + /// Creates or updates the incident comment. /// /// - /// 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. @@ -572,6 +607,9 @@ internal IncidentCommentsOperations(SecurityInsightsClient client) /// /// The comment message /// + /// + /// Etag of the azure resource + /// /// /// Headers that will be added to request. /// @@ -593,17 +631,28 @@ internal IncidentCommentsOperations(SecurityInsightsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateCommentWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string incidentId, string incidentCommentId, string message, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, string incidentCommentId, string message, 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 (!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) @@ -620,10 +669,10 @@ internal IncidentCommentsOperations(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) { @@ -653,8 +702,9 @@ internal IncidentCommentsOperations(SecurityInsightsClient client) throw new ValidationException(ValidationRules.CannotBeNull, "message"); } IncidentComment incidentComment = new IncidentComment(); - if (message != null) + if (etag != null || message != null) { + incidentComment.Etag = etag; incidentComment.Message = message; } // Tracing @@ -665,18 +715,20 @@ internal IncidentCommentsOperations(SecurityInsightsClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); tracingParameters.Add("workspaceName", workspaceName); tracingParameters.Add("incidentId", incidentId); tracingParameters.Add("incidentCommentId", incidentCommentId); tracingParameters.Add("incidentComment", incidentComment); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateComment", tracingParameters); + 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/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments/{incidentCommentId}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}/comments/{incidentCommentId}").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("{incidentId}", System.Uri.EscapeDataString(incidentId)); _url = _url.Replace("{incidentCommentId}", System.Uri.EscapeDataString(incidentCommentId)); @@ -749,7 +801,7 @@ internal IncidentCommentsOperations(SecurityInsightsClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 201) + if ((int)_statusCode != 200 && (int)_statusCode != 201) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -792,6 +844,24 @@ internal IncidentCommentsOperations(SecurityInsightsClient client) _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); @@ -816,6 +886,245 @@ internal IncidentCommentsOperations(SecurityInsightsClient client) return _result; } + /// + /// Delete the incident comment. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Incident ID + /// + /// + /// Incident comment 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 incidentId, string incidentCommentId, 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 (incidentId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "incidentId"); + } + if (incidentCommentId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "incidentCommentId"); + } + // 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("incidentId", incidentId); + tracingParameters.Add("incidentCommentId", incidentCommentId); + 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/incidents/{incidentId}/comments/{incidentCommentId}").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("{incidentId}", System.Uri.EscapeDataString(incidentId)); + _url = _url.Replace("{incidentCommentId}", System.Uri.EscapeDataString(incidentCommentId)); + 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 incident comments. /// @@ -843,7 +1152,7 @@ internal IncidentCommentsOperations(SecurityInsightsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByIncidentNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -858,7 +1167,7 @@ internal IncidentCommentsOperations(SecurityInsightsClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByIncidentNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IncidentCommentsOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IncidentCommentsOperationsExtensions.cs index 753d695eeb08f..1ce3ffdec247b 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IncidentCommentsOperationsExtensions.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IncidentCommentsOperationsExtensions.cs @@ -29,8 +29,11 @@ public static partial class IncidentCommentsOperationsExtensions /// 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. @@ -47,9 +50,9 @@ public static partial class IncidentCommentsOperationsExtensions /// nextLink element will include a skiptoken parameter that specifies a /// starting point to use for subsequent calls. Optional. /// - public static IPage ListByIncident(this IIncidentCommentsOperations operations, string resourceGroupName, string workspaceName, string incidentId, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string)) + public static IPage List(this IIncidentCommentsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string)) { - return operations.ListByIncidentAsync(resourceGroupName, workspaceName, incidentId, odataQuery, skipToken).GetAwaiter().GetResult(); + return operations.ListAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, incidentId, odataQuery, skipToken).GetAwaiter().GetResult(); } /// @@ -59,8 +62,11 @@ public static partial class IncidentCommentsOperationsExtensions /// 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. @@ -80,9 +86,9 @@ public static partial class IncidentCommentsOperationsExtensions /// /// The cancellation token. /// - public static async Task> ListByIncidentAsync(this IIncidentCommentsOperations operations, string resourceGroupName, string workspaceName, string incidentId, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAsync(this IIncidentCommentsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByIncidentWithHttpMessagesAsync(resourceGroupName, workspaceName, incidentId, odataQuery, skipToken, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, incidentId, odataQuery, skipToken, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -95,8 +101,11 @@ public static partial class IncidentCommentsOperationsExtensions /// 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. @@ -107,9 +116,9 @@ public static partial class IncidentCommentsOperationsExtensions /// /// Incident comment ID /// - public static IncidentComment Get(this IIncidentCommentsOperations operations, string resourceGroupName, string workspaceName, string incidentId, string incidentCommentId) + public static IncidentComment Get(this IIncidentCommentsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, string incidentCommentId) { - return operations.GetAsync(resourceGroupName, workspaceName, incidentId, incidentCommentId).GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, incidentId, incidentCommentId).GetAwaiter().GetResult(); } /// @@ -119,8 +128,11 @@ public static IncidentComment Get(this IIncidentCommentsOperations operations, s /// 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. @@ -134,23 +146,26 @@ public static IncidentComment Get(this IIncidentCommentsOperations operations, s /// /// The cancellation token. /// - public static async Task GetAsync(this IIncidentCommentsOperations operations, string resourceGroupName, string workspaceName, string incidentId, string incidentCommentId, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IIncidentCommentsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, string incidentCommentId, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, workspaceName, incidentId, incidentCommentId, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, incidentId, incidentCommentId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Creates the incident comment. + /// Creates or updates the incident comment. /// /// /// 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. @@ -164,20 +179,26 @@ public static IncidentComment Get(this IIncidentCommentsOperations operations, s /// /// The comment message /// - public static IncidentComment CreateComment(this IIncidentCommentsOperations operations, string resourceGroupName, string workspaceName, string incidentId, string incidentCommentId, string message) + /// + /// Etag of the azure resource + /// + public static IncidentComment CreateOrUpdate(this IIncidentCommentsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, string incidentCommentId, string message, string etag = default(string)) { - return operations.CreateCommentAsync(resourceGroupName, workspaceName, incidentId, incidentCommentId, message).GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, incidentId, incidentCommentId, message, etag).GetAwaiter().GetResult(); } /// - /// Creates the incident comment. + /// Creates or updates the incident comment. /// /// /// 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. @@ -191,17 +212,77 @@ public static IncidentComment CreateComment(this IIncidentCommentsOperations ope /// /// The comment message /// + /// + /// Etag of the azure resource + /// /// /// The cancellation token. /// - public static async Task CreateCommentAsync(this IIncidentCommentsOperations operations, string resourceGroupName, string workspaceName, string incidentId, string incidentCommentId, string message, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this IIncidentCommentsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, string incidentCommentId, string message, string etag = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateCommentWithHttpMessagesAsync(resourceGroupName, workspaceName, incidentId, incidentCommentId, message, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, incidentId, incidentCommentId, message, etag, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } + /// + /// Delete the incident comment. + /// + /// + /// 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. + /// + /// + /// Incident ID + /// + /// + /// Incident comment ID + /// + public static void Delete(this IIncidentCommentsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, string incidentCommentId) + { + operations.DeleteAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, incidentId, incidentCommentId).GetAwaiter().GetResult(); + } + + /// + /// Delete the incident comment. + /// + /// + /// 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. + /// + /// + /// Incident ID + /// + /// + /// Incident comment ID + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IIncidentCommentsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, string incidentCommentId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, incidentId, incidentCommentId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// Gets all incident comments. /// @@ -211,9 +292,9 @@ public static IncidentComment CreateComment(this IIncidentCommentsOperations ope /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListByIncidentNext(this IIncidentCommentsOperations operations, string nextPageLink) + public static IPage ListNext(this IIncidentCommentsOperations operations, string nextPageLink) { - return operations.ListByIncidentNextAsync(nextPageLink).GetAwaiter().GetResult(); + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// @@ -228,9 +309,9 @@ public static IPage ListByIncidentNext(this IIncidentCommentsOp /// /// The cancellation token. /// - public static async Task> ListByIncidentNextAsync(this IIncidentCommentsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListNextAsync(this IIncidentCommentsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByIncidentNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + 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/IncidentRelationsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IncidentRelationsOperations.cs new file mode 100644 index 0000000000000..dce6bf1536d9d --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IncidentRelationsOperations.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; + + /// + /// IncidentRelationsOperations operations. + /// + internal partial class IncidentRelationsOperations : IServiceOperations, IIncidentRelationsOperations + { + /// + /// Initializes a new instance of the IncidentRelationsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal IncidentRelationsOperations(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 incident 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. + /// + /// + /// Incident 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 incidentId, 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 (incidentId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "incidentId"); + } + // 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("incidentId", incidentId); + 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/incidents/{incidentId}/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("{incidentId}", System.Uri.EscapeDataString(incidentId)); + 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 an incident 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. + /// + /// + /// Incident 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 incidentId, 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 (incidentId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "incidentId"); + } + 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("incidentId", incidentId); + 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/incidents/{incidentId}/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("{incidentId}", System.Uri.EscapeDataString(incidentId)); + _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 or updates the incident 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. + /// + /// + /// Incident 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 incidentId, 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 (incidentId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "incidentId"); + } + 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("incidentId", incidentId); + 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/incidents/{incidentId}/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("{incidentId}", System.Uri.EscapeDataString(incidentId)); + _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 incident 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. + /// + /// + /// Incident 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 incidentId, 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 (incidentId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "incidentId"); + } + 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("incidentId", incidentId); + 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/incidents/{incidentId}/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("{incidentId}", System.Uri.EscapeDataString(incidentId)); + _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 incident 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/IncidentRelationsOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IncidentRelationsOperationsExtensions.cs new file mode 100644 index 0000000000000..75a9b3676355f --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IncidentRelationsOperationsExtensions.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 IncidentRelationsOperations. + /// + public static partial class IncidentRelationsOperationsExtensions + { + /// + /// Gets all incident 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. + /// + /// + /// Incident 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 IIncidentRelationsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string)) + { + return operations.ListAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, incidentId, odataQuery, skipToken).GetAwaiter().GetResult(); + } + + /// + /// Gets all incident 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. + /// + /// + /// Incident 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 IIncidentRelationsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, incidentId, odataQuery, skipToken, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets an incident 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. + /// + /// + /// Incident ID + /// + /// + /// Relation Name + /// + public static Relation Get(this IIncidentRelationsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, string relationName) + { + return operations.GetAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, incidentId, relationName).GetAwaiter().GetResult(); + } + + /// + /// Gets an incident 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. + /// + /// + /// Incident ID + /// + /// + /// Relation Name + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IIncidentRelationsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, string relationName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, incidentId, relationName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates the incident 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. + /// + /// + /// Incident ID + /// + /// + /// Relation Name + /// + /// + /// The resource ID of the related resource + /// + /// + /// Etag of the azure resource + /// + public static Relation CreateOrUpdate(this IIncidentRelationsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, string relationName, string relatedResourceId, string etag = default(string)) + { + return operations.CreateOrUpdateAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, incidentId, relationName, relatedResourceId, etag).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates the incident 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. + /// + /// + /// Incident ID + /// + /// + /// Relation Name + /// + /// + /// The resource ID of the related resource + /// + /// + /// Etag of the azure resource + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IIncidentRelationsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, string relationName, string relatedResourceId, string etag = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, incidentId, relationName, relatedResourceId, etag, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete the incident 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. + /// + /// + /// Incident ID + /// + /// + /// Relation Name + /// + public static void Delete(this IIncidentRelationsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, string relationName) + { + operations.DeleteAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, incidentId, relationName).GetAwaiter().GetResult(); + } + + /// + /// Delete the incident 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. + /// + /// + /// Incident ID + /// + /// + /// Relation Name + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IIncidentRelationsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, string relationName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, incidentId, relationName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets all incident relations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IIncidentRelationsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all incident 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 IIncidentRelationsOperations 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/IncidentsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IncidentsOperations.cs index ce19d6fbf1998..38adf52d06fb1 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IncidentsOperations.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IncidentsOperations.cs @@ -54,8 +54,11 @@ internal IncidentsOperations(SecurityInsightsClient client) /// Gets all incidents. /// /// - /// 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. @@ -96,17 +99,28 @@ internal IncidentsOperations(SecurityInsightsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string filter = default(string), string orderby = default(string), int? top = default(int?), string skipToken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string filter = default(string), string orderby = default(string), int? top = default(int?), 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 (!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) @@ -123,10 +137,10 @@ internal IncidentsOperations(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) { @@ -151,6 +165,7 @@ internal IncidentsOperations(SecurityInsightsClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); tracingParameters.Add("workspaceName", workspaceName); tracingParameters.Add("filter", filter); tracingParameters.Add("orderby", orderby); @@ -161,9 +176,10 @@ internal IncidentsOperations(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/incidents").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents").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) @@ -315,8 +331,11 @@ internal IncidentsOperations(SecurityInsightsClient client) /// Gets an incident. /// /// - /// 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. @@ -345,17 +364,28 @@ internal IncidentsOperations(SecurityInsightsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string incidentId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, 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) @@ -372,10 +402,10 @@ internal IncidentsOperations(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) { @@ -404,6 +434,7 @@ internal IncidentsOperations(SecurityInsightsClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); tracingParameters.Add("workspaceName", workspaceName); tracingParameters.Add("incidentId", incidentId); tracingParameters.Add("cancellationToken", cancellationToken); @@ -411,9 +442,10 @@ internal IncidentsOperations(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/incidents/{incidentId}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}").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("{incidentId}", System.Uri.EscapeDataString(incidentId)); List _queryParameters = new List(); @@ -550,8 +582,11 @@ internal IncidentsOperations(SecurityInsightsClient client) /// Creates or updates the incident. /// /// - /// 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. @@ -583,17 +618,28 @@ internal IncidentsOperations(SecurityInsightsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string incidentId, Incident incident, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, Incident incident, 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) @@ -610,10 +656,10 @@ internal IncidentsOperations(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) { @@ -650,6 +696,7 @@ internal IncidentsOperations(SecurityInsightsClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); tracingParameters.Add("workspaceName", workspaceName); tracingParameters.Add("incidentId", incidentId); tracingParameters.Add("incident", incident); @@ -658,9 +705,10 @@ internal IncidentsOperations(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/incidents/{incidentId}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}").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("{incidentId}", System.Uri.EscapeDataString(incidentId)); List _queryParameters = new List(); @@ -821,8 +869,11 @@ internal IncidentsOperations(SecurityInsightsClient client) /// Delete the incident. /// /// - /// 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. @@ -848,17 +899,28 @@ internal IncidentsOperations(SecurityInsightsClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string incidentId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, 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) @@ -875,10 +937,10 @@ internal IncidentsOperations(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) { @@ -907,6 +969,7 @@ internal IncidentsOperations(SecurityInsightsClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("operationalInsightsResourceProvider", operationalInsightsResourceProvider); tracingParameters.Add("workspaceName", workspaceName); tracingParameters.Add("incidentId", incidentId); tracingParameters.Add("cancellationToken", cancellationToken); @@ -914,9 +977,10 @@ internal IncidentsOperations(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/incidents/{incidentId}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{operationalInsightsResourceProvider}/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/incidents/{incidentId}").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("{incidentId}", System.Uri.EscapeDataString(incidentId)); List _queryParameters = new List(); @@ -1031,6 +1095,1029 @@ internal IncidentsOperations(SecurityInsightsClient client) return _result; } + /// + /// Creates a Microsoft team to investigate the incident by sharing information + /// and insights between participants. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Incident ID + /// + /// + /// Team properties + /// + /// + /// 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> CreateTeamWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, TeamProperties teamProperties, 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 (incidentId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "incidentId"); + } + if (teamProperties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "teamProperties"); + } + if (teamProperties != null) + { + teamProperties.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("incidentId", incidentId); + tracingParameters.Add("teamProperties", teamProperties); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateTeam", 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/incidents/{incidentId}/createTeam").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("{incidentId}", System.Uri.EscapeDataString(incidentId)); + 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(teamProperties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(teamProperties, 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 incident alerts. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Incident 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> ListAlertsWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, 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 (incidentId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "incidentId"); + } + // 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("incidentId", incidentId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListAlerts", 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/incidents/{incidentId}/alerts").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("{incidentId}", System.Uri.EscapeDataString(incidentId)); + 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 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 incident bookmarks. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Incident 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> ListBookmarksWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, 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 (incidentId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "incidentId"); + } + // 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("incidentId", incidentId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListBookmarks", 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/incidents/{incidentId}/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)); + _url = _url.Replace("{incidentId}", System.Uri.EscapeDataString(incidentId)); + 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 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 incident related 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. + /// + /// + /// Incident 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> ListEntitiesWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, 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 (incidentId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "incidentId"); + } + // 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("incidentId", incidentId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListEntities", 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/incidents/{incidentId}/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)); + _url = _url.Replace("{incidentId}", System.Uri.EscapeDataString(incidentId)); + 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 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 incidents. /// diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IncidentsOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IncidentsOperationsExtensions.cs index 0a6828e63fefc..2fd747750d737 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IncidentsOperationsExtensions.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IncidentsOperationsExtensions.cs @@ -28,8 +28,11 @@ public static partial class IncidentsOperationsExtensions /// 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. @@ -49,9 +52,9 @@ public static partial class IncidentsOperationsExtensions /// nextLink element will include a skiptoken parameter that specifies a /// starting point to use for subsequent calls. Optional. /// - public static IPage List(this IIncidentsOperations operations, string resourceGroupName, string workspaceName, string filter = default(string), string orderby = default(string), int? top = default(int?), string skipToken = default(string)) + public static IPage List(this IIncidentsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string filter = default(string), string orderby = default(string), int? top = default(int?), string skipToken = default(string)) { - return operations.ListAsync(resourceGroupName, workspaceName, filter, orderby, top, skipToken).GetAwaiter().GetResult(); + return operations.ListAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, filter, orderby, top, skipToken).GetAwaiter().GetResult(); } /// @@ -61,8 +64,11 @@ public static partial class IncidentsOperationsExtensions /// 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. @@ -85,9 +91,9 @@ public static partial class IncidentsOperationsExtensions /// /// The cancellation token. /// - public static async Task> ListAsync(this IIncidentsOperations operations, string resourceGroupName, string workspaceName, string filter = default(string), string orderby = default(string), int? top = default(int?), string skipToken = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAsync(this IIncidentsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string filter = default(string), string orderby = default(string), int? top = default(int?), string skipToken = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, workspaceName, filter, orderby, top, skipToken, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, filter, orderby, top, skipToken, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -100,8 +106,11 @@ public static partial class IncidentsOperationsExtensions /// 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. @@ -109,9 +118,9 @@ public static partial class IncidentsOperationsExtensions /// /// Incident ID /// - public static Incident Get(this IIncidentsOperations operations, string resourceGroupName, string workspaceName, string incidentId) + public static Incident Get(this IIncidentsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId) { - return operations.GetAsync(resourceGroupName, workspaceName, incidentId).GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, incidentId).GetAwaiter().GetResult(); } /// @@ -121,8 +130,11 @@ public static Incident Get(this IIncidentsOperations 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. @@ -133,9 +145,9 @@ public static Incident Get(this IIncidentsOperations operations, string resource /// /// The cancellation token. /// - public static async Task GetAsync(this IIncidentsOperations operations, string resourceGroupName, string workspaceName, string incidentId, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IIncidentsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, workspaceName, incidentId, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, incidentId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -148,8 +160,11 @@ public static Incident Get(this IIncidentsOperations 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. @@ -160,9 +175,9 @@ public static Incident Get(this IIncidentsOperations operations, string resource /// /// The incident /// - public static Incident CreateOrUpdate(this IIncidentsOperations operations, string resourceGroupName, string workspaceName, string incidentId, Incident incident) + public static Incident CreateOrUpdate(this IIncidentsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, Incident incident) { - return operations.CreateOrUpdateAsync(resourceGroupName, workspaceName, incidentId, incident).GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, incidentId, incident).GetAwaiter().GetResult(); } /// @@ -172,8 +187,11 @@ public static Incident CreateOrUpdate(this IIncidentsOperations 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. @@ -187,9 +205,9 @@ public static Incident CreateOrUpdate(this IIncidentsOperations operations, stri /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IIncidentsOperations operations, string resourceGroupName, string workspaceName, string incidentId, Incident incident, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this IIncidentsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, Incident incident, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, incidentId, incident, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, incidentId, incident, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -202,8 +220,11 @@ public static Incident CreateOrUpdate(this IIncidentsOperations 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. @@ -211,9 +232,9 @@ public static Incident CreateOrUpdate(this IIncidentsOperations operations, stri /// /// Incident ID /// - public static void Delete(this IIncidentsOperations operations, string resourceGroupName, string workspaceName, string incidentId) + public static void Delete(this IIncidentsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId) { - operations.DeleteAsync(resourceGroupName, workspaceName, incidentId).GetAwaiter().GetResult(); + operations.DeleteAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, incidentId).GetAwaiter().GetResult(); } /// @@ -223,8 +244,124 @@ public static void Delete(this IIncidentsOperations 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. + /// + /// + /// Incident ID + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IIncidentsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, incidentId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Creates a Microsoft team to investigate the incident by sharing information + /// and insights between participants. + /// + /// + /// 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. + /// + /// + /// Incident ID + /// + /// + /// Team properties + /// + public static TeamInformation CreateTeam(this IIncidentsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, TeamProperties teamProperties) + { + return operations.CreateTeamAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, incidentId, teamProperties).GetAwaiter().GetResult(); + } + + /// + /// Creates a Microsoft team to investigate the incident by sharing information + /// and insights between participants. + /// + /// + /// 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. + /// + /// + /// Incident ID + /// + /// + /// Team properties + /// + /// + /// The cancellation token. + /// + public static async Task CreateTeamAsync(this IIncidentsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, TeamProperties teamProperties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateTeamWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, incidentId, teamProperties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all incident alerts. + /// + /// + /// 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. + /// + /// + /// Incident ID + /// + public static IncidentAlertList ListAlerts(this IIncidentsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId) + { + return operations.ListAlertsAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, incidentId).GetAwaiter().GetResult(); + } + + /// + /// Gets all incident alerts. + /// + /// + /// 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. @@ -235,9 +372,120 @@ public static void Delete(this IIncidentsOperations operations, string resourceG /// /// The cancellation token. /// - public static async Task DeleteAsync(this IIncidentsOperations operations, string resourceGroupName, string workspaceName, string incidentId, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListAlertsAsync(this IIncidentsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListAlertsWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, incidentId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all incident bookmarks. + /// + /// + /// 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. + /// + /// + /// Incident ID + /// + public static IncidentBookmarkList ListBookmarks(this IIncidentsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId) { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, incidentId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + return operations.ListBookmarksAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, incidentId).GetAwaiter().GetResult(); + } + + /// + /// Gets all incident bookmarks. + /// + /// + /// 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. + /// + /// + /// Incident ID + /// + /// + /// The cancellation token. + /// + public static async Task ListBookmarksAsync(this IIncidentsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBookmarksWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, incidentId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all incident related 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. + /// + /// + /// Incident ID + /// + public static IncidentEntitiesResponse ListEntities(this IIncidentsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId) + { + return operations.ListEntitiesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, incidentId).GetAwaiter().GetResult(); + } + + /// + /// Gets all incident related 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. + /// + /// + /// Incident ID + /// + /// + /// The cancellation token. + /// + public static async Task ListEntitiesAsync(this IIncidentsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string incidentId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListEntitiesWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, incidentId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/MetadataOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/MetadataOperations.cs new file mode 100644 index 0000000000000..b584e11ebf154 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/MetadataOperations.cs @@ -0,0 +1,1535 @@ +// +// 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; + + /// + /// MetadataOperations operations. + /// + internal partial class MetadataOperations : IServiceOperations, IMetadataOperations + { + /// + /// Initializes a new instance of the MetadataOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal MetadataOperations(SecurityInsightsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SecurityInsightsClient + /// + public SecurityInsightsClient Client { get; private set; } + + /// + /// List of all metadata + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Filters the results, based on a Boolean condition. Optional. + /// + /// + /// Sorts the results. Optional. + /// + /// + /// Returns only the first n results. Optional. + /// + /// + /// Used to skip n elements in the OData query (offset). Returns a nextLink to + /// the next page of results if there are any left. + /// + /// + /// 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 filter = default(string), string orderby = default(string), int? top = default(int?), int? skip = default(int?), 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("filter", filter); + tracingParameters.Add("orderby", orderby); + tracingParameters.Add("top", top); + tracingParameters.Add("skip", skip); + 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/metadata").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 (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (orderby != null) + { + _queryParameters.Add(string.Format("$orderby={0}", System.Uri.EscapeDataString(orderby))); + } + if (top != null) + { + _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); + } + if (skip != null) + { + _queryParameters.Add(string.Format("$skip={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(skip, Client.SerializationSettings).Trim('"')))); + } + 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; + } + + /// + /// Get a Metadata. + /// + /// + /// 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 Metadata 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 metadataName, 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 (metadataName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "metadataName"); + } + // 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("metadataName", metadataName); + 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/metadata/{metadataName}").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("{metadataName}", System.Uri.EscapeDataString(metadataName)); + 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; + } + + /// + /// Delete a Metadata. + /// + /// + /// 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 Metadata 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 metadataName, 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 (metadataName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "metadataName"); + } + // 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("metadataName", metadataName); + 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/metadata/{metadataName}").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("{metadataName}", System.Uri.EscapeDataString(metadataName)); + 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; + } + + /// + /// Create a Metadata. + /// + /// + /// 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 Metadata name. + /// + /// + /// Metadata 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> CreateWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string metadataName, MetadataModel metadata, 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 (metadataName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "metadataName"); + } + if (metadata == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "metadata"); + } + if (metadata != null) + { + metadata.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("metadataName", metadataName); + tracingParameters.Add("metadata", metadata); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", 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/metadata/{metadataName}").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("{metadataName}", System.Uri.EscapeDataString(metadataName)); + 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(metadata != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(metadata, 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; + } + + /// + /// Update an existing Metadata. + /// + /// + /// 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 Metadata name. + /// + /// + /// Partial metadata request. + /// + /// + /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string metadataName, MetadataPatch metadataPatch, 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 (metadataName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "metadataName"); + } + if (metadataPatch == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "metadataPatch"); + } + // 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("metadataName", metadataName); + tracingParameters.Add("metadataPatch", metadataPatch); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", 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/metadata/{metadataName}").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("{metadataName}", System.Uri.EscapeDataString(metadataName)); + 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("PATCH"); + _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(metadataPatch != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(metadataPatch, 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; + } + + /// + /// List of all metadata + /// + /// + /// 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/MetadataOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/MetadataOperationsExtensions.cs new file mode 100644 index 0000000000000..52392fc6513e3 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/MetadataOperationsExtensions.cs @@ -0,0 +1,358 @@ +// +// 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 MetadataOperations. + /// + public static partial class MetadataOperationsExtensions + { + /// + /// List of all metadata + /// + /// + /// 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. + /// + /// + /// Filters the results, based on a Boolean condition. Optional. + /// + /// + /// Sorts the results. Optional. + /// + /// + /// Returns only the first n results. Optional. + /// + /// + /// Used to skip n elements in the OData query (offset). Returns a nextLink to + /// the next page of results if there are any left. + /// + public static IPage List(this IMetadataOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string filter = default(string), string orderby = default(string), int? top = default(int?), int? skip = default(int?)) + { + return operations.ListAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, filter, orderby, top, skip).GetAwaiter().GetResult(); + } + + /// + /// List of all metadata + /// + /// + /// 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. + /// + /// + /// Filters the results, based on a Boolean condition. Optional. + /// + /// + /// Sorts the results. Optional. + /// + /// + /// Returns only the first n results. Optional. + /// + /// + /// Used to skip n elements in the OData query (offset). Returns a nextLink to + /// the next page of results if there are any left. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IMetadataOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string filter = default(string), string orderby = default(string), int? top = default(int?), int? skip = default(int?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, filter, orderby, top, skip, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get a Metadata. + /// + /// + /// 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 Metadata name. + /// + public static MetadataModel Get(this IMetadataOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string metadataName) + { + return operations.GetAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, metadataName).GetAwaiter().GetResult(); + } + + /// + /// Get a Metadata. + /// + /// + /// 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 Metadata name. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IMetadataOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string metadataName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, metadataName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a Metadata. + /// + /// + /// 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 Metadata name. + /// + public static void Delete(this IMetadataOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string metadataName) + { + operations.DeleteAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, metadataName).GetAwaiter().GetResult(); + } + + /// + /// Delete a Metadata. + /// + /// + /// 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 Metadata name. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IMetadataOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string metadataName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, metadataName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Create a Metadata. + /// + /// + /// 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 Metadata name. + /// + /// + /// Metadata resource. + /// + public static MetadataModel Create(this IMetadataOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string metadataName, MetadataModel metadata) + { + return operations.CreateAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, metadataName, metadata).GetAwaiter().GetResult(); + } + + /// + /// Create a Metadata. + /// + /// + /// 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 Metadata name. + /// + /// + /// Metadata resource. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IMetadataOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string metadataName, MetadataModel metadata, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, metadataName, metadata, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update an existing Metadata. + /// + /// + /// 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 Metadata name. + /// + /// + /// Partial metadata request. + /// + public static MetadataModel Update(this IMetadataOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string metadataName, MetadataPatch metadataPatch) + { + return operations.UpdateAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, metadataName, metadataPatch).GetAwaiter().GetResult(); + } + + /// + /// Update an existing Metadata. + /// + /// + /// 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 Metadata name. + /// + /// + /// Partial metadata request. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IMetadataOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string metadataName, MetadataPatch metadataPatch, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, metadataName, metadataPatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List of all metadata + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IMetadataOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List of all metadata + /// + /// + /// 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 IMetadataOperations 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/Models/AADCheckRequirements.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AADCheckRequirements.cs new file mode 100644 index 0000000000000..0e22351790dd4 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AADCheckRequirements.cs @@ -0,0 +1,69 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents AAD (Azure Active Directory) requirements check request. + /// + [Newtonsoft.Json.JsonObject("AzureActiveDirectory")] + [Rest.Serialization.JsonTransformation] + public partial class AADCheckRequirements : DataConnectorsCheckRequirements + { + /// + /// Initializes a new instance of the AADCheckRequirements class. + /// + public AADCheckRequirements() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AADCheckRequirements class. + /// + /// The tenant id to connect to, and get the + /// data from. + public AADCheckRequirements(string tenantId) + { + TenantId = tenantId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the tenant id to connect to, and get the data from. + /// + [JsonProperty(PropertyName = "properties.tenantId")] + public string TenantId { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (TenantId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TenantId"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AADDataConnector.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AADDataConnector.cs index d820cf3585077..1502d8f7844fb 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AADDataConnector.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AADDataConnector.cs @@ -33,16 +33,21 @@ public AADDataConnector() /// /// Initializes a new instance of the AADDataConnector class. /// - /// Azure resource Id - /// Azure resource name - /// Azure resource type - /// Etag of the azure resource /// The tenant id to connect to, and get the /// data from. + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Etag of the azure resource /// The available data types for the /// connector. - public AADDataConnector(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), string tenantId = default(string), AlertsDataTypeOfDataConnector dataTypes = default(AlertsDataTypeOfDataConnector)) - : base(id, name, type, etag) + public AADDataConnector(string tenantId, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string), AlertsDataTypeOfDataConnector dataTypes = default(AlertsDataTypeOfDataConnector)) + : base(id, name, type, systemData, etag) { TenantId = tenantId; DataTypes = dataTypes; @@ -66,5 +71,22 @@ public AADDataConnector() [JsonProperty(PropertyName = "properties.dataTypes")] public AlertsDataTypeOfDataConnector DataTypes { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (TenantId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TenantId"); + } + if (DataTypes != null) + { + DataTypes.Validate(); + } + } } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AATPCheckRequirements.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AATPCheckRequirements.cs new file mode 100644 index 0000000000000..8a131fbe25e57 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AATPCheckRequirements.cs @@ -0,0 +1,70 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents AATP (Azure Advanced Threat Protection) requirements check + /// request. + /// + [Newtonsoft.Json.JsonObject("AzureAdvancedThreatProtection")] + [Rest.Serialization.JsonTransformation] + public partial class AATPCheckRequirements : DataConnectorsCheckRequirements + { + /// + /// Initializes a new instance of the AATPCheckRequirements class. + /// + public AATPCheckRequirements() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AATPCheckRequirements class. + /// + /// The tenant id to connect to, and get the + /// data from. + public AATPCheckRequirements(string tenantId) + { + TenantId = tenantId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the tenant id to connect to, and get the data from. + /// + [JsonProperty(PropertyName = "properties.tenantId")] + public string TenantId { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (TenantId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TenantId"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AATPDataConnector.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AATPDataConnector.cs index f9c73a8b99f92..c53d16bdb6163 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AATPDataConnector.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AATPDataConnector.cs @@ -33,16 +33,21 @@ public AATPDataConnector() /// /// Initializes a new instance of the AATPDataConnector class. /// - /// Azure resource Id - /// Azure resource name - /// Azure resource type - /// Etag of the azure resource /// The tenant id to connect to, and get the /// data from. + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Etag of the azure resource /// The available data types for the /// connector. - public AATPDataConnector(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), string tenantId = default(string), AlertsDataTypeOfDataConnector dataTypes = default(AlertsDataTypeOfDataConnector)) - : base(id, name, type, etag) + public AATPDataConnector(string tenantId, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string), AlertsDataTypeOfDataConnector dataTypes = default(AlertsDataTypeOfDataConnector)) + : base(id, name, type, systemData, etag) { TenantId = tenantId; DataTypes = dataTypes; @@ -66,5 +71,22 @@ public AATPDataConnector() [JsonProperty(PropertyName = "properties.dataTypes")] public AlertsDataTypeOfDataConnector DataTypes { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (TenantId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TenantId"); + } + if (DataTypes != null) + { + DataTypes.Validate(); + } + } } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ASCCheckRequirements.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ASCCheckRequirements.cs new file mode 100644 index 0000000000000..167c786fb229c --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ASCCheckRequirements.cs @@ -0,0 +1,57 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents ASC (Azure Security Center) requirements check request. + /// + [Newtonsoft.Json.JsonObject("AzureSecurityCenter")] + [Rest.Serialization.JsonTransformation] + public partial class ASCCheckRequirements : DataConnectorsCheckRequirements + { + /// + /// Initializes a new instance of the ASCCheckRequirements class. + /// + public ASCCheckRequirements() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ASCCheckRequirements class. + /// + /// The subscription id to connect to, and + /// get the data from. + public ASCCheckRequirements(string subscriptionId = default(string)) + { + SubscriptionId = subscriptionId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the subscription id to connect to, and get the data + /// from. + /// + [JsonProperty(PropertyName = "properties.subscriptionId")] + public string SubscriptionId { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ASCDataConnector.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ASCDataConnector.cs index b0885c94718dd..8aa1fbd95fd4b 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ASCDataConnector.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ASCDataConnector.cs @@ -33,16 +33,21 @@ public ASCDataConnector() /// /// Initializes a new instance of the ASCDataConnector class. /// - /// Azure resource Id - /// Azure resource name - /// Azure resource type + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. /// Etag of the azure resource /// The available data types for the /// connector. /// The subscription id to connect to, and /// get the data from. - public ASCDataConnector(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), AlertsDataTypeOfDataConnector dataTypes = default(AlertsDataTypeOfDataConnector), string subscriptionId = default(string)) - : base(id, name, type, etag) + public ASCDataConnector(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string), AlertsDataTypeOfDataConnector dataTypes = default(AlertsDataTypeOfDataConnector), string subscriptionId = default(string)) + : base(id, name, type, systemData, etag) { DataTypes = dataTypes; SubscriptionId = subscriptionId; @@ -67,5 +72,18 @@ public ASCDataConnector() [JsonProperty(PropertyName = "properties.subscriptionId")] public string SubscriptionId { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DataTypes != null) + { + DataTypes.Validate(); + } + } } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AccountEntity.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AccountEntity.cs new file mode 100644 index 0000000000000..677191ef8160c --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AccountEntity.cs @@ -0,0 +1,194 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents an account entity. + /// + [Newtonsoft.Json.JsonObject("Account")] + [Rest.Serialization.JsonTransformation] + public partial class AccountEntity : Entity + { + /// + /// Initializes a new instance of the AccountEntity class. + /// + public AccountEntity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AccountEntity class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// A bag of custom fields that should be + /// part of the entity and will be presented to the user. + /// The graph item display name which is a + /// short humanly readable description of the graph item instance. This + /// property is optional and might be system generated. + /// The Azure Active Directory tenant + /// id. + /// The Azure Active Directory user id. + /// The name of the account. This field + /// should hold only the name without any domain added to it, i.e. + /// administrator. + /// The display name of the account. + /// The Host entity id that contains the + /// account in case it is a local account (not domain joined) + /// Determines whether this is a domain + /// account. + /// The NetBIOS domain name as it appears in the + /// alert format domain\username. Examples: NT AUTHORITY. + /// The objectGUID attribute is a single-value + /// attribute that is the unique identifier for the object, assigned by + /// active directory. + /// The Azure Active Directory Passport User + /// ID. + /// The account security identifier, e.g. + /// S-1-5-18. + /// The user principal name suffix for the + /// account, in some cases it is also the domain name. Examples: + /// contoso.com. + /// The fully qualified domain DNS + /// name. + public AccountEntity(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary additionalData = default(IDictionary), string friendlyName = default(string), string aadTenantId = default(string), string aadUserId = default(string), string accountName = default(string), string displayName = default(string), string hostEntityId = default(string), bool? isDomainJoined = default(bool?), string ntDomain = default(string), System.Guid? objectGuid = default(System.Guid?), string puid = default(string), string sid = default(string), string upnSuffix = default(string), string dnsDomain = default(string)) + : base(id, name, type, systemData) + { + AdditionalData = additionalData; + FriendlyName = friendlyName; + AadTenantId = aadTenantId; + AadUserId = aadUserId; + AccountName = accountName; + DisplayName = displayName; + HostEntityId = hostEntityId; + IsDomainJoined = isDomainJoined; + NtDomain = ntDomain; + ObjectGuid = objectGuid; + Puid = puid; + Sid = sid; + UpnSuffix = upnSuffix; + DnsDomain = dnsDomain; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a bag of custom fields that should be part of the entity and + /// will be presented to the user. + /// + [JsonProperty(PropertyName = "properties.additionalData")] + public IDictionary AdditionalData { get; private set; } + + /// + /// Gets the graph item display name which is a short humanly readable + /// description of the graph item instance. This property is optional + /// and might be system generated. + /// + [JsonProperty(PropertyName = "properties.friendlyName")] + public string FriendlyName { get; private set; } + + /// + /// Gets the Azure Active Directory tenant id. + /// + [JsonProperty(PropertyName = "properties.aadTenantId")] + public string AadTenantId { get; private set; } + + /// + /// Gets the Azure Active Directory user id. + /// + [JsonProperty(PropertyName = "properties.aadUserId")] + public string AadUserId { get; private set; } + + /// + /// Gets the name of the account. This field should hold only the name + /// without any domain added to it, i.e. administrator. + /// + [JsonProperty(PropertyName = "properties.accountName")] + public string AccountName { get; private set; } + + /// + /// Gets the display name of the account. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; private set; } + + /// + /// Gets the Host entity id that contains the account in case it is a + /// local account (not domain joined) + /// + [JsonProperty(PropertyName = "properties.hostEntityId")] + public string HostEntityId { get; private set; } + + /// + /// Gets determines whether this is a domain account. + /// + [JsonProperty(PropertyName = "properties.isDomainJoined")] + public bool? IsDomainJoined { get; private set; } + + /// + /// Gets the NetBIOS domain name as it appears in the alert format + /// domain\username. Examples: NT AUTHORITY. + /// + [JsonProperty(PropertyName = "properties.ntDomain")] + public string NtDomain { get; private set; } + + /// + /// Gets the objectGUID attribute is a single-value attribute that is + /// the unique identifier for the object, assigned by active directory. + /// + [JsonProperty(PropertyName = "properties.objectGuid")] + public System.Guid? ObjectGuid { get; private set; } + + /// + /// Gets the Azure Active Directory Passport User ID. + /// + [JsonProperty(PropertyName = "properties.puid")] + public string Puid { get; private set; } + + /// + /// Gets the account security identifier, e.g. S-1-5-18. + /// + [JsonProperty(PropertyName = "properties.sid")] + public string Sid { get; private set; } + + /// + /// Gets the user principal name suffix for the account, in some cases + /// it is also the domain name. Examples: contoso.com. + /// + [JsonProperty(PropertyName = "properties.upnSuffix")] + public string UpnSuffix { get; private set; } + + /// + /// Gets the fully qualified domain DNS name. + /// + [JsonProperty(PropertyName = "properties.dnsDomain")] + public string DnsDomain { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ActionRequest.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ActionRequest.cs index 248caaf74c61c..c5d5843dc773e 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ActionRequest.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ActionRequest.cs @@ -36,12 +36,17 @@ public ActionRequest() /// /subscriptions/{my-subscription}/resourceGroups/{my-resource-group}/providers/Microsoft.Logic/workflows/{my-workflow-id}. /// Logic App Callback URL for this specific /// workflow. - /// Azure resource Id - /// Azure resource name - /// Azure resource type + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. /// Etag of the azure resource - public ActionRequest(string logicAppResourceId, string triggerUri, string id = default(string), string name = default(string), string type = default(string), string etag = default(string)) - : base(id, name, type, etag) + public ActionRequest(string logicAppResourceId, string triggerUri, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string)) + : base(id, name, type, systemData, etag) { LogicAppResourceId = logicAppResourceId; TriggerUri = triggerUri; diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ActionResponse.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ActionResponse.cs index 79f56df2404ec..b51e400611b3e 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ActionResponse.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ActionResponse.cs @@ -19,7 +19,7 @@ namespace Microsoft.Azure.Management.SecurityInsights.Models /// Action for alert rule. /// [Rest.Serialization.JsonTransformation] - public partial class ActionResponse : Resource + public partial class ActionResponse : ResourceWithEtag { /// /// Initializes a new instance of the ActionResponse class. @@ -34,16 +34,20 @@ public ActionResponse() /// /// Logic App Resource Id, /// /subscriptions/{my-subscription}/resourceGroups/{my-resource-group}/providers/Microsoft.Logic/workflows/{my-workflow-id}. - /// Azure resource Id - /// Azure resource name - /// Azure resource type - /// Etag of the action. + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Etag of the azure resource /// The name of the logic app's /// workflow. - public ActionResponse(string logicAppResourceId, string id = default(string), string name = default(string), string type = default(string), string etag = default(string), string workflowId = default(string)) - : base(id, name, type) + public ActionResponse(string logicAppResourceId, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string), string workflowId = default(string)) + : base(id, name, type, systemData, etag) { - Etag = etag; LogicAppResourceId = logicAppResourceId; WorkflowId = workflowId; CustomInit(); @@ -54,12 +58,6 @@ public ActionResponse() /// partial void CustomInit(); - /// - /// Gets or sets etag of the action. - /// - [JsonProperty(PropertyName = "etag")] - public string Etag { get; set; } - /// /// Gets or sets logic App Resource Id, /// /subscriptions/{my-subscription}/resourceGroups/{my-resource-group}/providers/Microsoft.Logic/workflows/{my-workflow-id}. diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ActivityCustomEntityQuery.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ActivityCustomEntityQuery.cs new file mode 100644 index 0000000000000..90d755c939504 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ActivityCustomEntityQuery.cs @@ -0,0 +1,169 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents Activity entity query. + /// + [Newtonsoft.Json.JsonObject("Activity")] + [Rest.Serialization.JsonTransformation] + public partial class ActivityCustomEntityQuery : CustomEntityQuery + { + /// + /// Initializes a new instance of the ActivityCustomEntityQuery class. + /// + public ActivityCustomEntityQuery() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ActivityCustomEntityQuery class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Etag of the azure resource + /// The entity query title + /// The entity query content to display in + /// timeline + /// The entity query description + /// The Activity query + /// definitions + /// The type of the query's source + /// entity. Possible values include: 'Account', 'Host', 'File', + /// 'AzureResource', 'CloudApplication', 'DNS', 'FileHash', 'IP', + /// 'Malware', 'Process', 'RegistryKey', 'RegistryValue', + /// 'SecurityGroup', 'URL', 'IoTDevice', 'SecurityAlert', + /// 'HuntingBookmark', 'MailCluster', 'MailMessage', 'Mailbox', + /// 'SubmissionMail' + /// List of the fields of the + /// source entity that are required to run the query + /// The query applied only to entities + /// matching to all filters + /// The template id this activity was + /// created from + /// Determines whether this activity is enabled + /// or disabled. + /// The time the activity was + /// created + /// The last time the activity was + /// updated + public ActivityCustomEntityQuery(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string), string title = default(string), string content = default(string), string description = default(string), ActivityEntityQueriesPropertiesQueryDefinitions queryDefinitions = default(ActivityEntityQueriesPropertiesQueryDefinitions), string inputEntityType = default(string), IList> requiredInputFieldsSets = default(IList>), IDictionary> entitiesFilter = default(IDictionary>), string templateName = default(string), bool? enabled = default(bool?), System.DateTime? createdTimeUtc = default(System.DateTime?), System.DateTime? lastModifiedTimeUtc = default(System.DateTime?)) + : base(id, name, type, systemData, etag) + { + Title = title; + Content = content; + Description = description; + QueryDefinitions = queryDefinitions; + InputEntityType = inputEntityType; + RequiredInputFieldsSets = requiredInputFieldsSets; + EntitiesFilter = entitiesFilter; + TemplateName = templateName; + Enabled = enabled; + CreatedTimeUtc = createdTimeUtc; + LastModifiedTimeUtc = lastModifiedTimeUtc; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the entity query title + /// + [JsonProperty(PropertyName = "properties.title")] + public string Title { get; set; } + + /// + /// Gets or sets the entity query content to display in timeline + /// + [JsonProperty(PropertyName = "properties.content")] + public string Content { get; set; } + + /// + /// Gets or sets the entity query description + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the Activity query definitions + /// + [JsonProperty(PropertyName = "properties.queryDefinitions")] + public ActivityEntityQueriesPropertiesQueryDefinitions QueryDefinitions { get; set; } + + /// + /// Gets or sets the type of the query's source entity. Possible values + /// include: 'Account', 'Host', 'File', 'AzureResource', + /// 'CloudApplication', 'DNS', 'FileHash', 'IP', 'Malware', 'Process', + /// 'RegistryKey', 'RegistryValue', 'SecurityGroup', 'URL', + /// 'IoTDevice', 'SecurityAlert', 'HuntingBookmark', 'MailCluster', + /// 'MailMessage', 'Mailbox', 'SubmissionMail' + /// + [JsonProperty(PropertyName = "properties.inputEntityType")] + public string InputEntityType { get; set; } + + /// + /// Gets or sets list of the fields of the source entity that are + /// required to run the query + /// + [JsonProperty(PropertyName = "properties.requiredInputFieldsSets")] + public IList> RequiredInputFieldsSets { get; set; } + + /// + /// Gets or sets the query applied only to entities matching to all + /// filters + /// + [JsonProperty(PropertyName = "properties.entitiesFilter")] + public IDictionary> EntitiesFilter { get; set; } + + /// + /// Gets or sets the template id this activity was created from + /// + [JsonProperty(PropertyName = "properties.templateName")] + public string TemplateName { get; set; } + + /// + /// Gets or sets determines whether this activity is enabled or + /// disabled. + /// + [JsonProperty(PropertyName = "properties.enabled")] + public bool? Enabled { get; set; } + + /// + /// Gets the time the activity was created + /// + [JsonProperty(PropertyName = "properties.createdTimeUtc")] + public System.DateTime? CreatedTimeUtc { get; private set; } + + /// + /// Gets the last time the activity was updated + /// + [JsonProperty(PropertyName = "properties.lastModifiedTimeUtc")] + public System.DateTime? LastModifiedTimeUtc { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ActivityEntityQueriesPropertiesQueryDefinitions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ActivityEntityQueriesPropertiesQueryDefinitions.cs new file mode 100644 index 0000000000000..9bd9189eb86e3 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ActivityEntityQueriesPropertiesQueryDefinitions.cs @@ -0,0 +1,54 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The Activity query definitions + /// + public partial class ActivityEntityQueriesPropertiesQueryDefinitions + { + /// + /// Initializes a new instance of the + /// ActivityEntityQueriesPropertiesQueryDefinitions class. + /// + public ActivityEntityQueriesPropertiesQueryDefinitions() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ActivityEntityQueriesPropertiesQueryDefinitions class. + /// + /// The Activity query to run on a given + /// entity + public ActivityEntityQueriesPropertiesQueryDefinitions(string query = default(string)) + { + Query = query; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Activity query to run on a given entity + /// + [JsonProperty(PropertyName = "query")] + public string Query { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ActivityEntityQuery.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ActivityEntityQuery.cs new file mode 100644 index 0000000000000..de83406d7424e --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ActivityEntityQuery.cs @@ -0,0 +1,169 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents Activity entity query. + /// + [Newtonsoft.Json.JsonObject("Activity")] + [Rest.Serialization.JsonTransformation] + public partial class ActivityEntityQuery : EntityQuery + { + /// + /// Initializes a new instance of the ActivityEntityQuery class. + /// + public ActivityEntityQuery() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ActivityEntityQuery class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Etag of the azure resource + /// The entity query title + /// The entity query content to display in + /// timeline + /// The entity query description + /// The Activity query + /// definitions + /// The type of the query's source + /// entity. Possible values include: 'Account', 'Host', 'File', + /// 'AzureResource', 'CloudApplication', 'DNS', 'FileHash', 'IP', + /// 'Malware', 'Process', 'RegistryKey', 'RegistryValue', + /// 'SecurityGroup', 'URL', 'IoTDevice', 'SecurityAlert', + /// 'HuntingBookmark', 'MailCluster', 'MailMessage', 'Mailbox', + /// 'SubmissionMail' + /// List of the fields of the + /// source entity that are required to run the query + /// The query applied only to entities + /// matching to all filters + /// The template id this activity was + /// created from + /// Determines whether this activity is enabled + /// or disabled. + /// The time the activity was + /// created + /// The last time the activity was + /// updated + public ActivityEntityQuery(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string), string title = default(string), string content = default(string), string description = default(string), ActivityEntityQueriesPropertiesQueryDefinitions queryDefinitions = default(ActivityEntityQueriesPropertiesQueryDefinitions), string inputEntityType = default(string), IList> requiredInputFieldsSets = default(IList>), IDictionary> entitiesFilter = default(IDictionary>), string templateName = default(string), bool? enabled = default(bool?), System.DateTime? createdTimeUtc = default(System.DateTime?), System.DateTime? lastModifiedTimeUtc = default(System.DateTime?)) + : base(id, name, type, systemData, etag) + { + Title = title; + Content = content; + Description = description; + QueryDefinitions = queryDefinitions; + InputEntityType = inputEntityType; + RequiredInputFieldsSets = requiredInputFieldsSets; + EntitiesFilter = entitiesFilter; + TemplateName = templateName; + Enabled = enabled; + CreatedTimeUtc = createdTimeUtc; + LastModifiedTimeUtc = lastModifiedTimeUtc; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the entity query title + /// + [JsonProperty(PropertyName = "properties.title")] + public string Title { get; set; } + + /// + /// Gets or sets the entity query content to display in timeline + /// + [JsonProperty(PropertyName = "properties.content")] + public string Content { get; set; } + + /// + /// Gets or sets the entity query description + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the Activity query definitions + /// + [JsonProperty(PropertyName = "properties.queryDefinitions")] + public ActivityEntityQueriesPropertiesQueryDefinitions QueryDefinitions { get; set; } + + /// + /// Gets or sets the type of the query's source entity. Possible values + /// include: 'Account', 'Host', 'File', 'AzureResource', + /// 'CloudApplication', 'DNS', 'FileHash', 'IP', 'Malware', 'Process', + /// 'RegistryKey', 'RegistryValue', 'SecurityGroup', 'URL', + /// 'IoTDevice', 'SecurityAlert', 'HuntingBookmark', 'MailCluster', + /// 'MailMessage', 'Mailbox', 'SubmissionMail' + /// + [JsonProperty(PropertyName = "properties.inputEntityType")] + public string InputEntityType { get; set; } + + /// + /// Gets or sets list of the fields of the source entity that are + /// required to run the query + /// + [JsonProperty(PropertyName = "properties.requiredInputFieldsSets")] + public IList> RequiredInputFieldsSets { get; set; } + + /// + /// Gets or sets the query applied only to entities matching to all + /// filters + /// + [JsonProperty(PropertyName = "properties.entitiesFilter")] + public IDictionary> EntitiesFilter { get; set; } + + /// + /// Gets or sets the template id this activity was created from + /// + [JsonProperty(PropertyName = "properties.templateName")] + public string TemplateName { get; set; } + + /// + /// Gets or sets determines whether this activity is enabled or + /// disabled. + /// + [JsonProperty(PropertyName = "properties.enabled")] + public bool? Enabled { get; set; } + + /// + /// Gets the time the activity was created + /// + [JsonProperty(PropertyName = "properties.createdTimeUtc")] + public System.DateTime? CreatedTimeUtc { get; private set; } + + /// + /// Gets the last time the activity was updated + /// + [JsonProperty(PropertyName = "properties.lastModifiedTimeUtc")] + public System.DateTime? LastModifiedTimeUtc { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ActivityEntityQueryTemplate.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ActivityEntityQueryTemplate.cs new file mode 100644 index 0000000000000..5c153c6a3c062 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ActivityEntityQueryTemplate.cs @@ -0,0 +1,143 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents Activity entity query. + /// + [Newtonsoft.Json.JsonObject("Activity")] + [Rest.Serialization.JsonTransformation] + public partial class ActivityEntityQueryTemplate : EntityQueryTemplate + { + /// + /// Initializes a new instance of the ActivityEntityQueryTemplate + /// class. + /// + public ActivityEntityQueryTemplate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ActivityEntityQueryTemplate + /// class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// The entity query title + /// The entity query content to display in + /// timeline + /// The entity query description + /// The Activity query + /// definitions + /// List of required data types for the given + /// entity query template + /// The type of the query's source + /// entity. Possible values include: 'Account', 'Host', 'File', + /// 'AzureResource', 'CloudApplication', 'DNS', 'FileHash', 'IP', + /// 'Malware', 'Process', 'RegistryKey', 'RegistryValue', + /// 'SecurityGroup', 'URL', 'IoTDevice', 'SecurityAlert', + /// 'HuntingBookmark', 'MailCluster', 'MailMessage', 'Mailbox', + /// 'SubmissionMail' + /// List of the fields of the + /// source entity that are required to run the query + /// The query applied only to entities + /// matching to all filters + public ActivityEntityQueryTemplate(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string title = default(string), string content = default(string), string description = default(string), ActivityEntityQueryTemplatePropertiesQueryDefinitions queryDefinitions = default(ActivityEntityQueryTemplatePropertiesQueryDefinitions), IList dataTypes = default(IList), string inputEntityType = default(string), IList> requiredInputFieldsSets = default(IList>), IDictionary> entitiesFilter = default(IDictionary>)) + : base(id, name, type, systemData) + { + Title = title; + Content = content; + Description = description; + QueryDefinitions = queryDefinitions; + DataTypes = dataTypes; + InputEntityType = inputEntityType; + RequiredInputFieldsSets = requiredInputFieldsSets; + EntitiesFilter = entitiesFilter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the entity query title + /// + [JsonProperty(PropertyName = "properties.title")] + public string Title { get; set; } + + /// + /// Gets or sets the entity query content to display in timeline + /// + [JsonProperty(PropertyName = "properties.content")] + public string Content { get; set; } + + /// + /// Gets or sets the entity query description + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the Activity query definitions + /// + [JsonProperty(PropertyName = "properties.queryDefinitions")] + public ActivityEntityQueryTemplatePropertiesQueryDefinitions QueryDefinitions { get; set; } + + /// + /// Gets or sets list of required data types for the given entity query + /// template + /// + [JsonProperty(PropertyName = "properties.dataTypes")] + public IList DataTypes { get; set; } + + /// + /// Gets or sets the type of the query's source entity. Possible values + /// include: 'Account', 'Host', 'File', 'AzureResource', + /// 'CloudApplication', 'DNS', 'FileHash', 'IP', 'Malware', 'Process', + /// 'RegistryKey', 'RegistryValue', 'SecurityGroup', 'URL', + /// 'IoTDevice', 'SecurityAlert', 'HuntingBookmark', 'MailCluster', + /// 'MailMessage', 'Mailbox', 'SubmissionMail' + /// + [JsonProperty(PropertyName = "properties.inputEntityType")] + public string InputEntityType { get; set; } + + /// + /// Gets or sets list of the fields of the source entity that are + /// required to run the query + /// + [JsonProperty(PropertyName = "properties.requiredInputFieldsSets")] + public IList> RequiredInputFieldsSets { get; set; } + + /// + /// Gets or sets the query applied only to entities matching to all + /// filters + /// + [JsonProperty(PropertyName = "properties.entitiesFilter")] + public IDictionary> EntitiesFilter { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ActivityEntityQueryTemplatePropertiesQueryDefinitions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ActivityEntityQueryTemplatePropertiesQueryDefinitions.cs new file mode 100644 index 0000000000000..d4837740813d8 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ActivityEntityQueryTemplatePropertiesQueryDefinitions.cs @@ -0,0 +1,64 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The Activity query definitions + /// + public partial class ActivityEntityQueryTemplatePropertiesQueryDefinitions + { + /// + /// Initializes a new instance of the + /// ActivityEntityQueryTemplatePropertiesQueryDefinitions class. + /// + public ActivityEntityQueryTemplatePropertiesQueryDefinitions() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ActivityEntityQueryTemplatePropertiesQueryDefinitions class. + /// + /// The Activity query to run on a given + /// entity + /// The dimensions we want to summarize the + /// timeline results on, this is comma separated list + public ActivityEntityQueryTemplatePropertiesQueryDefinitions(string query = default(string), string summarizeBy = default(string)) + { + Query = query; + SummarizeBy = summarizeBy; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Activity query to run on a given entity + /// + [JsonProperty(PropertyName = "query")] + public string Query { get; set; } + + /// + /// Gets or sets the dimensions we want to summarize the timeline + /// results on, this is comma separated list + /// + [JsonProperty(PropertyName = "summarizeBy")] + public string SummarizeBy { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ActivityTimelineItem.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ActivityTimelineItem.cs new file mode 100644 index 0000000000000..a894fde412f09 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ActivityTimelineItem.cs @@ -0,0 +1,126 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents Activity timeline item. + /// + [Newtonsoft.Json.JsonObject("Activity")] + public partial class ActivityTimelineItem : EntityTimelineItem + { + /// + /// Initializes a new instance of the ActivityTimelineItem class. + /// + public ActivityTimelineItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ActivityTimelineItem class. + /// + /// The activity query id. + /// The grouping bucket start + /// time. + /// The grouping bucket end + /// time. + /// The time of the first activity + /// in the grouping bucket. + /// The time of the last activity in + /// the grouping bucket. + /// The activity timeline content. + /// The activity timeline title. + public ActivityTimelineItem(string queryId, System.DateTime bucketStartTimeUTC, System.DateTime bucketEndTimeUTC, System.DateTime firstActivityTimeUTC, System.DateTime lastActivityTimeUTC, string content, string title) + { + QueryId = queryId; + BucketStartTimeUTC = bucketStartTimeUTC; + BucketEndTimeUTC = bucketEndTimeUTC; + FirstActivityTimeUTC = firstActivityTimeUTC; + LastActivityTimeUTC = lastActivityTimeUTC; + Content = content; + Title = title; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the activity query id. + /// + [JsonProperty(PropertyName = "queryId")] + public string QueryId { get; set; } + + /// + /// Gets or sets the grouping bucket start time. + /// + [JsonProperty(PropertyName = "bucketStartTimeUTC")] + public System.DateTime BucketStartTimeUTC { get; set; } + + /// + /// Gets or sets the grouping bucket end time. + /// + [JsonProperty(PropertyName = "bucketEndTimeUTC")] + public System.DateTime BucketEndTimeUTC { get; set; } + + /// + /// Gets or sets the time of the first activity in the grouping bucket. + /// + [JsonProperty(PropertyName = "firstActivityTimeUTC")] + public System.DateTime FirstActivityTimeUTC { get; set; } + + /// + /// Gets or sets the time of the last activity in the grouping bucket. + /// + [JsonProperty(PropertyName = "lastActivityTimeUTC")] + public System.DateTime LastActivityTimeUTC { get; set; } + + /// + /// Gets or sets the activity timeline content. + /// + [JsonProperty(PropertyName = "content")] + public string Content { get; set; } + + /// + /// Gets or sets the activity timeline title. + /// + [JsonProperty(PropertyName = "title")] + public string Title { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (QueryId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "QueryId"); + } + if (Content == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Content"); + } + if (Title == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Title"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertDetail.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertDetail.cs new file mode 100644 index 0000000000000..efe902f999719 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertDetail.cs @@ -0,0 +1,28 @@ +// +// 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.Models +{ + + /// + /// Defines values for AlertDetail. + /// + public static class AlertDetail + { + /// + /// Alert display name + /// + public const string DisplayName = "DisplayName"; + /// + /// Alert severity + /// + public const string Severity = "Severity"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertDetailsOverride.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertDetailsOverride.cs new file mode 100644 index 0000000000000..e42ab0f0cbe02 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertDetailsOverride.cs @@ -0,0 +1,81 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Settings for how to dynamically override alert static details + /// + public partial class AlertDetailsOverride + { + /// + /// Initializes a new instance of the AlertDetailsOverride class. + /// + public AlertDetailsOverride() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AlertDetailsOverride class. + /// + /// the format containing columns + /// name(s) to override the alert name + /// the format containing columns + /// name(s) to override the alert description + /// the column name to take the + /// alert tactics from + /// the column name to take the + /// alert severity from + public AlertDetailsOverride(string alertDisplayNameFormat = default(string), string alertDescriptionFormat = default(string), string alertTacticsColumnName = default(string), string alertSeverityColumnName = default(string)) + { + AlertDisplayNameFormat = alertDisplayNameFormat; + AlertDescriptionFormat = alertDescriptionFormat; + AlertTacticsColumnName = alertTacticsColumnName; + AlertSeverityColumnName = alertSeverityColumnName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the format containing columns name(s) to override the + /// alert name + /// + [JsonProperty(PropertyName = "alertDisplayNameFormat")] + public string AlertDisplayNameFormat { get; set; } + + /// + /// Gets or sets the format containing columns name(s) to override the + /// alert description + /// + [JsonProperty(PropertyName = "alertDescriptionFormat")] + public string AlertDescriptionFormat { get; set; } + + /// + /// Gets or sets the column name to take the alert tactics from + /// + [JsonProperty(PropertyName = "alertTacticsColumnName")] + public string AlertTacticsColumnName { get; set; } + + /// + /// Gets or sets the column name to take the alert severity from + /// + [JsonProperty(PropertyName = "alertSeverityColumnName")] + public string AlertSeverityColumnName { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertRule.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertRule.cs index 66598dd902927..a3f1fddbbe604 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertRule.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertRule.cs @@ -28,12 +28,17 @@ public AlertRule() /// /// Initializes a new instance of the AlertRule class. /// - /// Azure resource Id - /// Azure resource name - /// Azure resource type + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. /// Etag of the azure resource - public AlertRule(string id = default(string), string name = default(string), string type = default(string), string etag = default(string)) - : base(id, name, type, etag) + public AlertRule(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string)) + : base(id, name, type, systemData, etag) { CustomInit(); } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertRuleKind.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertRuleKind.cs index f5b94178a49b0..f097dcd281896 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertRuleKind.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertRuleKind.cs @@ -19,5 +19,8 @@ public static class AlertRuleKind public const string Scheduled = "Scheduled"; public const string MicrosoftSecurityIncidentCreation = "MicrosoftSecurityIncidentCreation"; public const string Fusion = "Fusion"; + public const string MLBehaviorAnalytics = "MLBehaviorAnalytics"; + public const string ThreatIntelligence = "ThreatIntelligence"; + public const string NRT = "NRT"; } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertRuleTemplate.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertRuleTemplate.cs index 5fd7734c55bcf..3a48612c9419f 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertRuleTemplate.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertRuleTemplate.cs @@ -28,11 +28,16 @@ public AlertRuleTemplate() /// /// Initializes a new instance of the AlertRuleTemplate class. /// - /// Azure resource Id - /// Azure resource name - /// Azure resource type - public AlertRuleTemplate(string id = default(string), string name = default(string), string type = default(string)) - : base(id, name, type) + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + public AlertRuleTemplate(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData)) + : base(id, name, type, systemData) { CustomInit(); } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertRuleTemplatePropertiesBase.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertRuleTemplatePropertiesBase.cs new file mode 100644 index 0000000000000..037b1d2d4a485 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertRuleTemplatePropertiesBase.cs @@ -0,0 +1,112 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Base alert rule template property bag. + /// + public partial class AlertRuleTemplatePropertiesBase + { + /// + /// Initializes a new instance of the AlertRuleTemplatePropertiesBase + /// class. + /// + public AlertRuleTemplatePropertiesBase() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AlertRuleTemplatePropertiesBase + /// class. + /// + /// the number of alert + /// rules that were created by this template + /// The last time that this alert rule + /// template has been updated. + /// The time that this alert rule template + /// has been added. + /// The description of the alert rule + /// template. + /// The display name for alert rule + /// template. + /// The required data sources for + /// this template + /// The alert rule template status. Possible + /// values include: 'Installed', 'Available', 'NotAvailable' + public AlertRuleTemplatePropertiesBase(int? alertRulesCreatedByTemplateCount = default(int?), System.DateTime? lastUpdatedDateUTC = default(System.DateTime?), System.DateTime? createdDateUTC = default(System.DateTime?), string description = default(string), string displayName = default(string), IList requiredDataConnectors = default(IList), string status = default(string)) + { + AlertRulesCreatedByTemplateCount = alertRulesCreatedByTemplateCount; + LastUpdatedDateUTC = lastUpdatedDateUTC; + CreatedDateUTC = createdDateUTC; + Description = description; + DisplayName = displayName; + RequiredDataConnectors = requiredDataConnectors; + Status = status; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the number of alert rules that were created by this + /// template + /// + [JsonProperty(PropertyName = "alertRulesCreatedByTemplateCount")] + public int? AlertRulesCreatedByTemplateCount { get; set; } + + /// + /// Gets the last time that this alert rule template has been updated. + /// + [JsonProperty(PropertyName = "lastUpdatedDateUTC")] + public System.DateTime? LastUpdatedDateUTC { get; private set; } + + /// + /// Gets the time that this alert rule template has been added. + /// + [JsonProperty(PropertyName = "createdDateUTC")] + public System.DateTime? CreatedDateUTC { get; private set; } + + /// + /// Gets or sets the description of the alert rule template. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets the display name for alert rule template. + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets the required data sources for this template + /// + [JsonProperty(PropertyName = "requiredDataConnectors")] + public IList RequiredDataConnectors { get; set; } + + /// + /// Gets or sets the alert rule template status. Possible values + /// include: 'Installed', 'Available', 'NotAvailable' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertStatus.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertStatus.cs new file mode 100644 index 0000000000000..adad0750947c9 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertStatus.cs @@ -0,0 +1,40 @@ +// +// 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.Models +{ + + /// + /// Defines values for AlertStatus. + /// + public static class AlertStatus + { + /// + /// Unknown value + /// + public const string Unknown = "Unknown"; + /// + /// New alert + /// + public const string New = "New"; + /// + /// Alert closed after handling + /// + public const string Resolved = "Resolved"; + /// + /// Alert dismissed as false positive + /// + public const string Dismissed = "Dismissed"; + /// + /// Alert is being handled + /// + public const string InProgress = "InProgress"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertsDataTypeOfDataConnector.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertsDataTypeOfDataConnector.cs index 3a96fcd1dfe5d..3e047c992b321 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertsDataTypeOfDataConnector.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertsDataTypeOfDataConnector.cs @@ -10,6 +10,7 @@ namespace Microsoft.Azure.Management.SecurityInsights.Models { + using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -32,7 +33,7 @@ public AlertsDataTypeOfDataConnector() /// class. /// /// Alerts data type connection. - public AlertsDataTypeOfDataConnector(DataConnectorDataTypeCommon alerts = default(DataConnectorDataTypeCommon)) + public AlertsDataTypeOfDataConnector(DataConnectorDataTypeCommon alerts) { Alerts = alerts; CustomInit(); @@ -49,5 +50,22 @@ public AlertsDataTypeOfDataConnector() [JsonProperty(PropertyName = "alerts")] public DataConnectorDataTypeCommon Alerts { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Alerts == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Alerts"); + } + if (Alerts != null) + { + Alerts.Validate(); + } + } } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Anomalies.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Anomalies.cs new file mode 100644 index 0000000000000..f59c61d4e96c1 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Anomalies.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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Settings with single toggle. + /// + [Rest.Serialization.JsonTransformation] + public partial class Anomalies : Settings + { + /// + /// Initializes a new instance of the Anomalies class. + /// + public Anomalies() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Anomalies class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Etag of the azure resource + /// Determines whether the setting is enable or + /// disabled. + public Anomalies(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string), bool? isEnabled = default(bool?)) + : base(id, name, type, systemData, etag) + { + IsEnabled = isEnabled; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets determines whether the setting is enable or disabled. + /// + [JsonProperty(PropertyName = "properties.isEnabled")] + public bool? IsEnabled { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AntispamMailDirection.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AntispamMailDirection.cs new file mode 100644 index 0000000000000..ec3b3453953b9 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AntispamMailDirection.cs @@ -0,0 +1,36 @@ +// +// 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.Models +{ + + /// + /// Defines values for AntispamMailDirection. + /// + public static class AntispamMailDirection + { + /// + /// Unknown + /// + public const string Unknown = "Unknown"; + /// + /// Inbound + /// + public const string Inbound = "Inbound"; + /// + /// Outbound + /// + public const string Outbound = "Outbound"; + /// + /// Intraorg + /// + public const string Intraorg = "Intraorg"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AttackTactic.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AttackTactic.cs index 69da962ffc7a1..c796fa0bef63c 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AttackTactic.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AttackTactic.cs @@ -28,5 +28,6 @@ public static class AttackTactic public const string Exfiltration = "Exfiltration"; public const string CommandAndControl = "CommandAndControl"; public const string Impact = "Impact"; + public const string PreAttack = "PreAttack"; } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AutomationRule.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AutomationRule.cs new file mode 100644 index 0000000000000..0c470d5ad24fc --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AutomationRule.cs @@ -0,0 +1,167 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents an automation rule. + /// + [Rest.Serialization.JsonTransformation] + public partial class AutomationRule : ResourceWithEtag + { + /// + /// Initializes a new instance of the AutomationRule class. + /// + public AutomationRule() + { + TriggeringLogic = new AutomationRuleTriggeringLogic(); + CustomInit(); + } + + /// + /// Initializes a new instance of the AutomationRule class. + /// + /// The display name of the automation + /// rule + /// The order of execution of the automation + /// rule + /// The triggering logic of the + /// automation rule + /// The actions to execute when the automation + /// rule is triggered + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Etag of the azure resource + /// The time the automation rule was + /// created + /// The last time the automation rule + /// was updated + /// Describes the client that created the + /// automation rule + /// Describes the client that last updated + /// the automation rule + public AutomationRule(string displayName, int order, AutomationRuleTriggeringLogic triggeringLogic, IList actions, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string), System.DateTime? createdTimeUtc = default(System.DateTime?), System.DateTime? lastModifiedTimeUtc = default(System.DateTime?), ClientInfo createdBy = default(ClientInfo), ClientInfo lastModifiedBy = default(ClientInfo)) + : base(id, name, type, systemData, etag) + { + DisplayName = displayName; + Order = order; + TriggeringLogic = triggeringLogic; + Actions = actions; + CreatedTimeUtc = createdTimeUtc; + LastModifiedTimeUtc = lastModifiedTimeUtc; + CreatedBy = createdBy; + LastModifiedBy = lastModifiedBy; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the display name of the automation rule + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets the order of execution of the automation rule + /// + [JsonProperty(PropertyName = "properties.order")] + public int Order { get; set; } + + /// + /// Gets or sets the triggering logic of the automation rule + /// + [JsonProperty(PropertyName = "properties.triggeringLogic")] + public AutomationRuleTriggeringLogic TriggeringLogic { get; set; } + + /// + /// Gets or sets the actions to execute when the automation rule is + /// triggered + /// + [JsonProperty(PropertyName = "properties.actions")] + public IList Actions { get; set; } + + /// + /// Gets the time the automation rule was created + /// + [JsonProperty(PropertyName = "properties.createdTimeUtc")] + public System.DateTime? CreatedTimeUtc { get; private set; } + + /// + /// Gets the last time the automation rule was updated + /// + [JsonProperty(PropertyName = "properties.lastModifiedTimeUtc")] + public System.DateTime? LastModifiedTimeUtc { get; private set; } + + /// + /// Gets describes the client that created the automation rule + /// + [JsonProperty(PropertyName = "properties.createdBy")] + public ClientInfo CreatedBy { get; private set; } + + /// + /// Gets describes the client that last updated the automation rule + /// + [JsonProperty(PropertyName = "properties.lastModifiedBy")] + public ClientInfo LastModifiedBy { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DisplayName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DisplayName"); + } + if (TriggeringLogic == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TriggeringLogic"); + } + if (Actions == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Actions"); + } + if (TriggeringLogic != null) + { + TriggeringLogic.Validate(); + } + if (Actions != null) + { + foreach (var element in Actions) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AutomationRuleAction.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AutomationRuleAction.cs new file mode 100644 index 0000000000000..e1fbcd0306ffe --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AutomationRuleAction.cs @@ -0,0 +1,62 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes an automation rule action + /// + public partial class AutomationRuleAction + { + /// + /// Initializes a new instance of the AutomationRuleAction class. + /// + public AutomationRuleAction() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AutomationRuleAction class. + /// + /// The order of execution of the automation rule + /// action + public AutomationRuleAction(int order) + { + Order = order; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the order of execution of the automation rule action + /// + [JsonProperty(PropertyName = "order")] + public int Order { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + //Nothing to validate + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AutomationRuleCondition.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AutomationRuleCondition.cs new file mode 100644 index 0000000000000..3647e487416a3 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AutomationRuleCondition.cs @@ -0,0 +1,35 @@ +// +// 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.Models +{ + using System.Linq; + + /// + /// Describes an automation rule condition + /// + public partial class AutomationRuleCondition + { + /// + /// Initializes a new instance of the AutomationRuleCondition class. + /// + public AutomationRuleCondition() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AutomationRuleModifyPropertiesAction.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AutomationRuleModifyPropertiesAction.cs new file mode 100644 index 0000000000000..eb45d31b32446 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AutomationRuleModifyPropertiesAction.cs @@ -0,0 +1,74 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes an automation rule action to modify an object's properties + /// + [Newtonsoft.Json.JsonObject("ModifyProperties")] + public partial class AutomationRuleModifyPropertiesAction : AutomationRuleAction + { + /// + /// Initializes a new instance of the + /// AutomationRuleModifyPropertiesAction class. + /// + public AutomationRuleModifyPropertiesAction() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// AutomationRuleModifyPropertiesAction class. + /// + /// The order of execution of the automation rule + /// action + /// The configuration of the modify + /// properties automation rule action + public AutomationRuleModifyPropertiesAction(int order, AutomationRuleModifyPropertiesActionActionConfiguration actionConfiguration) + : base(order) + { + ActionConfiguration = actionConfiguration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the configuration of the modify properties automation + /// rule action + /// + [JsonProperty(PropertyName = "actionConfiguration")] + public AutomationRuleModifyPropertiesActionActionConfiguration ActionConfiguration { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (ActionConfiguration == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ActionConfiguration"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AutomationRuleModifyPropertiesActionActionConfiguration.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AutomationRuleModifyPropertiesActionActionConfiguration.cs new file mode 100644 index 0000000000000..19b1f7c475354 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AutomationRuleModifyPropertiesActionActionConfiguration.cs @@ -0,0 +1,118 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The configuration of the modify properties automation rule action + /// + public partial class AutomationRuleModifyPropertiesActionActionConfiguration + { + /// + /// Initializes a new instance of the + /// AutomationRuleModifyPropertiesActionActionConfiguration class. + /// + public AutomationRuleModifyPropertiesActionActionConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// AutomationRuleModifyPropertiesActionActionConfiguration class. + /// + /// The reason the incident was closed. + /// Possible values include: 'Undetermined', 'TruePositive', + /// 'BenignPositive', 'FalsePositive' + /// Describes the reason the + /// incident was closed + /// The classification reason the + /// incident was closed with. Possible values include: + /// 'SuspiciousActivity', 'SuspiciousButExpected', + /// 'IncorrectAlertLogic', 'InaccurateData' + /// List of labels to add to the incident + /// Describes a user that the incident is assigned + /// to + /// The severity of the incident. Possible + /// values include: 'High', 'Medium', 'Low', 'Informational' + /// The status of the incident. Possible values + /// include: 'New', 'Active', 'Closed' + public AutomationRuleModifyPropertiesActionActionConfiguration(string classification = default(string), string classificationComment = default(string), string classificationReason = default(string), IList labels = default(IList), IncidentOwnerInfo owner = default(IncidentOwnerInfo), string severity = default(string), string status = default(string)) + { + Classification = classification; + ClassificationComment = classificationComment; + ClassificationReason = classificationReason; + Labels = labels; + Owner = owner; + Severity = severity; + Status = status; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the reason the incident was closed. Possible values + /// include: 'Undetermined', 'TruePositive', 'BenignPositive', + /// 'FalsePositive' + /// + [JsonProperty(PropertyName = "classification")] + public string Classification { get; set; } + + /// + /// Gets or sets describes the reason the incident was closed + /// + [JsonProperty(PropertyName = "classificationComment")] + public string ClassificationComment { get; set; } + + /// + /// Gets or sets the classification reason the incident was closed + /// with. Possible values include: 'SuspiciousActivity', + /// 'SuspiciousButExpected', 'IncorrectAlertLogic', 'InaccurateData' + /// + [JsonProperty(PropertyName = "classificationReason")] + public string ClassificationReason { get; set; } + + /// + /// Gets or sets list of labels to add to the incident + /// + [JsonProperty(PropertyName = "labels")] + public IList Labels { get; set; } + + /// + /// Gets or sets describes a user that the incident is assigned to + /// + [JsonProperty(PropertyName = "owner")] + public IncidentOwnerInfo Owner { get; set; } + + /// + /// Gets or sets the severity of the incident. Possible values include: + /// 'High', 'Medium', 'Low', 'Informational' + /// + [JsonProperty(PropertyName = "severity")] + public string Severity { get; set; } + + /// + /// Gets or sets the status of the incident. Possible values include: + /// 'New', 'Active', 'Closed' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AutomationRulePropertyConditionSupportedOperator.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AutomationRulePropertyConditionSupportedOperator.cs new file mode 100644 index 0000000000000..559379007992e --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AutomationRulePropertyConditionSupportedOperator.cs @@ -0,0 +1,58 @@ +// +// 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.Models +{ + + /// + /// Defines values for AutomationRulePropertyConditionSupportedOperator. + /// + public static class AutomationRulePropertyConditionSupportedOperator + { + /// + /// Evaluates if the property equals at least one of the condition + /// values + /// + public const string Equals = "Equals"; + /// + /// Evaluates if the property does not equal any of the condition + /// values + /// + public const string NotEquals = "NotEquals"; + /// + /// Evaluates if the property contains at least one of the condition + /// values + /// + public const string Contains = "Contains"; + /// + /// Evaluates if the property does not contain any of the condition + /// values + /// + public const string NotContains = "NotContains"; + /// + /// Evaluates if the property starts with any of the condition values + /// + public const string StartsWith = "StartsWith"; + /// + /// Evaluates if the property does not start with any of the condition + /// values + /// + public const string NotStartsWith = "NotStartsWith"; + /// + /// Evaluates if the property ends with any of the condition values + /// + public const string EndsWith = "EndsWith"; + /// + /// Evaluates if the property does not end with any of the condition + /// values + /// + public const string NotEndsWith = "NotEndsWith"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AutomationRulePropertyConditionSupportedProperty.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AutomationRulePropertyConditionSupportedProperty.cs new file mode 100644 index 0000000000000..2c04b42ab87fc --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AutomationRulePropertyConditionSupportedProperty.cs @@ -0,0 +1,228 @@ +// +// 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.Models +{ + + /// + /// Defines values for AutomationRulePropertyConditionSupportedProperty. + /// + public static class AutomationRulePropertyConditionSupportedProperty + { + /// + /// The title of the incident + /// + public const string IncidentTitle = "IncidentTitle"; + /// + /// The description of the incident + /// + public const string IncidentDescription = "IncidentDescription"; + /// + /// The severity of the incident + /// + public const string IncidentSeverity = "IncidentSeverity"; + /// + /// The status of the incident + /// + public const string IncidentStatus = "IncidentStatus"; + /// + /// The tactics of the incident + /// + public const string IncidentTactics = "IncidentTactics"; + /// + /// The related Analytic rule ids of the incident + /// + public const string IncidentRelatedAnalyticRuleIds = "IncidentRelatedAnalyticRuleIds"; + /// + /// The provider name of the incident + /// + public const string IncidentProviderName = "IncidentProviderName"; + /// + /// The account Azure Active Directory tenant id + /// + public const string AccountAadTenantId = "AccountAadTenantId"; + /// + /// The account Azure Active Directory user id. + /// + public const string AccountAadUserId = "AccountAadUserId"; + /// + /// The account name + /// + public const string AccountName = "AccountName"; + /// + /// The account NetBIOS domain name + /// + public const string AccountNTDomain = "AccountNTDomain"; + /// + /// The account Azure Active Directory Passport User ID + /// + public const string AccountPUID = "AccountPUID"; + /// + /// The account security identifier + /// + public const string AccountSid = "AccountSid"; + /// + /// The account unique identifier + /// + public const string AccountObjectGuid = "AccountObjectGuid"; + /// + /// The account user principal name suffix + /// + public const string AccountUPNSuffix = "AccountUPNSuffix"; + /// + /// The Azure resource id + /// + public const string AzureResourceResourceId = "AzureResourceResourceId"; + /// + /// The Azure resource subscription id + /// + public const string AzureResourceSubscriptionId = "AzureResourceSubscriptionId"; + /// + /// The cloud application identifier + /// + public const string CloudApplicationAppId = "CloudApplicationAppId"; + /// + /// The cloud application name + /// + public const string CloudApplicationAppName = "CloudApplicationAppName"; + /// + /// The dns record domain name + /// + public const string DNSDomainName = "DNSDomainName"; + /// + /// The file directory full path + /// + public const string FileDirectory = "FileDirectory"; + /// + /// The file name without path + /// + public const string FileName = "FileName"; + /// + /// The file hash value + /// + public const string FileHashValue = "FileHashValue"; + /// + /// The host Azure resource id + /// + public const string HostAzureID = "HostAzureID"; + /// + /// The host name without domain + /// + public const string HostName = "HostName"; + /// + /// The host NetBIOS name + /// + public const string HostNetBiosName = "HostNetBiosName"; + /// + /// The host NT domain + /// + public const string HostNTDomain = "HostNTDomain"; + /// + /// The host operating system + /// + public const string HostOSVersion = "HostOSVersion"; + /// + /// The IoT device id + /// + public const string IoTDeviceId = "IoTDeviceId"; + /// + /// The IoT device name + /// + public const string IoTDeviceName = "IoTDeviceName"; + /// + /// The IoT device type + /// + public const string IoTDeviceType = "IoTDeviceType"; + /// + /// The IoT device vendor + /// + public const string IoTDeviceVendor = "IoTDeviceVendor"; + /// + /// The IoT device model + /// + public const string IoTDeviceModel = "IoTDeviceModel"; + /// + /// The IoT device operating system + /// + public const string IoTDeviceOperatingSystem = "IoTDeviceOperatingSystem"; + /// + /// The IP address + /// + public const string IPAddress = "IPAddress"; + /// + /// The mailbox display name + /// + public const string MailboxDisplayName = "MailboxDisplayName"; + /// + /// The mailbox primary address + /// + public const string MailboxPrimaryAddress = "MailboxPrimaryAddress"; + /// + /// The mailbox user principal name + /// + public const string MailboxUPN = "MailboxUPN"; + /// + /// The mail message delivery action + /// + public const string MailMessageDeliveryAction = "MailMessageDeliveryAction"; + /// + /// The mail message delivery location + /// + public const string MailMessageDeliveryLocation = "MailMessageDeliveryLocation"; + /// + /// The mail message recipient + /// + public const string MailMessageRecipient = "MailMessageRecipient"; + /// + /// The mail message sender IP address + /// + public const string MailMessageSenderIP = "MailMessageSenderIP"; + /// + /// The mail message subject + /// + public const string MailMessageSubject = "MailMessageSubject"; + /// + /// The mail message P1 sender + /// + public const string MailMessageP1Sender = "MailMessageP1Sender"; + /// + /// The mail message P2 sender + /// + public const string MailMessageP2Sender = "MailMessageP2Sender"; + /// + /// The malware category + /// + public const string MalwareCategory = "MalwareCategory"; + /// + /// The malware name + /// + public const string MalwareName = "MalwareName"; + /// + /// The process execution command line + /// + public const string ProcessCommandLine = "ProcessCommandLine"; + /// + /// The process id + /// + public const string ProcessId = "ProcessId"; + /// + /// The registry key path + /// + public const string RegistryKey = "RegistryKey"; + /// + /// The registry key value in string formatted representation + /// + public const string RegistryValueData = "RegistryValueData"; + /// + /// The url + /// + public const string Url = "Url"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AutomationRulePropertyValuesCondition.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AutomationRulePropertyValuesCondition.cs new file mode 100644 index 0000000000000..fdeb7deed74ce --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AutomationRulePropertyValuesCondition.cs @@ -0,0 +1,70 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes an automation rule condition that evaluates a property's + /// value + /// + [Newtonsoft.Json.JsonObject("Property")] + public partial class AutomationRulePropertyValuesCondition : AutomationRuleCondition + { + /// + /// Initializes a new instance of the + /// AutomationRulePropertyValuesCondition class. + /// + public AutomationRulePropertyValuesCondition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// AutomationRulePropertyValuesCondition class. + /// + /// The configuration of the + /// automation rule condition + public AutomationRulePropertyValuesCondition(AutomationRulePropertyValuesConditionConditionProperties conditionProperties) + { + ConditionProperties = conditionProperties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the configuration of the automation rule condition + /// + [JsonProperty(PropertyName = "conditionProperties")] + public AutomationRulePropertyValuesConditionConditionProperties ConditionProperties { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ConditionProperties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ConditionProperties"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AutomationRulePropertyValuesConditionConditionProperties.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AutomationRulePropertyValuesConditionConditionProperties.cs new file mode 100644 index 0000000000000..649478fa28cd4 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AutomationRulePropertyValuesConditionConditionProperties.cs @@ -0,0 +1,114 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The configuration of the automation rule condition + /// + public partial class AutomationRulePropertyValuesConditionConditionProperties + { + /// + /// Initializes a new instance of the + /// AutomationRulePropertyValuesConditionConditionProperties class. + /// + public AutomationRulePropertyValuesConditionConditionProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// AutomationRulePropertyValuesConditionConditionProperties class. + /// + /// The property to evaluate. Possible + /// values include: 'IncidentTitle', 'IncidentDescription', + /// 'IncidentSeverity', 'IncidentStatus', 'IncidentTactics', + /// 'IncidentRelatedAnalyticRuleIds', 'IncidentProviderName', + /// 'AccountAadTenantId', 'AccountAadUserId', 'AccountName', + /// 'AccountNTDomain', 'AccountPUID', 'AccountSid', + /// 'AccountObjectGuid', 'AccountUPNSuffix', 'AzureResourceResourceId', + /// 'AzureResourceSubscriptionId', 'CloudApplicationAppId', + /// 'CloudApplicationAppName', 'DNSDomainName', 'FileDirectory', + /// 'FileName', 'FileHashValue', 'HostAzureID', 'HostName', + /// 'HostNetBiosName', 'HostNTDomain', 'HostOSVersion', 'IoTDeviceId', + /// 'IoTDeviceName', 'IoTDeviceType', 'IoTDeviceVendor', + /// 'IoTDeviceModel', 'IoTDeviceOperatingSystem', 'IPAddress', + /// 'MailboxDisplayName', 'MailboxPrimaryAddress', 'MailboxUPN', + /// 'MailMessageDeliveryAction', 'MailMessageDeliveryLocation', + /// 'MailMessageRecipient', 'MailMessageSenderIP', + /// 'MailMessageSubject', 'MailMessageP1Sender', 'MailMessageP2Sender', + /// 'MalwareCategory', 'MalwareName', 'ProcessCommandLine', + /// 'ProcessId', 'RegistryKey', 'RegistryValueData', 'Url' + /// The operator to use for evaluation + /// the condition. Possible values include: 'Equals', 'NotEquals', + /// 'Contains', 'NotContains', 'StartsWith', 'NotStartsWith', + /// 'EndsWith', 'NotEndsWith' + /// The values to use for evaluating the + /// condition + public AutomationRulePropertyValuesConditionConditionProperties(string propertyName = default(string), string operatorProperty = default(string), IList propertyValues = default(IList)) + { + PropertyName = propertyName; + OperatorProperty = operatorProperty; + PropertyValues = propertyValues; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the property to evaluate. Possible values include: + /// 'IncidentTitle', 'IncidentDescription', 'IncidentSeverity', + /// 'IncidentStatus', 'IncidentTactics', + /// 'IncidentRelatedAnalyticRuleIds', 'IncidentProviderName', + /// 'AccountAadTenantId', 'AccountAadUserId', 'AccountName', + /// 'AccountNTDomain', 'AccountPUID', 'AccountSid', + /// 'AccountObjectGuid', 'AccountUPNSuffix', 'AzureResourceResourceId', + /// 'AzureResourceSubscriptionId', 'CloudApplicationAppId', + /// 'CloudApplicationAppName', 'DNSDomainName', 'FileDirectory', + /// 'FileName', 'FileHashValue', 'HostAzureID', 'HostName', + /// 'HostNetBiosName', 'HostNTDomain', 'HostOSVersion', 'IoTDeviceId', + /// 'IoTDeviceName', 'IoTDeviceType', 'IoTDeviceVendor', + /// 'IoTDeviceModel', 'IoTDeviceOperatingSystem', 'IPAddress', + /// 'MailboxDisplayName', 'MailboxPrimaryAddress', 'MailboxUPN', + /// 'MailMessageDeliveryAction', 'MailMessageDeliveryLocation', + /// 'MailMessageRecipient', 'MailMessageSenderIP', + /// 'MailMessageSubject', 'MailMessageP1Sender', 'MailMessageP2Sender', + /// 'MalwareCategory', 'MalwareName', 'ProcessCommandLine', + /// 'ProcessId', 'RegistryKey', 'RegistryValueData', 'Url' + /// + [JsonProperty(PropertyName = "propertyName")] + public string PropertyName { get; set; } + + /// + /// Gets or sets the operator to use for evaluation the condition. + /// Possible values include: 'Equals', 'NotEquals', 'Contains', + /// 'NotContains', 'StartsWith', 'NotStartsWith', 'EndsWith', + /// 'NotEndsWith' + /// + [JsonProperty(PropertyName = "operator")] + public string OperatorProperty { get; set; } + + /// + /// Gets or sets the values to use for evaluating the condition + /// + [JsonProperty(PropertyName = "propertyValues")] + public IList PropertyValues { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AutomationRuleRunPlaybookAction.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AutomationRuleRunPlaybookAction.cs new file mode 100644 index 0000000000000..cbc27ec81a7c1 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AutomationRuleRunPlaybookAction.cs @@ -0,0 +1,74 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes an automation rule action to run a playbook + /// + [Newtonsoft.Json.JsonObject("RunPlaybook")] + public partial class AutomationRuleRunPlaybookAction : AutomationRuleAction + { + /// + /// Initializes a new instance of the AutomationRuleRunPlaybookAction + /// class. + /// + public AutomationRuleRunPlaybookAction() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AutomationRuleRunPlaybookAction + /// class. + /// + /// The order of execution of the automation rule + /// action + /// The configuration of the run + /// playbook automation rule action + public AutomationRuleRunPlaybookAction(int order, AutomationRuleRunPlaybookActionActionConfiguration actionConfiguration) + : base(order) + { + ActionConfiguration = actionConfiguration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the configuration of the run playbook automation rule + /// action + /// + [JsonProperty(PropertyName = "actionConfiguration")] + public AutomationRuleRunPlaybookActionActionConfiguration ActionConfiguration { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (ActionConfiguration == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ActionConfiguration"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AutomationRuleRunPlaybookActionActionConfiguration.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AutomationRuleRunPlaybookActionActionConfiguration.cs new file mode 100644 index 0000000000000..79bfc0fa2c0f1 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AutomationRuleRunPlaybookActionActionConfiguration.cs @@ -0,0 +1,63 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The configuration of the run playbook automation rule action + /// + public partial class AutomationRuleRunPlaybookActionActionConfiguration + { + /// + /// Initializes a new instance of the + /// AutomationRuleRunPlaybookActionActionConfiguration class. + /// + public AutomationRuleRunPlaybookActionActionConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// AutomationRuleRunPlaybookActionActionConfiguration class. + /// + /// The resource id of the playbook + /// resource + /// The tenant id of the playbook + /// resource + public AutomationRuleRunPlaybookActionActionConfiguration(string logicAppResourceId = default(string), string tenantId = default(string)) + { + LogicAppResourceId = logicAppResourceId; + TenantId = tenantId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the resource id of the playbook resource + /// + [JsonProperty(PropertyName = "logicAppResourceId")] + public string LogicAppResourceId { get; set; } + + /// + /// Gets or sets the tenant id of the playbook resource + /// + [JsonProperty(PropertyName = "tenantId")] + public string TenantId { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AutomationRuleTriggeringLogic.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AutomationRuleTriggeringLogic.cs new file mode 100644 index 0000000000000..c668755fd2378 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AutomationRuleTriggeringLogic.cs @@ -0,0 +1,106 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes automation rule triggering logic + /// + public partial class AutomationRuleTriggeringLogic + { + /// + /// Initializes a new instance of the AutomationRuleTriggeringLogic + /// class. + /// + public AutomationRuleTriggeringLogic() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AutomationRuleTriggeringLogic + /// class. + /// + /// Determines whether the automation rule is + /// enabled or disabled. + /// Determines when the automation rule + /// should automatically expire and be disabled. + /// The conditions to evaluate to determine if + /// the automation rule should be triggered on a given object + public AutomationRuleTriggeringLogic(bool isEnabled, System.DateTime? expirationTimeUtc = default(System.DateTime?), IList conditions = default(IList)) + { + IsEnabled = isEnabled; + ExpirationTimeUtc = expirationTimeUtc; + Conditions = conditions; + CustomInit(); + } + /// + /// Static constructor for AutomationRuleTriggeringLogic class. + /// + static AutomationRuleTriggeringLogic() + { + TriggersOn = "Incidents"; + TriggersWhen = "Created"; + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets determines whether the automation rule is enabled or + /// disabled. + /// + [JsonProperty(PropertyName = "isEnabled")] + public bool IsEnabled { get; set; } + + /// + /// Gets or sets determines when the automation rule should + /// automatically expire and be disabled. + /// + [JsonProperty(PropertyName = "expirationTimeUtc")] + public System.DateTime? ExpirationTimeUtc { get; set; } + + /// + /// Gets or sets the conditions to evaluate to determine if the + /// automation rule should be triggered on a given object + /// + [JsonProperty(PropertyName = "conditions")] + public IList Conditions { get; set; } + + /// + /// The type of object the automation rule triggers on + /// + [JsonProperty(PropertyName = "triggersOn")] + public static string TriggersOn { get; private set; } + + /// + /// The type of event the automation rule triggers on + /// + [JsonProperty(PropertyName = "triggersWhen")] + public static string TriggersWhen { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Availability.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Availability.cs new file mode 100644 index 0000000000000..d4cd9363276fc --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Availability.cs @@ -0,0 +1,59 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Connector Availability Status + /// + public partial class Availability + { + /// + /// Initializes a new instance of the Availability class. + /// + public Availability() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Availability class. + /// + /// The connector Availability Status + /// Set connector as preview + public Availability(int? status = default(int?), bool? isPreview = default(bool?)) + { + Status = status; + IsPreview = isPreview; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the connector Availability Status + /// + [JsonProperty(PropertyName = "status")] + public int? Status { get; set; } + + /// + /// Gets or sets set connector as preview + /// + [JsonProperty(PropertyName = "isPreview")] + public bool? IsPreview { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsCloudTrailCheckRequirements.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsCloudTrailCheckRequirements.cs new file mode 100644 index 0000000000000..d09f16f2f7ed3 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsCloudTrailCheckRequirements.cs @@ -0,0 +1,38 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Amazon Web Services CloudTrail requirements check request. + /// + [Newtonsoft.Json.JsonObject("AmazonWebServicesCloudTrail")] + public partial class AwsCloudTrailCheckRequirements : DataConnectorsCheckRequirements + { + /// + /// Initializes a new instance of the AwsCloudTrailCheckRequirements + /// class. + /// + public AwsCloudTrailCheckRequirements() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsCloudTrailDataConnector.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsCloudTrailDataConnector.cs index ee41347c8b5a6..c8e56112896ef 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsCloudTrailDataConnector.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsCloudTrailDataConnector.cs @@ -33,16 +33,21 @@ public AwsCloudTrailDataConnector() /// /// Initializes a new instance of the AwsCloudTrailDataConnector class. /// - /// Azure resource Id - /// Azure resource name - /// Azure resource type + /// The available data types for the + /// connector. + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. /// Etag of the azure resource /// The Aws Role Arn (with CloudTrailReadOnly /// policy) that is used to access the Aws account. - /// The available data types for the - /// connector. - public AwsCloudTrailDataConnector(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), string awsRoleArn = default(string), AwsCloudTrailDataConnectorDataTypes dataTypes = default(AwsCloudTrailDataConnectorDataTypes)) - : base(id, name, type, etag) + public AwsCloudTrailDataConnector(AwsCloudTrailDataConnectorDataTypes dataTypes, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string), string awsRoleArn = default(string)) + : base(id, name, type, systemData, etag) { AwsRoleArn = awsRoleArn; DataTypes = dataTypes; @@ -67,5 +72,22 @@ public AwsCloudTrailDataConnector() [JsonProperty(PropertyName = "properties.dataTypes")] public AwsCloudTrailDataConnectorDataTypes DataTypes { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DataTypes == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DataTypes"); + } + if (DataTypes != null) + { + DataTypes.Validate(); + } + } } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsCloudTrailDataConnectorDataTypes.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsCloudTrailDataConnectorDataTypes.cs index 279ef3f6a6fd1..cb1ee91fc8785 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsCloudTrailDataConnectorDataTypes.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsCloudTrailDataConnectorDataTypes.cs @@ -10,6 +10,7 @@ namespace Microsoft.Azure.Management.SecurityInsights.Models { + using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -33,7 +34,7 @@ public AwsCloudTrailDataConnectorDataTypes() /// AwsCloudTrailDataConnectorDataTypes class. /// /// Logs data type. - public AwsCloudTrailDataConnectorDataTypes(AwsCloudTrailDataConnectorDataTypesLogs logs = default(AwsCloudTrailDataConnectorDataTypesLogs)) + public AwsCloudTrailDataConnectorDataTypes(AwsCloudTrailDataConnectorDataTypesLogs logs) { Logs = logs; CustomInit(); @@ -50,5 +51,22 @@ public AwsCloudTrailDataConnectorDataTypes() [JsonProperty(PropertyName = "logs")] public AwsCloudTrailDataConnectorDataTypesLogs Logs { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Logs == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Logs"); + } + if (Logs != null) + { + Logs.Validate(); + } + } } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsCloudTrailDataConnectorDataTypesLogs.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsCloudTrailDataConnectorDataTypesLogs.cs index 02803069b81e5..6f771243230b9 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsCloudTrailDataConnectorDataTypesLogs.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsCloudTrailDataConnectorDataTypesLogs.cs @@ -33,7 +33,7 @@ public AwsCloudTrailDataConnectorDataTypesLogs() /// Describe whether this data type connection is /// enabled or not. Possible values include: 'Enabled', /// 'Disabled' - public AwsCloudTrailDataConnectorDataTypesLogs(string state = default(string)) + public AwsCloudTrailDataConnectorDataTypesLogs(string state) : base(state) { CustomInit(); @@ -44,5 +44,15 @@ public AwsCloudTrailDataConnectorDataTypesLogs() /// partial void CustomInit(); + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsS3CheckRequirements.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsS3CheckRequirements.cs new file mode 100644 index 0000000000000..de3dc86562f5c --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsS3CheckRequirements.cs @@ -0,0 +1,37 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Amazon Web Services S3 requirements check request. + /// + [Newtonsoft.Json.JsonObject("AmazonWebServicesS3")] + public partial class AwsS3CheckRequirements : DataConnectorsCheckRequirements + { + /// + /// Initializes a new instance of the AwsS3CheckRequirements class. + /// + public AwsS3CheckRequirements() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsS3DataConnector.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsS3DataConnector.cs new file mode 100644 index 0000000000000..4beedd3351ef8 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsS3DataConnector.cs @@ -0,0 +1,124 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents Amazon Web Services S3 data connector. + /// + [Newtonsoft.Json.JsonObject("AmazonWebServicesS3")] + [Rest.Serialization.JsonTransformation] + public partial class AwsS3DataConnector : DataConnector + { + /// + /// Initializes a new instance of the AwsS3DataConnector class. + /// + public AwsS3DataConnector() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AwsS3DataConnector class. + /// + /// The logs destination table name in + /// LogAnalytics. + /// The AWS sqs urls for the connector. + /// The Aws Role Arn that is used to access the + /// Aws account. + /// The available data types for the + /// connector. + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Etag of the azure resource + public AwsS3DataConnector(string destinationTable, IList sqsUrls, string roleArn, AwsS3DataConnectorDataTypes dataTypes, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string)) + : base(id, name, type, systemData, etag) + { + DestinationTable = destinationTable; + SqsUrls = sqsUrls; + RoleArn = roleArn; + DataTypes = dataTypes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the logs destination table name in LogAnalytics. + /// + [JsonProperty(PropertyName = "properties.destinationTable")] + public string DestinationTable { get; set; } + + /// + /// Gets or sets the AWS sqs urls for the connector. + /// + [JsonProperty(PropertyName = "properties.sqsUrls")] + public IList SqsUrls { get; set; } + + /// + /// Gets or sets the Aws Role Arn that is used to access the Aws + /// account. + /// + [JsonProperty(PropertyName = "properties.roleArn")] + public string RoleArn { get; set; } + + /// + /// Gets or sets the available data types for the connector. + /// + [JsonProperty(PropertyName = "properties.dataTypes")] + public AwsS3DataConnectorDataTypes DataTypes { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DestinationTable == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DestinationTable"); + } + if (SqsUrls == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SqsUrls"); + } + if (RoleArn == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "RoleArn"); + } + if (DataTypes == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DataTypes"); + } + if (DataTypes != null) + { + DataTypes.Validate(); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsS3DataConnectorDataTypes.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsS3DataConnectorDataTypes.cs new file mode 100644 index 0000000000000..42ef89fee1fa3 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsS3DataConnectorDataTypes.cs @@ -0,0 +1,71 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The available data types for Amazon Web Services S3 data connector. + /// + public partial class AwsS3DataConnectorDataTypes + { + /// + /// Initializes a new instance of the AwsS3DataConnectorDataTypes + /// class. + /// + public AwsS3DataConnectorDataTypes() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AwsS3DataConnectorDataTypes + /// class. + /// + /// Logs data type. + public AwsS3DataConnectorDataTypes(AwsS3DataConnectorDataTypesLogs logs) + { + Logs = logs; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets logs data type. + /// + [JsonProperty(PropertyName = "logs")] + public AwsS3DataConnectorDataTypesLogs Logs { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Logs == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Logs"); + } + if (Logs != null) + { + Logs.Validate(); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsS3DataConnectorDataTypesLogs.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsS3DataConnectorDataTypesLogs.cs new file mode 100644 index 0000000000000..4db4cdd6249ae --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsS3DataConnectorDataTypesLogs.cs @@ -0,0 +1,58 @@ +// +// 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.Models +{ + using System.Linq; + + /// + /// Logs data type. + /// + public partial class AwsS3DataConnectorDataTypesLogs : DataConnectorDataTypeCommon + { + /// + /// Initializes a new instance of the AwsS3DataConnectorDataTypesLogs + /// class. + /// + public AwsS3DataConnectorDataTypesLogs() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AwsS3DataConnectorDataTypesLogs + /// class. + /// + /// Describe whether this data type connection is + /// enabled or not. Possible values include: 'Enabled', + /// 'Disabled' + public AwsS3DataConnectorDataTypesLogs(string state) + : base(state) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AzureEntityResource.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AzureEntityResource.cs new file mode 100644 index 0000000000000..ac65db7abfa7d --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AzureEntityResource.cs @@ -0,0 +1,64 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Entity Resource + /// + /// + /// The resource model definition for an Azure Resource Manager resource + /// with an etag. + /// + public partial class AzureEntityResource : Resource + { + /// + /// Initializes a new instance of the AzureEntityResource class. + /// + public AzureEntityResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureEntityResource class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Resource Etag. + public AzureEntityResource(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string)) + : base(id, name, type, systemData) + { + Etag = etag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource Etag. + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AzureResourceEntity.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AzureResourceEntity.cs new file mode 100644 index 0000000000000..7fbe3af558223 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AzureResourceEntity.cs @@ -0,0 +1,98 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents an azure resource entity. + /// + [Newtonsoft.Json.JsonObject("AzureResource")] + [Rest.Serialization.JsonTransformation] + public partial class AzureResourceEntity : Entity + { + /// + /// Initializes a new instance of the AzureResourceEntity class. + /// + public AzureResourceEntity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureResourceEntity class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// A bag of custom fields that should be + /// part of the entity and will be presented to the user. + /// The graph item display name which is a + /// short humanly readable description of the graph item instance. This + /// property is optional and might be system generated. + /// The azure resource id of the + /// resource + /// The subscription id of the + /// resource + public AzureResourceEntity(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary additionalData = default(IDictionary), string friendlyName = default(string), string resourceId = default(string), string subscriptionId = default(string)) + : base(id, name, type, systemData) + { + AdditionalData = additionalData; + FriendlyName = friendlyName; + ResourceId = resourceId; + SubscriptionId = subscriptionId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a bag of custom fields that should be part of the entity and + /// will be presented to the user. + /// + [JsonProperty(PropertyName = "properties.additionalData")] + public IDictionary AdditionalData { get; private set; } + + /// + /// Gets the graph item display name which is a short humanly readable + /// description of the graph item instance. This property is optional + /// and might be system generated. + /// + [JsonProperty(PropertyName = "properties.friendlyName")] + public string FriendlyName { get; private set; } + + /// + /// Gets the azure resource id of the resource + /// + [JsonProperty(PropertyName = "properties.resourceId")] + public string ResourceId { get; private set; } + + /// + /// Gets the subscription id of the resource + /// + [JsonProperty(PropertyName = "properties.subscriptionId")] + public string SubscriptionId { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Bookmark.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Bookmark.cs index 24573b469b66b..8b2f0342eb465 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Bookmark.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Bookmark.cs @@ -36,9 +36,14 @@ public Bookmark() /// /// The display name of the bookmark /// The query of the bookmark. - /// Azure resource Id - /// Azure resource name - /// Azure resource type + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. /// Etag of the azure resource /// The time the bookmark was created /// Describes a user that created the @@ -56,8 +61,8 @@ public Bookmark() /// The end time for the query /// Describes an incident that relates to /// bookmark - public Bookmark(string displayName, string query, string id = default(string), string name = default(string), string type = default(string), string etag = default(string), System.DateTime? created = default(System.DateTime?), UserInfo createdBy = default(UserInfo), IList labels = default(IList), string notes = default(string), string queryResult = default(string), System.DateTime? updated = default(System.DateTime?), UserInfo updatedBy = default(UserInfo), System.DateTime? eventTime = default(System.DateTime?), System.DateTime? queryStartTime = default(System.DateTime?), System.DateTime? queryEndTime = default(System.DateTime?), IncidentInfo incidentInfo = default(IncidentInfo)) - : base(id, name, type, etag) + public Bookmark(string displayName, string query, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string), System.DateTime? created = default(System.DateTime?), UserInfo createdBy = default(UserInfo), IList labels = default(IList), string notes = default(string), string queryResult = default(string), System.DateTime? updated = default(System.DateTime?), UserInfo updatedBy = default(UserInfo), System.DateTime? eventTime = default(System.DateTime?), System.DateTime? queryStartTime = default(System.DateTime?), System.DateTime? queryEndTime = default(System.DateTime?), IncidentInfo incidentInfo = default(IncidentInfo)) + : base(id, name, type, systemData, etag) { Created = created; CreatedBy = createdBy; @@ -174,14 +179,6 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "Query"); } - if (CreatedBy != null) - { - CreatedBy.Validate(); - } - if (UpdatedBy != null) - { - UpdatedBy.Validate(); - } } } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/BookmarkExpandParameters.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/BookmarkExpandParameters.cs new file mode 100644 index 0000000000000..49692692a3f75 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/BookmarkExpandParameters.cs @@ -0,0 +1,73 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The parameters required to execute an expand operation on the given + /// bookmark. + /// + public partial class BookmarkExpandParameters + { + /// + /// Initializes a new instance of the BookmarkExpandParameters class. + /// + public BookmarkExpandParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BookmarkExpandParameters class. + /// + /// The end date filter, so the only expansion + /// results returned are before this date. + /// The Id of the expansion to + /// perform. + /// The start date filter, so the only + /// expansion results returned are after this date. + public BookmarkExpandParameters(System.DateTime? endTime = default(System.DateTime?), System.Guid? expansionId = default(System.Guid?), System.DateTime? startTime = default(System.DateTime?)) + { + EndTime = endTime; + ExpansionId = expansionId; + StartTime = startTime; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the end date filter, so the only expansion results + /// returned are before this date. + /// + [JsonProperty(PropertyName = "endTime")] + public System.DateTime? EndTime { get; set; } + + /// + /// Gets or sets the Id of the expansion to perform. + /// + [JsonProperty(PropertyName = "expansionId")] + public System.Guid? ExpansionId { get; set; } + + /// + /// Gets or sets the start date filter, so the only expansion results + /// returned are after this date. + /// + [JsonProperty(PropertyName = "startTime")] + public System.DateTime? StartTime { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/BookmarkExpandResponse.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/BookmarkExpandResponse.cs new file mode 100644 index 0000000000000..1d0025851f089 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/BookmarkExpandResponse.cs @@ -0,0 +1,60 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The entity expansion result operation response. + /// + public partial class BookmarkExpandResponse + { + /// + /// Initializes a new instance of the BookmarkExpandResponse class. + /// + public BookmarkExpandResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BookmarkExpandResponse class. + /// + /// The metadata from the expansion operation + /// results. + /// The expansion result values. + public BookmarkExpandResponse(ExpansionResultsMetadata metaData = default(ExpansionResultsMetadata), BookmarkExpandResponseValue value = default(BookmarkExpandResponseValue)) + { + MetaData = metaData; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the metadata from the expansion operation results. + /// + [JsonProperty(PropertyName = "metaData")] + public ExpansionResultsMetadata MetaData { get; set; } + + /// + /// Gets or sets the expansion result values. + /// + [JsonProperty(PropertyName = "value")] + public BookmarkExpandResponseValue Value { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/BookmarkExpandResponseValue.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/BookmarkExpandResponseValue.cs new file mode 100644 index 0000000000000..528b47f0a0e0b --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/BookmarkExpandResponseValue.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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The expansion result values. + /// + public partial class BookmarkExpandResponseValue + { + /// + /// Initializes a new instance of the BookmarkExpandResponseValue + /// class. + /// + public BookmarkExpandResponseValue() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BookmarkExpandResponseValue + /// class. + /// + /// Array of the expansion result + /// entities. + /// Array of expansion result connected + /// entities + public BookmarkExpandResponseValue(IList entities = default(IList), IList edges = default(IList)) + { + Entities = entities; + Edges = edges; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets array of the expansion result entities. + /// + [JsonProperty(PropertyName = "entities")] + public IList Entities { get; set; } + + /// + /// Gets or sets array of expansion result connected entities + /// + [JsonProperty(PropertyName = "edges")] + public IList Edges { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/BookmarkTimelineItem.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/BookmarkTimelineItem.cs new file mode 100644 index 0000000000000..dc53041ebffa3 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/BookmarkTimelineItem.cs @@ -0,0 +1,127 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents bookmark timeline item. + /// + [Newtonsoft.Json.JsonObject("Bookmark")] + public partial class BookmarkTimelineItem : EntityTimelineItem + { + /// + /// Initializes a new instance of the BookmarkTimelineItem class. + /// + public BookmarkTimelineItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BookmarkTimelineItem class. + /// + /// The bookmark azure resource + /// id. + /// The bookmark display name. + /// The notes of the bookmark + /// The bookmark end time. + /// The bookmark start time. + /// The bookmark event time. + /// Describes a user that created the + /// bookmark + /// List of labels relevant to this + /// bookmark + public BookmarkTimelineItem(string azureResourceId, string displayName = default(string), string notes = default(string), System.DateTime? endTimeUtc = default(System.DateTime?), System.DateTime? startTimeUtc = default(System.DateTime?), System.DateTime? eventTime = default(System.DateTime?), UserInfo createdBy = default(UserInfo), IList labels = default(IList)) + { + AzureResourceId = azureResourceId; + DisplayName = displayName; + Notes = notes; + EndTimeUtc = endTimeUtc; + StartTimeUtc = startTimeUtc; + EventTime = eventTime; + CreatedBy = createdBy; + Labels = labels; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the bookmark azure resource id. + /// + [JsonProperty(PropertyName = "azureResourceId")] + public string AzureResourceId { get; set; } + + /// + /// Gets or sets the bookmark display name. + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets the notes of the bookmark + /// + [JsonProperty(PropertyName = "notes")] + public string Notes { get; set; } + + /// + /// Gets or sets the bookmark end time. + /// + [JsonProperty(PropertyName = "endTimeUtc")] + public System.DateTime? EndTimeUtc { get; set; } + + /// + /// Gets or sets the bookmark start time. + /// + [JsonProperty(PropertyName = "startTimeUtc")] + public System.DateTime? StartTimeUtc { get; set; } + + /// + /// Gets or sets the bookmark event time. + /// + [JsonProperty(PropertyName = "eventTime")] + public System.DateTime? EventTime { get; set; } + + /// + /// Gets or sets describes a user that created the bookmark + /// + [JsonProperty(PropertyName = "createdBy")] + public UserInfo CreatedBy { get; set; } + + /// + /// Gets or sets list of labels relevant to this bookmark + /// + [JsonProperty(PropertyName = "labels")] + public IList Labels { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (AzureResourceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AzureResourceId"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CloudApplicationEntity.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CloudApplicationEntity.cs new file mode 100644 index 0000000000000..e6d679a7d13ea --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CloudApplicationEntity.cs @@ -0,0 +1,110 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents a cloud application entity. + /// + [Newtonsoft.Json.JsonObject("CloudApplication")] + [Rest.Serialization.JsonTransformation] + public partial class CloudApplicationEntity : Entity + { + /// + /// Initializes a new instance of the CloudApplicationEntity class. + /// + public CloudApplicationEntity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CloudApplicationEntity class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// A bag of custom fields that should be + /// part of the entity and will be presented to the user. + /// The graph item display name which is a + /// short humanly readable description of the graph item instance. This + /// property is optional and might be system generated. + /// The technical identifier of the + /// application. + /// The name of the related cloud + /// application. + /// The user defined instance name of the + /// cloud application. It is often used to distinguish between several + /// applications of the same type that a customer has. + public CloudApplicationEntity(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary additionalData = default(IDictionary), string friendlyName = default(string), int? appId = default(int?), string appName = default(string), string instanceName = default(string)) + : base(id, name, type, systemData) + { + AdditionalData = additionalData; + FriendlyName = friendlyName; + AppId = appId; + AppName = appName; + InstanceName = instanceName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a bag of custom fields that should be part of the entity and + /// will be presented to the user. + /// + [JsonProperty(PropertyName = "properties.additionalData")] + public IDictionary AdditionalData { get; private set; } + + /// + /// Gets the graph item display name which is a short humanly readable + /// description of the graph item instance. This property is optional + /// and might be system generated. + /// + [JsonProperty(PropertyName = "properties.friendlyName")] + public string FriendlyName { get; private set; } + + /// + /// Gets the technical identifier of the application. + /// + [JsonProperty(PropertyName = "properties.appId")] + public int? AppId { get; private set; } + + /// + /// Gets the name of the related cloud application. + /// + [JsonProperty(PropertyName = "properties.appName")] + public string AppName { get; private set; } + + /// + /// Gets the user defined instance name of the cloud application. It is + /// often used to distinguish between several applications of the same + /// type that a customer has. + /// + [JsonProperty(PropertyName = "properties.instanceName")] + public string InstanceName { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CloudError.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CloudError.cs new file mode 100644 index 0000000000000..e9b4f0572e22b --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CloudError.cs @@ -0,0 +1,66 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Error response structure. + /// + [Rest.Serialization.JsonTransformation] + public partial class CloudError + { + /// + /// Initializes a new instance of the CloudError class. + /// + public CloudError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CloudError class. + /// + /// An identifier for the error. Codes are invariant + /// and are intended to be consumed programmatically. + /// A message describing the error, intended to + /// be suitable for display in a user interface. + public CloudError(string code = default(string), string message = default(string)) + { + Code = code; + Message = message; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets an identifier for the error. Codes are invariant and are + /// intended to be consumed programmatically. + /// + [JsonProperty(PropertyName = "error.code")] + public string Code { get; private set; } + + /// + /// Gets a message describing the error, intended to be suitable for + /// display in a user interface. + /// + [JsonProperty(PropertyName = "error.message")] + public string Message { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CodelessApiPollingDataConnector.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CodelessApiPollingDataConnector.cs new file mode 100644 index 0000000000000..375f06f550993 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CodelessApiPollingDataConnector.cs @@ -0,0 +1,94 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents Codeless API Polling data connector. + /// + [Newtonsoft.Json.JsonObject("APIPolling")] + [Rest.Serialization.JsonTransformation] + public partial class CodelessApiPollingDataConnector : DataConnector + { + /// + /// Initializes a new instance of the CodelessApiPollingDataConnector + /// class. + /// + public CodelessApiPollingDataConnector() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CodelessApiPollingDataConnector + /// class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Etag of the azure resource + /// Config to describe the instructions + /// blade + /// Config to describe the polling + /// instructions + public CodelessApiPollingDataConnector(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string), CodelessUiConnectorConfigProperties connectorUiConfig = default(CodelessUiConnectorConfigProperties), CodelessConnectorPollingConfigProperties pollingConfig = default(CodelessConnectorPollingConfigProperties)) + : base(id, name, type, systemData, etag) + { + ConnectorUiConfig = connectorUiConfig; + PollingConfig = pollingConfig; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets config to describe the instructions blade + /// + [JsonProperty(PropertyName = "properties.connectorUiConfig")] + public CodelessUiConnectorConfigProperties ConnectorUiConfig { get; set; } + + /// + /// Gets or sets config to describe the polling instructions + /// + [JsonProperty(PropertyName = "properties.pollingConfig")] + public CodelessConnectorPollingConfigProperties PollingConfig { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ConnectorUiConfig != null) + { + ConnectorUiConfig.Validate(); + } + if (PollingConfig != null) + { + PollingConfig.Validate(); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CodelessConnectorPollingAuthProperties.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CodelessConnectorPollingAuthProperties.cs new file mode 100644 index 0000000000000..e354316669b36 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CodelessConnectorPollingAuthProperties.cs @@ -0,0 +1,184 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describe the authentication properties needed to successfully + /// authenticate with the server + /// + public partial class CodelessConnectorPollingAuthProperties + { + /// + /// Initializes a new instance of the + /// CodelessConnectorPollingAuthProperties class. + /// + public CodelessConnectorPollingAuthProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// CodelessConnectorPollingAuthProperties class. + /// + /// The authentication type + /// The header name which the token is sent + /// with + /// A prefix send in the header before + /// the actual token + /// Marks if the key should sent in + /// header + /// Describes the flow name, for example + /// 'AuthCode' for Oauth 2.0 + /// The endpoint used to issue a token, + /// used in Oauth 2.0 flow + /// The endpoint used to authorize + /// the user, used in Oauth 2.0 flow + /// The query + /// parameters used in authorization request, used in Oauth 2.0 + /// flow + /// The redirect endpoint where we + /// will get the authorization code, used in Oauth 2.0 flow + /// The query headers used in token + /// request, used in Oauth 2.0 flow + /// The query parameters + /// used in token request, used in Oauth 2.0 flow + /// Marks if we should send the + /// client secret in header or payload, used in Oauth 2.0 flow + /// The OAuth token scope + public CodelessConnectorPollingAuthProperties(string authType, string apiKeyName = default(string), string apiKeyIdentifier = default(string), string isApiKeyInPostPayload = default(string), string flowName = default(string), string tokenEndpoint = default(string), string authorizationEndpoint = default(string), object authorizationEndpointQueryParameters = default(object), string redirectionEndpoint = default(string), object tokenEndpointHeaders = default(object), object tokenEndpointQueryParameters = default(object), bool? isClientSecretInHeader = default(bool?), string scope = default(string)) + { + AuthType = authType; + ApiKeyName = apiKeyName; + ApiKeyIdentifier = apiKeyIdentifier; + IsApiKeyInPostPayload = isApiKeyInPostPayload; + FlowName = flowName; + TokenEndpoint = tokenEndpoint; + AuthorizationEndpoint = authorizationEndpoint; + AuthorizationEndpointQueryParameters = authorizationEndpointQueryParameters; + RedirectionEndpoint = redirectionEndpoint; + TokenEndpointHeaders = tokenEndpointHeaders; + TokenEndpointQueryParameters = tokenEndpointQueryParameters; + IsClientSecretInHeader = isClientSecretInHeader; + Scope = scope; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the authentication type + /// + [JsonProperty(PropertyName = "authType")] + public string AuthType { get; set; } + + /// + /// Gets or sets the header name which the token is sent with + /// + [JsonProperty(PropertyName = "apiKeyName")] + public string ApiKeyName { get; set; } + + /// + /// Gets or sets a prefix send in the header before the actual token + /// + [JsonProperty(PropertyName = "apiKeyIdentifier")] + public string ApiKeyIdentifier { get; set; } + + /// + /// Gets or sets marks if the key should sent in header + /// + [JsonProperty(PropertyName = "isApiKeyInPostPayload")] + public string IsApiKeyInPostPayload { get; set; } + + /// + /// Gets or sets describes the flow name, for example 'AuthCode' for + /// Oauth 2.0 + /// + [JsonProperty(PropertyName = "flowName")] + public string FlowName { get; set; } + + /// + /// Gets or sets the endpoint used to issue a token, used in Oauth 2.0 + /// flow + /// + [JsonProperty(PropertyName = "tokenEndpoint")] + public string TokenEndpoint { get; set; } + + /// + /// Gets or sets the endpoint used to authorize the user, used in Oauth + /// 2.0 flow + /// + [JsonProperty(PropertyName = "authorizationEndpoint")] + public string AuthorizationEndpoint { get; set; } + + /// + /// Gets or sets the query parameters used in authorization request, + /// used in Oauth 2.0 flow + /// + [JsonProperty(PropertyName = "authorizationEndpointQueryParameters")] + public object AuthorizationEndpointQueryParameters { get; set; } + + /// + /// Gets or sets the redirect endpoint where we will get the + /// authorization code, used in Oauth 2.0 flow + /// + [JsonProperty(PropertyName = "redirectionEndpoint")] + public string RedirectionEndpoint { get; set; } + + /// + /// Gets or sets the query headers used in token request, used in Oauth + /// 2.0 flow + /// + [JsonProperty(PropertyName = "tokenEndpointHeaders")] + public object TokenEndpointHeaders { get; set; } + + /// + /// Gets or sets the query parameters used in token request, used in + /// Oauth 2.0 flow + /// + [JsonProperty(PropertyName = "tokenEndpointQueryParameters")] + public object TokenEndpointQueryParameters { get; set; } + + /// + /// Gets or sets marks if we should send the client secret in header or + /// payload, used in Oauth 2.0 flow + /// + [JsonProperty(PropertyName = "isClientSecretInHeader")] + public bool? IsClientSecretInHeader { get; set; } + + /// + /// Gets or sets the OAuth token scope + /// + [JsonProperty(PropertyName = "scope")] + public string Scope { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (AuthType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AuthType"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CodelessConnectorPollingConfigProperties.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CodelessConnectorPollingConfigProperties.cs new file mode 100644 index 0000000000000..8ab895f121093 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CodelessConnectorPollingConfigProperties.cs @@ -0,0 +1,124 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Config to describe the polling config for API poller connector + /// + public partial class CodelessConnectorPollingConfigProperties + { + /// + /// Initializes a new instance of the + /// CodelessConnectorPollingConfigProperties class. + /// + public CodelessConnectorPollingConfigProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// CodelessConnectorPollingConfigProperties class. + /// + /// Describe the authentication type of the + /// poller + /// Describe the poll request config parameters + /// of the poller + /// The poller active status + /// Describe the poll request paging config of the + /// poller + /// Describe the response config parameters of + /// the poller + public CodelessConnectorPollingConfigProperties(CodelessConnectorPollingAuthProperties auth, CodelessConnectorPollingRequestProperties request, bool? isActive = default(bool?), CodelessConnectorPollingPagingProperties paging = default(CodelessConnectorPollingPagingProperties), CodelessConnectorPollingResponseProperties response = default(CodelessConnectorPollingResponseProperties)) + { + IsActive = isActive; + Auth = auth; + Request = request; + Paging = paging; + Response = response; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the poller active status + /// + [JsonProperty(PropertyName = "isActive")] + public bool? IsActive { get; set; } + + /// + /// Gets or sets describe the authentication type of the poller + /// + [JsonProperty(PropertyName = "auth")] + public CodelessConnectorPollingAuthProperties Auth { get; set; } + + /// + /// Gets or sets describe the poll request config parameters of the + /// poller + /// + [JsonProperty(PropertyName = "request")] + public CodelessConnectorPollingRequestProperties Request { get; set; } + + /// + /// Gets or sets describe the poll request paging config of the poller + /// + [JsonProperty(PropertyName = "paging")] + public CodelessConnectorPollingPagingProperties Paging { get; set; } + + /// + /// Gets or sets describe the response config parameters of the poller + /// + [JsonProperty(PropertyName = "response")] + public CodelessConnectorPollingResponseProperties Response { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Auth == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Auth"); + } + if (Request == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Request"); + } + if (Auth != null) + { + Auth.Validate(); + } + if (Request != null) + { + Request.Validate(); + } + if (Paging != null) + { + Paging.Validate(); + } + if (Response != null) + { + Response.Validate(); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CodelessConnectorPollingPagingProperties.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CodelessConnectorPollingPagingProperties.cs new file mode 100644 index 0000000000000..3a763555d31de --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CodelessConnectorPollingPagingProperties.cs @@ -0,0 +1,142 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describe the properties needed to make a pagination call + /// + public partial class CodelessConnectorPollingPagingProperties + { + /// + /// Initializes a new instance of the + /// CodelessConnectorPollingPagingProperties class. + /// + public CodelessConnectorPollingPagingProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// CodelessConnectorPollingPagingProperties class. + /// + /// Describes the type. could be 'None', + /// 'PageToken', 'PageCount', 'TimeStamp' + /// Defines the name of a next page + /// attribute + /// Defines the path to a next page + /// token JSON + /// Defines the path to a page + /// count attribute + /// Defines the path to a + /// page total count attribute + /// Defines the path to a + /// paging time stamp attribute + /// Determines + /// whether to search for the latest time stamp in the events + /// list + /// Defines the name of the page size + /// parameter + /// Defines the paging size + public CodelessConnectorPollingPagingProperties(string pagingType, string nextPageParaName = default(string), string nextPageTokenJsonPath = default(string), string pageCountAttributePath = default(string), string pageTotalCountAttributePath = default(string), string pageTimeStampAttributePath = default(string), string searchTheLatestTimeStampFromEventsList = default(string), string pageSizeParaName = default(string), int? pageSize = default(int?)) + { + PagingType = pagingType; + NextPageParaName = nextPageParaName; + NextPageTokenJsonPath = nextPageTokenJsonPath; + PageCountAttributePath = pageCountAttributePath; + PageTotalCountAttributePath = pageTotalCountAttributePath; + PageTimeStampAttributePath = pageTimeStampAttributePath; + SearchTheLatestTimeStampFromEventsList = searchTheLatestTimeStampFromEventsList; + PageSizeParaName = pageSizeParaName; + PageSize = pageSize; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets describes the type. could be 'None', 'PageToken', + /// 'PageCount', 'TimeStamp' + /// + [JsonProperty(PropertyName = "pagingType")] + public string PagingType { get; set; } + + /// + /// Gets or sets defines the name of a next page attribute + /// + [JsonProperty(PropertyName = "nextPageParaName")] + public string NextPageParaName { get; set; } + + /// + /// Gets or sets defines the path to a next page token JSON + /// + [JsonProperty(PropertyName = "nextPageTokenJsonPath")] + public string NextPageTokenJsonPath { get; set; } + + /// + /// Gets or sets defines the path to a page count attribute + /// + [JsonProperty(PropertyName = "pageCountAttributePath")] + public string PageCountAttributePath { get; set; } + + /// + /// Gets or sets defines the path to a page total count attribute + /// + [JsonProperty(PropertyName = "pageTotalCountAttributePath")] + public string PageTotalCountAttributePath { get; set; } + + /// + /// Gets or sets defines the path to a paging time stamp attribute + /// + [JsonProperty(PropertyName = "pageTimeStampAttributePath")] + public string PageTimeStampAttributePath { get; set; } + + /// + /// Gets or sets determines whether to search for the latest time stamp + /// in the events list + /// + [JsonProperty(PropertyName = "searchTheLatestTimeStampFromEventsList")] + public string SearchTheLatestTimeStampFromEventsList { get; set; } + + /// + /// Gets or sets defines the name of the page size parameter + /// + [JsonProperty(PropertyName = "pageSizeParaName")] + public string PageSizeParaName { get; set; } + + /// + /// Gets or sets defines the paging size + /// + [JsonProperty(PropertyName = "pageSize")] + public int? PageSize { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (PagingType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "PagingType"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CodelessConnectorPollingRequestProperties.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CodelessConnectorPollingRequestProperties.cs new file mode 100644 index 0000000000000..3f3860246f4cc --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CodelessConnectorPollingRequestProperties.cs @@ -0,0 +1,182 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describe the request properties needed to successfully pull from the + /// server + /// + public partial class CodelessConnectorPollingRequestProperties + { + /// + /// Initializes a new instance of the + /// CodelessConnectorPollingRequestProperties class. + /// + public CodelessConnectorPollingRequestProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// CodelessConnectorPollingRequestProperties class. + /// + /// Describe the endpoint we should pull the + /// data from + /// The window interval we will use the + /// pull the data + /// The http method type we will use in the + /// poll request, GET or POST + /// The time format will be used the + /// query events in a specific window + /// Defines the rate limit QPS + /// Describe the amount of time we should try + /// and poll the data in case of failure + /// The number of seconds we will + /// consider as a request timeout + /// Describe the headers sent in the poll + /// request + /// Describe the query parameters sent in + /// the poll request + /// For advanced scenarios for + /// example user name/password embedded in nested JSON payload + /// This will be used the query + /// events from a start of the time window + /// This will be used the query + /// events from the end of the time window + public CodelessConnectorPollingRequestProperties(string apiEndpoint, int queryWindowInMin, string httpMethod, string queryTimeFormat, int? rateLimitQps = default(int?), int? retryCount = default(int?), int? timeoutInSeconds = default(int?), object headers = default(object), object queryParameters = default(object), string queryParametersTemplate = default(string), string startTimeAttributeName = default(string), string endTimeAttributeName = default(string)) + { + ApiEndpoint = apiEndpoint; + RateLimitQps = rateLimitQps; + QueryWindowInMin = queryWindowInMin; + HttpMethod = httpMethod; + QueryTimeFormat = queryTimeFormat; + RetryCount = retryCount; + TimeoutInSeconds = timeoutInSeconds; + Headers = headers; + QueryParameters = queryParameters; + QueryParametersTemplate = queryParametersTemplate; + StartTimeAttributeName = startTimeAttributeName; + EndTimeAttributeName = endTimeAttributeName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets describe the endpoint we should pull the data from + /// + [JsonProperty(PropertyName = "apiEndpoint")] + public string ApiEndpoint { get; set; } + + /// + /// Gets or sets defines the rate limit QPS + /// + [JsonProperty(PropertyName = "rateLimitQps")] + public int? RateLimitQps { get; set; } + + /// + /// Gets or sets the window interval we will use the pull the data + /// + [JsonProperty(PropertyName = "queryWindowInMin")] + public int QueryWindowInMin { get; set; } + + /// + /// Gets or sets the http method type we will use in the poll request, + /// GET or POST + /// + [JsonProperty(PropertyName = "httpMethod")] + public string HttpMethod { get; set; } + + /// + /// Gets or sets the time format will be used the query events in a + /// specific window + /// + [JsonProperty(PropertyName = "queryTimeFormat")] + public string QueryTimeFormat { get; set; } + + /// + /// Gets or sets describe the amount of time we should try and poll the + /// data in case of failure + /// + [JsonProperty(PropertyName = "retryCount")] + public int? RetryCount { get; set; } + + /// + /// Gets or sets the number of seconds we will consider as a request + /// timeout + /// + [JsonProperty(PropertyName = "timeoutInSeconds")] + public int? TimeoutInSeconds { get; set; } + + /// + /// Gets or sets describe the headers sent in the poll request + /// + [JsonProperty(PropertyName = "headers")] + public object Headers { get; set; } + + /// + /// Gets or sets describe the query parameters sent in the poll request + /// + [JsonProperty(PropertyName = "queryParameters")] + public object QueryParameters { get; set; } + + /// + /// Gets or sets for advanced scenarios for example user name/password + /// embedded in nested JSON payload + /// + [JsonProperty(PropertyName = "queryParametersTemplate")] + public string QueryParametersTemplate { get; set; } + + /// + /// Gets or sets this will be used the query events from a start of the + /// time window + /// + [JsonProperty(PropertyName = "startTimeAttributeName")] + public string StartTimeAttributeName { get; set; } + + /// + /// Gets or sets this will be used the query events from the end of the + /// time window + /// + [JsonProperty(PropertyName = "endTimeAttributeName")] + public string EndTimeAttributeName { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ApiEndpoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ApiEndpoint"); + } + if (HttpMethod == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "HttpMethod"); + } + if (QueryTimeFormat == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "QueryTimeFormat"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CodelessConnectorPollingResponseProperties.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CodelessConnectorPollingResponseProperties.cs new file mode 100644 index 0000000000000..a319eac6737fe --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CodelessConnectorPollingResponseProperties.cs @@ -0,0 +1,100 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes the response from the external server + /// + public partial class CodelessConnectorPollingResponseProperties + { + /// + /// Initializes a new instance of the + /// CodelessConnectorPollingResponseProperties class. + /// + public CodelessConnectorPollingResponseProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// CodelessConnectorPollingResponseProperties class. + /// + /// Describes the path we should extract + /// the data in the response + /// Describes the path we should + /// extract the status code in the response + /// Describes the path we should + /// extract the status value in the response + /// Describes if the data in the + /// response is Gzip + public CodelessConnectorPollingResponseProperties(IList eventsJsonPaths, string successStatusJsonPath = default(string), string successStatusValue = default(string), bool? isGzipCompressed = default(bool?)) + { + EventsJsonPaths = eventsJsonPaths; + SuccessStatusJsonPath = successStatusJsonPath; + SuccessStatusValue = successStatusValue; + IsGzipCompressed = isGzipCompressed; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets describes the path we should extract the data in the + /// response + /// + [JsonProperty(PropertyName = "eventsJsonPaths")] + public IList EventsJsonPaths { get; set; } + + /// + /// Gets or sets describes the path we should extract the status code + /// in the response + /// + [JsonProperty(PropertyName = "successStatusJsonPath")] + public string SuccessStatusJsonPath { get; set; } + + /// + /// Gets or sets describes the path we should extract the status value + /// in the response + /// + [JsonProperty(PropertyName = "successStatusValue")] + public string SuccessStatusValue { get; set; } + + /// + /// Gets or sets describes if the data in the response is Gzip + /// + [JsonProperty(PropertyName = "isGzipCompressed")] + public bool? IsGzipCompressed { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (EventsJsonPaths == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "EventsJsonPaths"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CodelessUiConnectorConfigProperties.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CodelessUiConnectorConfigProperties.cs new file mode 100644 index 0000000000000..39c3032f73c86 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CodelessUiConnectorConfigProperties.cs @@ -0,0 +1,208 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Config to describe the instructions blade + /// + public partial class CodelessUiConnectorConfigProperties + { + /// + /// Initializes a new instance of the + /// CodelessUiConnectorConfigProperties class. + /// + public CodelessUiConnectorConfigProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// CodelessUiConnectorConfigProperties class. + /// + /// Connector blade title + /// Connector publisher name + /// Connector description + /// Name of the table the connector + /// will insert the data to + /// The graph query to show the current data + /// status + /// The sample queries for the + /// connector + /// Data types to check for last data + /// received + /// Define the way the connector + /// check connectivity + /// Connector Availability Status + /// Permissions required for the + /// connector + /// Instruction steps to enable the + /// connector + /// An optional custom image to be used when + /// displaying the connector within Azure Sentinel's connector's + /// gallery + public CodelessUiConnectorConfigProperties(string title, string publisher, string descriptionMarkdown, string graphQueriesTableName, IList graphQueries, IList sampleQueries, IList dataTypes, IList connectivityCriteria, Availability availability, Permissions permissions, IList instructionSteps, string customImage = default(string)) + { + Title = title; + Publisher = publisher; + DescriptionMarkdown = descriptionMarkdown; + CustomImage = customImage; + GraphQueriesTableName = graphQueriesTableName; + GraphQueries = graphQueries; + SampleQueries = sampleQueries; + DataTypes = dataTypes; + ConnectivityCriteria = connectivityCriteria; + Availability = availability; + Permissions = permissions; + InstructionSteps = instructionSteps; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets connector blade title + /// + [JsonProperty(PropertyName = "title")] + public string Title { get; set; } + + /// + /// Gets or sets connector publisher name + /// + [JsonProperty(PropertyName = "publisher")] + public string Publisher { get; set; } + + /// + /// Gets or sets connector description + /// + [JsonProperty(PropertyName = "descriptionMarkdown")] + public string DescriptionMarkdown { get; set; } + + /// + /// Gets or sets an optional custom image to be used when displaying + /// the connector within Azure Sentinel's connector's gallery + /// + [JsonProperty(PropertyName = "customImage")] + public string CustomImage { get; set; } + + /// + /// Gets or sets name of the table the connector will insert the data + /// to + /// + [JsonProperty(PropertyName = "graphQueriesTableName")] + public string GraphQueriesTableName { get; set; } + + /// + /// Gets or sets the graph query to show the current data status + /// + [JsonProperty(PropertyName = "graphQueries")] + public IList GraphQueries { get; set; } + + /// + /// Gets or sets the sample queries for the connector + /// + [JsonProperty(PropertyName = "sampleQueries")] + public IList SampleQueries { get; set; } + + /// + /// Gets or sets data types to check for last data received + /// + [JsonProperty(PropertyName = "dataTypes")] + public IList DataTypes { get; set; } + + /// + /// Gets or sets define the way the connector check connectivity + /// + [JsonProperty(PropertyName = "connectivityCriteria")] + public IList ConnectivityCriteria { get; set; } + + /// + /// Gets or sets connector Availability Status + /// + [JsonProperty(PropertyName = "availability")] + public Availability Availability { get; set; } + + /// + /// Gets or sets permissions required for the connector + /// + [JsonProperty(PropertyName = "permissions")] + public Permissions Permissions { get; set; } + + /// + /// Gets or sets instruction steps to enable the connector + /// + [JsonProperty(PropertyName = "instructionSteps")] + public IList InstructionSteps { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Title == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Title"); + } + if (Publisher == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Publisher"); + } + if (DescriptionMarkdown == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DescriptionMarkdown"); + } + if (GraphQueriesTableName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "GraphQueriesTableName"); + } + if (GraphQueries == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "GraphQueries"); + } + if (SampleQueries == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SampleQueries"); + } + if (DataTypes == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DataTypes"); + } + if (ConnectivityCriteria == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ConnectivityCriteria"); + } + if (Availability == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Availability"); + } + if (Permissions == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Permissions"); + } + if (InstructionSteps == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "InstructionSteps"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CodelessUiConnectorConfigPropertiesConnectivityCriteriaItem.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CodelessUiConnectorConfigPropertiesConnectivityCriteriaItem.cs new file mode 100644 index 0000000000000..896db48d07f0d --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CodelessUiConnectorConfigPropertiesConnectivityCriteriaItem.cs @@ -0,0 +1,47 @@ +// +// 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.Models +{ + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class CodelessUiConnectorConfigPropertiesConnectivityCriteriaItem : ConnectivityCriteria + { + /// + /// Initializes a new instance of the + /// CodelessUiConnectorConfigPropertiesConnectivityCriteriaItem class. + /// + public CodelessUiConnectorConfigPropertiesConnectivityCriteriaItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// CodelessUiConnectorConfigPropertiesConnectivityCriteriaItem class. + /// + /// type of connectivity. Possible values include: + /// 'IsConnectedQuery' + /// Queries for checking connectivity + public CodelessUiConnectorConfigPropertiesConnectivityCriteriaItem(string type = default(string), IList value = default(IList)) + : base(type, value) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CodelessUiConnectorConfigPropertiesDataTypesItem.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CodelessUiConnectorConfigPropertiesDataTypesItem.cs new file mode 100644 index 0000000000000..17ae577886451 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CodelessUiConnectorConfigPropertiesDataTypesItem.cs @@ -0,0 +1,46 @@ +// +// 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.Models +{ + using System.Linq; + + public partial class CodelessUiConnectorConfigPropertiesDataTypesItem : LastDataReceivedDataType + { + /// + /// Initializes a new instance of the + /// CodelessUiConnectorConfigPropertiesDataTypesItem class. + /// + public CodelessUiConnectorConfigPropertiesDataTypesItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// CodelessUiConnectorConfigPropertiesDataTypesItem class. + /// + /// Name of the data type to show in the graph. can + /// be use with {{graphQueriesTableName}} placeholder + /// Query for indicate last data + /// received + public CodelessUiConnectorConfigPropertiesDataTypesItem(string name = default(string), string lastDataReceivedQuery = default(string)) + : base(name, lastDataReceivedQuery) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CodelessUiConnectorConfigPropertiesGraphQueriesItem.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CodelessUiConnectorConfigPropertiesGraphQueriesItem.cs new file mode 100644 index 0000000000000..0f533610c63cb --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CodelessUiConnectorConfigPropertiesGraphQueriesItem.cs @@ -0,0 +1,46 @@ +// +// 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.Models +{ + using System.Linq; + + public partial class CodelessUiConnectorConfigPropertiesGraphQueriesItem : GraphQueries + { + /// + /// Initializes a new instance of the + /// CodelessUiConnectorConfigPropertiesGraphQueriesItem class. + /// + public CodelessUiConnectorConfigPropertiesGraphQueriesItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// CodelessUiConnectorConfigPropertiesGraphQueriesItem class. + /// + /// the metric that the query is + /// checking + /// The legend for the graph + /// The base query for the graph + public CodelessUiConnectorConfigPropertiesGraphQueriesItem(string metricName = default(string), string legend = default(string), string baseQuery = default(string)) + : base(metricName, legend, baseQuery) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CodelessUiConnectorConfigPropertiesInstructionStepsItem.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CodelessUiConnectorConfigPropertiesInstructionStepsItem.cs new file mode 100644 index 0000000000000..8344fd1795907 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CodelessUiConnectorConfigPropertiesInstructionStepsItem.cs @@ -0,0 +1,47 @@ +// +// 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.Models +{ + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class CodelessUiConnectorConfigPropertiesInstructionStepsItem : InstructionSteps + { + /// + /// Initializes a new instance of the + /// CodelessUiConnectorConfigPropertiesInstructionStepsItem class. + /// + public CodelessUiConnectorConfigPropertiesInstructionStepsItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// CodelessUiConnectorConfigPropertiesInstructionStepsItem class. + /// + /// Instruction step title + /// Instruction step description + /// Instruction step details + public CodelessUiConnectorConfigPropertiesInstructionStepsItem(string title = default(string), string description = default(string), IList instructions = default(IList)) + : base(title, description, instructions) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CodelessUiConnectorConfigPropertiesSampleQueriesItem.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CodelessUiConnectorConfigPropertiesSampleQueriesItem.cs new file mode 100644 index 0000000000000..3c41833cdc014 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CodelessUiConnectorConfigPropertiesSampleQueriesItem.cs @@ -0,0 +1,44 @@ +// +// 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.Models +{ + using System.Linq; + + public partial class CodelessUiConnectorConfigPropertiesSampleQueriesItem : SampleQueries + { + /// + /// Initializes a new instance of the + /// CodelessUiConnectorConfigPropertiesSampleQueriesItem class. + /// + public CodelessUiConnectorConfigPropertiesSampleQueriesItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// CodelessUiConnectorConfigPropertiesSampleQueriesItem class. + /// + /// The sample query description + /// the sample query + public CodelessUiConnectorConfigPropertiesSampleQueriesItem(string description = default(string), string query = default(string)) + : base(description, query) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CodelessUiDataConnector.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CodelessUiDataConnector.cs new file mode 100644 index 0000000000000..322e5adea866f --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CodelessUiDataConnector.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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents Codeless UI data connector. + /// + [Newtonsoft.Json.JsonObject("GenericUI")] + [Rest.Serialization.JsonTransformation] + public partial class CodelessUiDataConnector : DataConnector + { + /// + /// Initializes a new instance of the CodelessUiDataConnector class. + /// + public CodelessUiDataConnector() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CodelessUiDataConnector class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Etag of the azure resource + /// Config to describe the instructions + /// blade + public CodelessUiDataConnector(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string), CodelessUiConnectorConfigProperties connectorUiConfig = default(CodelessUiConnectorConfigProperties)) + : base(id, name, type, systemData, etag) + { + ConnectorUiConfig = connectorUiConfig; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets config to describe the instructions blade + /// + [JsonProperty(PropertyName = "properties.connectorUiConfig")] + public CodelessUiConnectorConfigProperties ConnectorUiConfig { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ConnectorUiConfig != null) + { + ConnectorUiConfig.Validate(); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CaseSeverity.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ConfidenceLevel.cs similarity index 59% rename from sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CaseSeverity.cs rename to sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ConfidenceLevel.cs index c6780bb5236a3..8cc0d1c0ca290 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CaseSeverity.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ConfidenceLevel.cs @@ -12,29 +12,22 @@ namespace Microsoft.Azure.Management.SecurityInsights.Models { /// - /// Defines values for CaseSeverity. + /// Defines values for ConfidenceLevel. /// - public static class CaseSeverity + public static class ConfidenceLevel { /// - /// Critical severity + /// Unknown confidence, the is the default value /// - public const string Critical = "Critical"; + public const string Unknown = "Unknown"; /// - /// High severity - /// - public const string High = "High"; - /// - /// Medium severity - /// - public const string Medium = "Medium"; - /// - /// Low severity + /// Low confidence, meaning we have some doubts this is indeed + /// malicious or part of an attack /// public const string Low = "Low"; /// - /// Informational severity + /// High confidence that the alert is true positive malicious /// - public const string Informational = "Informational"; + public const string High = "High"; } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ConfidenceScoreStatus.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ConfidenceScoreStatus.cs new file mode 100644 index 0000000000000..954928060d6cc --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ConfidenceScoreStatus.cs @@ -0,0 +1,39 @@ +// +// 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.Models +{ + + /// + /// Defines values for ConfidenceScoreStatus. + /// + public static class ConfidenceScoreStatus + { + /// + /// Score will not be calculated for this alert as it is not supported + /// by virtual analyst + /// + public const string NotApplicable = "NotApplicable"; + /// + /// No score was set yet and calculation is in progress + /// + public const string InProcess = "InProcess"; + /// + /// Score is calculated and shown as part of the alert, but may be + /// updated again at a later time following the processing of + /// additional data + /// + public const string NotFinal = "NotFinal"; + /// + /// Final score was calculated and available + /// + public const string Final = "Final"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ConnectAuthKind.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ConnectAuthKind.cs new file mode 100644 index 0000000000000..cd386e546aff9 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ConnectAuthKind.cs @@ -0,0 +1,23 @@ +// +// 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.Models +{ + + /// + /// Defines values for ConnectAuthKind. + /// + public static class ConnectAuthKind + { + public const string Basic = "Basic"; + public const string OAuth2 = "OAuth2"; + public const string APIKey = "APIKey"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ConnectedEntity.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ConnectedEntity.cs new file mode 100644 index 0000000000000..95b71f80e37a4 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ConnectedEntity.cs @@ -0,0 +1,61 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Expansion result connected entities + /// + public partial class ConnectedEntity + { + /// + /// Initializes a new instance of the ConnectedEntity class. + /// + public ConnectedEntity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ConnectedEntity class. + /// + /// Entity Id of the connected + /// entity + /// key-value pairs for a connected entity + /// mapping + public ConnectedEntity(string targetEntityId = default(string), object additionalData = default(object)) + { + TargetEntityId = targetEntityId; + AdditionalData = additionalData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets entity Id of the connected entity + /// + [JsonProperty(PropertyName = "targetEntityId")] + public string TargetEntityId { get; set; } + + /// + /// Gets or sets key-value pairs for a connected entity mapping + /// + [JsonProperty(PropertyName = "additionalData")] + public object AdditionalData { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ConnectivityCriteria.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ConnectivityCriteria.cs new file mode 100644 index 0000000000000..1d906edbff876 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ConnectivityCriteria.cs @@ -0,0 +1,63 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Setting for the connector check connectivity + /// + public partial class ConnectivityCriteria + { + /// + /// Initializes a new instance of the ConnectivityCriteria class. + /// + public ConnectivityCriteria() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ConnectivityCriteria class. + /// + /// type of connectivity. Possible values include: + /// 'IsConnectedQuery' + /// Queries for checking connectivity + public ConnectivityCriteria(string type = default(string), IList value = default(IList)) + { + Type = type; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets type of connectivity. Possible values include: + /// 'IsConnectedQuery' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets queries for checking connectivity + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/StatusInMcas.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ConnectivityType.cs similarity index 72% rename from sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/StatusInMcas.cs rename to sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ConnectivityType.cs index 397794960d901..8b5d84f0479fa 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/StatusInMcas.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ConnectivityType.cs @@ -12,11 +12,10 @@ namespace Microsoft.Azure.Management.SecurityInsights.Models { /// - /// Defines values for StatusInMcas. + /// Defines values for ConnectivityType. /// - public static class StatusInMcas + public static class ConnectivityType { - public const string Enabled = "Enabled"; - public const string Disabled = "Disabled"; + public const string IsConnectedQuery = "IsConnectedQuery"; } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ConnectorInstructionModelBase.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ConnectorInstructionModelBase.cs new file mode 100644 index 0000000000000..00f58006eec1d --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ConnectorInstructionModelBase.cs @@ -0,0 +1,78 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Instruction step details + /// + public partial class ConnectorInstructionModelBase + { + /// + /// Initializes a new instance of the ConnectorInstructionModelBase + /// class. + /// + public ConnectorInstructionModelBase() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ConnectorInstructionModelBase + /// class. + /// + /// The kind of the setting. Possible values + /// include: 'CopyableLabel', 'InstructionStepsGroup', + /// 'InfoMessage' + /// The parameters for the setting + public ConnectorInstructionModelBase(string type, object parameters = default(object)) + { + Parameters = parameters; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the parameters for the setting + /// + [JsonProperty(PropertyName = "parameters")] + public object Parameters { get; set; } + + /// + /// Gets or sets the kind of the setting. Possible values include: + /// 'CopyableLabel', 'InstructionStepsGroup', 'InfoMessage' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Type == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Type"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ContentPathMap.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ContentPathMap.cs new file mode 100644 index 0000000000000..2582dea1203b4 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ContentPathMap.cs @@ -0,0 +1,61 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The mapping of content type to a repo path. + /// + public partial class ContentPathMap + { + /// + /// Initializes a new instance of the ContentPathMap class. + /// + public ContentPathMap() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ContentPathMap class. + /// + /// Content type. Possible values include: + /// 'AnalyticRule', 'Workbook' + /// The path to the content. + public ContentPathMap(string contentType = default(string), string path = default(string)) + { + ContentType = contentType; + Path = path; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets content type. Possible values include: 'AnalyticRule', + /// 'Workbook' + /// + [JsonProperty(PropertyName = "contentType")] + public string ContentType { get; set; } + + /// + /// Gets or sets the path to the content. + /// + [JsonProperty(PropertyName = "path")] + public string Path { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SettingKind.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ContentType.cs similarity index 70% rename from sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SettingKind.cs rename to sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ContentType.cs index 663b0f801f7f0..d8b28b7c6b7fb 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SettingKind.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ContentType.cs @@ -12,11 +12,11 @@ namespace Microsoft.Azure.Management.SecurityInsights.Models { /// - /// Defines values for SettingKind. + /// Defines values for ContentType. /// - public static class SettingKind + public static class ContentType { - public const string UebaSettings = "UebaSettings"; - public const string ToggleSettings = "ToggleSettings"; + public const string AnalyticRule = "AnalyticRule"; + public const string Workbook = "Workbook"; } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CreatedByType.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CreatedByType.cs new file mode 100644 index 0000000000000..3cd5fb995c533 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CreatedByType.cs @@ -0,0 +1,24 @@ +// +// 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.Models +{ + + /// + /// Defines values for CreatedByType. + /// + public static class CreatedByType + { + public const string User = "User"; + public const string Application = "Application"; + public const string ManagedIdentity = "ManagedIdentity"; + public const string Key = "Key"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CustomEntityQuery.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CustomEntityQuery.cs new file mode 100644 index 0000000000000..f7749fa7514bb --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CustomEntityQuery.cs @@ -0,0 +1,52 @@ +// +// 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.Models +{ + using System.Linq; + + /// + /// Specific entity query that supports put requests. + /// + public partial class CustomEntityQuery : ResourceWithEtag + { + /// + /// Initializes a new instance of the CustomEntityQuery class. + /// + public CustomEntityQuery() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CustomEntityQuery class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Etag of the azure resource + public CustomEntityQuery(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string)) + : base(id, name, type, systemData, etag) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/LicenseStatus.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CustomEntityQueryKind.cs similarity index 72% rename from sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/LicenseStatus.cs rename to sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CustomEntityQueryKind.cs index 5791bdcbd9b92..67fafc2169c41 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/LicenseStatus.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CustomEntityQueryKind.cs @@ -12,11 +12,10 @@ namespace Microsoft.Azure.Management.SecurityInsights.Models { /// - /// Defines values for LicenseStatus. + /// Defines values for CustomEntityQueryKind. /// - public static class LicenseStatus + public static class CustomEntityQueryKind { - public const string Enabled = "Enabled"; - public const string Disabled = "Disabled"; + public const string Activity = "Activity"; } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Customs.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Customs.cs new file mode 100644 index 0000000000000..fb60cd1168895 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Customs.cs @@ -0,0 +1,45 @@ +// +// 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.Models +{ + using System.Linq; + + /// + /// Customs permissions required for the connector + /// + public partial class Customs : CustomsPermission + { + /// + /// Initializes a new instance of the Customs class. + /// + public Customs() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Customs class. + /// + /// Customs permissions name + /// Customs permissions description + public Customs(string name = default(string), string description = default(string)) + : base(name, description) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CustomsPermission.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CustomsPermission.cs new file mode 100644 index 0000000000000..6d503f1cf0c30 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CustomsPermission.cs @@ -0,0 +1,59 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Customs permissions required for the connector + /// + public partial class CustomsPermission + { + /// + /// Initializes a new instance of the CustomsPermission class. + /// + public CustomsPermission() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CustomsPermission class. + /// + /// Customs permissions name + /// Customs permissions description + public CustomsPermission(string name = default(string), string description = default(string)) + { + Name = name; + Description = description; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets customs permissions name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets customs permissions description + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnector.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnector.cs index 41ea4bba92e3e..c6aeaefdb1a43 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnector.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnector.cs @@ -13,7 +13,7 @@ namespace Microsoft.Azure.Management.SecurityInsights.Models using System.Linq; /// - /// Data connector. + /// Data connector /// public partial class DataConnector : ResourceWithEtag { @@ -28,12 +28,17 @@ public DataConnector() /// /// Initializes a new instance of the DataConnector class. /// - /// Azure resource Id - /// Azure resource name - /// Azure resource type + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. /// Etag of the azure resource - public DataConnector(string id = default(string), string name = default(string), string type = default(string), string etag = default(string)) - : base(id, name, type, etag) + public DataConnector(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string)) + : base(id, name, type, systemData, etag) { CustomInit(); } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorAuthorizationState.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorAuthorizationState.cs new file mode 100644 index 0000000000000..2a43f735cd076 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorAuthorizationState.cs @@ -0,0 +1,22 @@ +// +// 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.Models +{ + + /// + /// Defines values for DataConnectorAuthorizationState. + /// + public static class DataConnectorAuthorizationState + { + public const string Valid = "Valid"; + public const string Invalid = "Invalid"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorConnectBody.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorConnectBody.cs new file mode 100644 index 0000000000000..a188ff4b082c0 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorConnectBody.cs @@ -0,0 +1,115 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents Codeless API Polling data connector. + /// + public partial class DataConnectorConnectBody + { + /// + /// Initializes a new instance of the DataConnectorConnectBody class. + /// + public DataConnectorConnectBody() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataConnectorConnectBody class. + /// + /// The authentication kind used to poll the data. + /// Possible values include: 'Basic', 'OAuth2', 'APIKey' + /// The API key of the audit server. + /// The client secret of the OAuth 2.0 + /// application. + /// The client id of the OAuth 2.0 + /// application. + /// The authorization code used in + /// OAuth 2.0 code flow to issue a token. + /// The user name in the audit log + /// server. + /// The user password in the audit log + /// server. + public DataConnectorConnectBody(string kind = default(string), string apiKey = default(string), string clientSecret = default(string), string clientId = default(string), string authorizationCode = default(string), string userName = default(string), string password = default(string), IList requestConfigUserInputValues = default(IList)) + { + Kind = kind; + ApiKey = apiKey; + ClientSecret = clientSecret; + ClientId = clientId; + AuthorizationCode = authorizationCode; + UserName = userName; + Password = password; + RequestConfigUserInputValues = requestConfigUserInputValues; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the authentication kind used to poll the data. + /// Possible values include: 'Basic', 'OAuth2', 'APIKey' + /// + [JsonProperty(PropertyName = "kind")] + public string Kind { get; set; } + + /// + /// Gets or sets the API key of the audit server. + /// + [JsonProperty(PropertyName = "apiKey")] + public string ApiKey { get; set; } + + /// + /// Gets or sets the client secret of the OAuth 2.0 application. + /// + [JsonProperty(PropertyName = "clientSecret")] + public string ClientSecret { get; set; } + + /// + /// Gets or sets the client id of the OAuth 2.0 application. + /// + [JsonProperty(PropertyName = "clientId")] + public string ClientId { get; set; } + + /// + /// Gets or sets the authorization code used in OAuth 2.0 code flow to + /// issue a token. + /// + [JsonProperty(PropertyName = "authorizationCode")] + public string AuthorizationCode { get; set; } + + /// + /// Gets or sets the user name in the audit log server. + /// + [JsonProperty(PropertyName = "userName")] + public string UserName { get; set; } + + /// + /// Gets or sets the user password in the audit log server. + /// + [JsonProperty(PropertyName = "password")] + public string Password { get; set; } + + /// + /// + [JsonProperty(PropertyName = "requestConfigUserInputValues")] + public IList RequestConfigUserInputValues { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorDataTypeCommon.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorDataTypeCommon.cs index 322fd804d6c76..b02c3130bd20b 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorDataTypeCommon.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorDataTypeCommon.cs @@ -10,6 +10,7 @@ namespace Microsoft.Azure.Management.SecurityInsights.Models { + using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -34,7 +35,7 @@ public DataConnectorDataTypeCommon() /// Describe whether this data type connection is /// enabled or not. Possible values include: 'Enabled', /// 'Disabled' - public DataConnectorDataTypeCommon(string state = default(string)) + public DataConnectorDataTypeCommon(string state) { State = state; CustomInit(); @@ -52,5 +53,18 @@ public DataConnectorDataTypeCommon() [JsonProperty(PropertyName = "state")] public string State { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (State == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "State"); + } + } } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorKind.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorKind.cs index 6db67ec03c55b..ef6b891acd5dd 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorKind.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorKind.cs @@ -20,9 +20,18 @@ public static class DataConnectorKind public const string AzureSecurityCenter = "AzureSecurityCenter"; public const string MicrosoftCloudAppSecurity = "MicrosoftCloudAppSecurity"; public const string ThreatIntelligence = "ThreatIntelligence"; + public const string ThreatIntelligenceTaxii = "ThreatIntelligenceTaxii"; public const string Office365 = "Office365"; + public const string OfficeATP = "OfficeATP"; + public const string OfficeIRM = "OfficeIRM"; public const string AmazonWebServicesCloudTrail = "AmazonWebServicesCloudTrail"; + public const string AmazonWebServicesS3 = "AmazonWebServicesS3"; public const string AzureAdvancedThreatProtection = "AzureAdvancedThreatProtection"; public const string MicrosoftDefenderAdvancedThreatProtection = "MicrosoftDefenderAdvancedThreatProtection"; + public const string Dynamics365 = "Dynamics365"; + public const string MicrosoftThreatProtection = "MicrosoftThreatProtection"; + public const string MicrosoftThreatIntelligence = "MicrosoftThreatIntelligence"; + public const string GenericUI = "GenericUI"; + public const string APIPolling = "APIPolling"; } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorLicenseState.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorLicenseState.cs new file mode 100644 index 0000000000000..231fab963a022 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorLicenseState.cs @@ -0,0 +1,23 @@ +// +// 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.Models +{ + + /// + /// Defines values for DataConnectorLicenseState. + /// + public static class DataConnectorLicenseState + { + public const string Valid = "Valid"; + public const string Invalid = "Invalid"; + public const string Unknown = "Unknown"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorRequirementsState.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorRequirementsState.cs new file mode 100644 index 0000000000000..a213cdd5427eb --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorRequirementsState.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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Data connector requirements status. + /// + public partial class DataConnectorRequirementsState + { + /// + /// Initializes a new instance of the DataConnectorRequirementsState + /// class. + /// + public DataConnectorRequirementsState() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataConnectorRequirementsState + /// class. + /// + /// Authorization state for this + /// connector. Possible values include: 'Valid', 'Invalid' + /// License state for this connector. + /// Possible values include: 'Valid', 'Invalid', 'Unknown' + public DataConnectorRequirementsState(string authorizationState = default(string), string licenseState = default(string)) + { + AuthorizationState = authorizationState; + LicenseState = licenseState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets authorization state for this connector. Possible + /// values include: 'Valid', 'Invalid' + /// + [JsonProperty(PropertyName = "authorizationState")] + public string AuthorizationState { get; set; } + + /// + /// Gets or sets license state for this connector. Possible values + /// include: 'Valid', 'Invalid', 'Unknown' + /// + [JsonProperty(PropertyName = "licenseState")] + public string LicenseState { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorTenantId.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorTenantId.cs index 58c3b3457f4c1..05f76fd6c7675 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorTenantId.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorTenantId.cs @@ -10,6 +10,7 @@ namespace Microsoft.Azure.Management.SecurityInsights.Models { + using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -31,7 +32,7 @@ public DataConnectorTenantId() /// /// The tenant id to connect to, and get the /// data from. - public DataConnectorTenantId(string tenantId = default(string)) + public DataConnectorTenantId(string tenantId) { TenantId = tenantId; CustomInit(); @@ -48,5 +49,18 @@ public DataConnectorTenantId() [JsonProperty(PropertyName = "tenantId")] public string TenantId { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (TenantId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TenantId"); + } + } } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorWithAlertsProperties.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorWithAlertsProperties.cs index b11f7fa33d1b1..513a9a2f07fea 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorWithAlertsProperties.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorWithAlertsProperties.cs @@ -50,5 +50,18 @@ public DataConnectorWithAlertsProperties() [JsonProperty(PropertyName = "dataTypes")] public AlertsDataTypeOfDataConnector DataTypes { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DataTypes != null) + { + DataTypes.Validate(); + } + } } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorsCheckRequirements.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorsCheckRequirements.cs new file mode 100644 index 0000000000000..9adbf44a09a99 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorsCheckRequirements.cs @@ -0,0 +1,36 @@ +// +// 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.Models +{ + using System.Linq; + + /// + /// Data connector requirements properties. + /// + public partial class DataConnectorsCheckRequirements + { + /// + /// Initializes a new instance of the DataConnectorsCheckRequirements + /// class. + /// + public DataConnectorsCheckRequirements() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataTypeDefinitions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataTypeDefinitions.cs new file mode 100644 index 0000000000000..39588a7f5217b --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataTypeDefinitions.cs @@ -0,0 +1,51 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The data type definition + /// + public partial class DataTypeDefinitions + { + /// + /// Initializes a new instance of the DataTypeDefinitions class. + /// + public DataTypeDefinitions() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataTypeDefinitions class. + /// + /// The data type name + public DataTypeDefinitions(string dataType = default(string)) + { + DataType = dataType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the data type name + /// + [JsonProperty(PropertyName = "dataType")] + public string DataType { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DeliveryAction.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DeliveryAction.cs new file mode 100644 index 0000000000000..80e8366eaa8ee --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DeliveryAction.cs @@ -0,0 +1,93 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for DeliveryAction. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum DeliveryAction + { + /// + /// Unknown + /// + [EnumMember(Value = "Unknown")] + Unknown, + /// + /// DeliveredAsSpam + /// + [EnumMember(Value = "DeliveredAsSpam")] + DeliveredAsSpam, + /// + /// Delivered + /// + [EnumMember(Value = "Delivered")] + Delivered, + /// + /// Blocked + /// + [EnumMember(Value = "Blocked")] + Blocked, + /// + /// Replaced + /// + [EnumMember(Value = "Replaced")] + Replaced + } + internal static class DeliveryActionEnumExtension + { + internal static string ToSerializedValue(this DeliveryAction? value) + { + return value == null ? null : ((DeliveryAction)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this DeliveryAction value) + { + switch( value ) + { + case DeliveryAction.Unknown: + return "Unknown"; + case DeliveryAction.DeliveredAsSpam: + return "DeliveredAsSpam"; + case DeliveryAction.Delivered: + return "Delivered"; + case DeliveryAction.Blocked: + return "Blocked"; + case DeliveryAction.Replaced: + return "Replaced"; + } + return null; + } + + internal static DeliveryAction? ParseDeliveryAction(this string value) + { + switch( value ) + { + case "Unknown": + return DeliveryAction.Unknown; + case "DeliveredAsSpam": + return DeliveryAction.DeliveredAsSpam; + case "Delivered": + return DeliveryAction.Delivered; + case "Blocked": + return DeliveryAction.Blocked; + case "Replaced": + return DeliveryAction.Replaced; + } + return null; + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DeliveryLocation.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DeliveryLocation.cs new file mode 100644 index 0000000000000..1b77e05e79295 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DeliveryLocation.cs @@ -0,0 +1,129 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for DeliveryLocation. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum DeliveryLocation + { + /// + /// Unknown + /// + [EnumMember(Value = "Unknown")] + Unknown, + /// + /// Inbox + /// + [EnumMember(Value = "Inbox")] + Inbox, + /// + /// JunkFolder + /// + [EnumMember(Value = "JunkFolder")] + JunkFolder, + /// + /// DeletedFolder + /// + [EnumMember(Value = "DeletedFolder")] + DeletedFolder, + /// + /// Quarantine + /// + [EnumMember(Value = "Quarantine")] + Quarantine, + /// + /// External + /// + [EnumMember(Value = "External")] + External, + /// + /// Failed + /// + [EnumMember(Value = "Failed")] + Failed, + /// + /// Dropped + /// + [EnumMember(Value = "Dropped")] + Dropped, + /// + /// Forwarded + /// + [EnumMember(Value = "Forwarded")] + Forwarded + } + internal static class DeliveryLocationEnumExtension + { + internal static string ToSerializedValue(this DeliveryLocation? value) + { + return value == null ? null : ((DeliveryLocation)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this DeliveryLocation value) + { + switch( value ) + { + case DeliveryLocation.Unknown: + return "Unknown"; + case DeliveryLocation.Inbox: + return "Inbox"; + case DeliveryLocation.JunkFolder: + return "JunkFolder"; + case DeliveryLocation.DeletedFolder: + return "DeletedFolder"; + case DeliveryLocation.Quarantine: + return "Quarantine"; + case DeliveryLocation.External: + return "External"; + case DeliveryLocation.Failed: + return "Failed"; + case DeliveryLocation.Dropped: + return "Dropped"; + case DeliveryLocation.Forwarded: + return "Forwarded"; + } + return null; + } + + internal static DeliveryLocation? ParseDeliveryLocation(this string value) + { + switch( value ) + { + case "Unknown": + return DeliveryLocation.Unknown; + case "Inbox": + return DeliveryLocation.Inbox; + case "JunkFolder": + return DeliveryLocation.JunkFolder; + case "DeletedFolder": + return DeliveryLocation.DeletedFolder; + case "Quarantine": + return DeliveryLocation.Quarantine; + case "External": + return DeliveryLocation.External; + case "Failed": + return DeliveryLocation.Failed; + case "Dropped": + return DeliveryLocation.Dropped; + case "Forwarded": + return DeliveryLocation.Forwarded; + } + return null; + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DnsEntity.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DnsEntity.cs new file mode 100644 index 0000000000000..575cb10971d1a --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DnsEntity.cs @@ -0,0 +1,116 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents a dns entity. + /// + [Newtonsoft.Json.JsonObject("DnsResolution")] + [Rest.Serialization.JsonTransformation] + public partial class DnsEntity : Entity + { + /// + /// Initializes a new instance of the DnsEntity class. + /// + public DnsEntity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DnsEntity class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// A bag of custom fields that should be + /// part of the entity and will be presented to the user. + /// The graph item display name which is a + /// short humanly readable description of the graph item instance. This + /// property is optional and might be system generated. + /// An ip entity id for the dns + /// server resolving the request + /// The name of the dns record associated with + /// the alert + /// An ip entity id for the dns + /// request client + /// Ip entity identifiers for the + /// resolved ip address. + public DnsEntity(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary additionalData = default(IDictionary), string friendlyName = default(string), string dnsServerIpEntityId = default(string), string domainName = default(string), string hostIpAddressEntityId = default(string), IList ipAddressEntityIds = default(IList)) + : base(id, name, type, systemData) + { + AdditionalData = additionalData; + FriendlyName = friendlyName; + DnsServerIpEntityId = dnsServerIpEntityId; + DomainName = domainName; + HostIpAddressEntityId = hostIpAddressEntityId; + IpAddressEntityIds = ipAddressEntityIds; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a bag of custom fields that should be part of the entity and + /// will be presented to the user. + /// + [JsonProperty(PropertyName = "properties.additionalData")] + public IDictionary AdditionalData { get; private set; } + + /// + /// Gets the graph item display name which is a short humanly readable + /// description of the graph item instance. This property is optional + /// and might be system generated. + /// + [JsonProperty(PropertyName = "properties.friendlyName")] + public string FriendlyName { get; private set; } + + /// + /// Gets an ip entity id for the dns server resolving the request + /// + [JsonProperty(PropertyName = "properties.dnsServerIpEntityId")] + public string DnsServerIpEntityId { get; private set; } + + /// + /// Gets the name of the dns record associated with the alert + /// + [JsonProperty(PropertyName = "properties.domainName")] + public string DomainName { get; private set; } + + /// + /// Gets an ip entity id for the dns request client + /// + [JsonProperty(PropertyName = "properties.hostIpAddressEntityId")] + public string HostIpAddressEntityId { get; private set; } + + /// + /// Gets ip entity identifiers for the resolved ip address. + /// + [JsonProperty(PropertyName = "properties.ipAddressEntityIds")] + public IList IpAddressEntityIds { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Dynamics365CheckRequirements.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Dynamics365CheckRequirements.cs new file mode 100644 index 0000000000000..e067d340ba9fa --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Dynamics365CheckRequirements.cs @@ -0,0 +1,71 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents Dynamics365 requirements check request. + /// + [Newtonsoft.Json.JsonObject("Dynamics365")] + [Rest.Serialization.JsonTransformation] + public partial class Dynamics365CheckRequirements : DataConnectorsCheckRequirements + { + /// + /// Initializes a new instance of the Dynamics365CheckRequirements + /// class. + /// + public Dynamics365CheckRequirements() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Dynamics365CheckRequirements + /// class. + /// + /// The tenant id to connect to, and get the + /// data from. + public Dynamics365CheckRequirements(string tenantId) + { + TenantId = tenantId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the tenant id to connect to, and get the data from. + /// + [JsonProperty(PropertyName = "properties.tenantId")] + public string TenantId { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (TenantId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TenantId"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Dynamics365DataConnector.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Dynamics365DataConnector.cs new file mode 100644 index 0000000000000..ff5abeb191b8b --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Dynamics365DataConnector.cs @@ -0,0 +1,96 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents Dynamics365 data connector. + /// + [Newtonsoft.Json.JsonObject("Dynamics365")] + [Rest.Serialization.JsonTransformation] + public partial class Dynamics365DataConnector : DataConnector + { + /// + /// Initializes a new instance of the Dynamics365DataConnector class. + /// + public Dynamics365DataConnector() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Dynamics365DataConnector class. + /// + /// The tenant id to connect to, and get the + /// data from. + /// The available data types for the + /// connector. + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Etag of the azure resource + public Dynamics365DataConnector(string tenantId, Dynamics365DataConnectorDataTypes dataTypes, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string)) + : base(id, name, type, systemData, etag) + { + TenantId = tenantId; + DataTypes = dataTypes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the tenant id to connect to, and get the data from. + /// + [JsonProperty(PropertyName = "properties.tenantId")] + public string TenantId { get; set; } + + /// + /// Gets or sets the available data types for the connector. + /// + [JsonProperty(PropertyName = "properties.dataTypes")] + public Dynamics365DataConnectorDataTypes DataTypes { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (TenantId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TenantId"); + } + if (DataTypes == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DataTypes"); + } + if (DataTypes != null) + { + DataTypes.Validate(); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Dynamics365DataConnectorDataTypes.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Dynamics365DataConnectorDataTypes.cs new file mode 100644 index 0000000000000..53ae1aa5485cc --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Dynamics365DataConnectorDataTypes.cs @@ -0,0 +1,72 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The available data types for Dynamics365 data connector. + /// + public partial class Dynamics365DataConnectorDataTypes + { + /// + /// Initializes a new instance of the Dynamics365DataConnectorDataTypes + /// class. + /// + public Dynamics365DataConnectorDataTypes() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Dynamics365DataConnectorDataTypes + /// class. + /// + /// Common Data Service data + /// type connection. + public Dynamics365DataConnectorDataTypes(Dynamics365DataConnectorDataTypesDynamics365CdsActivities dynamics365CdsActivities) + { + Dynamics365CdsActivities = dynamics365CdsActivities; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets common Data Service data type connection. + /// + [JsonProperty(PropertyName = "dynamics365CdsActivities")] + public Dynamics365DataConnectorDataTypesDynamics365CdsActivities Dynamics365CdsActivities { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Dynamics365CdsActivities == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Dynamics365CdsActivities"); + } + if (Dynamics365CdsActivities != null) + { + Dynamics365CdsActivities.Validate(); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Dynamics365DataConnectorDataTypesDynamics365CdsActivities.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Dynamics365DataConnectorDataTypesDynamics365CdsActivities.cs new file mode 100644 index 0000000000000..1117fd13efe5e --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Dynamics365DataConnectorDataTypesDynamics365CdsActivities.cs @@ -0,0 +1,58 @@ +// +// 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.Models +{ + using System.Linq; + + /// + /// Common Data Service data type connection. + /// + public partial class Dynamics365DataConnectorDataTypesDynamics365CdsActivities : DataConnectorDataTypeCommon + { + /// + /// Initializes a new instance of the + /// Dynamics365DataConnectorDataTypesDynamics365CdsActivities class. + /// + public Dynamics365DataConnectorDataTypesDynamics365CdsActivities() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// Dynamics365DataConnectorDataTypesDynamics365CdsActivities class. + /// + /// Describe whether this data type connection is + /// enabled or not. Possible values include: 'Enabled', + /// 'Disabled' + public Dynamics365DataConnectorDataTypesDynamics365CdsActivities(string state) + : base(state) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ElevationToken.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ElevationToken.cs new file mode 100644 index 0000000000000..810dfb319f6e1 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ElevationToken.cs @@ -0,0 +1,75 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ElevationToken. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ElevationToken + { + /// + /// Default elevation token + /// + [EnumMember(Value = "Default")] + Default, + /// + /// Full elevation token + /// + [EnumMember(Value = "Full")] + Full, + /// + /// Limited elevation token + /// + [EnumMember(Value = "Limited")] + Limited + } + internal static class ElevationTokenEnumExtension + { + internal static string ToSerializedValue(this ElevationToken? value) + { + return value == null ? null : ((ElevationToken)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ElevationToken value) + { + switch( value ) + { + case ElevationToken.Default: + return "Default"; + case ElevationToken.Full: + return "Full"; + case ElevationToken.Limited: + return "Limited"; + } + return null; + } + + internal static ElevationToken? ParseElevationToken(this string value) + { + switch( value ) + { + case "Default": + return ElevationToken.Default; + case "Full": + return ElevationToken.Full; + case "Limited": + return ElevationToken.Limited; + } + return null; + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EnrichmentDomainWhois.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EnrichmentDomainWhois.cs new file mode 100644 index 0000000000000..3e8d2afcd571a --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EnrichmentDomainWhois.cs @@ -0,0 +1,96 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Whois information for a given domain and associated metadata + /// + public partial class EnrichmentDomainWhois + { + /// + /// Initializes a new instance of the EnrichmentDomainWhois class. + /// + public EnrichmentDomainWhois() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EnrichmentDomainWhois class. + /// + /// The domain for this whois record + /// The hostname of this registrar's whois + /// server + /// The timestamp at which this record was + /// created + /// The timestamp at which this record was last + /// updated + /// The timestamp at which this record will + /// expire + /// The whois record for a given + /// domain + public EnrichmentDomainWhois(string domain = default(string), string server = default(string), System.DateTime? created = default(System.DateTime?), System.DateTime? updated = default(System.DateTime?), System.DateTime? expires = default(System.DateTime?), EnrichmentDomainWhoisDetails parsedWhois = default(EnrichmentDomainWhoisDetails)) + { + Domain = domain; + Server = server; + Created = created; + Updated = updated; + Expires = expires; + ParsedWhois = parsedWhois; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the domain for this whois record + /// + [JsonProperty(PropertyName = "domain")] + public string Domain { get; set; } + + /// + /// Gets or sets the hostname of this registrar's whois server + /// + [JsonProperty(PropertyName = "server")] + public string Server { get; set; } + + /// + /// Gets or sets the timestamp at which this record was created + /// + [JsonProperty(PropertyName = "created")] + public System.DateTime? Created { get; set; } + + /// + /// Gets or sets the timestamp at which this record was last updated + /// + [JsonProperty(PropertyName = "updated")] + public System.DateTime? Updated { get; set; } + + /// + /// Gets or sets the timestamp at which this record will expire + /// + [JsonProperty(PropertyName = "expires")] + public System.DateTime? Expires { get; set; } + + /// + /// Gets or sets the whois record for a given domain + /// + [JsonProperty(PropertyName = "parsedWhois")] + public EnrichmentDomainWhoisDetails ParsedWhois { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EnrichmentDomainWhoisContact.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EnrichmentDomainWhoisContact.cs new file mode 100644 index 0000000000000..f587afdd61a97 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EnrichmentDomainWhoisContact.cs @@ -0,0 +1,128 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An individual contact associated with this domain + /// + public partial class EnrichmentDomainWhoisContact + { + /// + /// Initializes a new instance of the EnrichmentDomainWhoisContact + /// class. + /// + public EnrichmentDomainWhoisContact() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EnrichmentDomainWhoisContact + /// class. + /// + /// The name of this contact + /// The organization for this contact + /// A list describing the street address for this + /// contact + /// The city for this contact + /// The state for this contact + /// The postal code for this contact + /// The country for this contact + /// The phone number for this contact + /// The fax number for this contact + /// The email address for this contact + public EnrichmentDomainWhoisContact(string name = default(string), string org = default(string), IList street = default(IList), string city = default(string), string state = default(string), string postal = default(string), string country = default(string), string phone = default(string), string fax = default(string), string email = default(string)) + { + Name = name; + Org = org; + Street = street; + City = city; + State = state; + Postal = postal; + Country = country; + Phone = phone; + Fax = fax; + Email = email; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of this contact + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the organization for this contact + /// + [JsonProperty(PropertyName = "org")] + public string Org { get; set; } + + /// + /// Gets or sets a list describing the street address for this contact + /// + [JsonProperty(PropertyName = "street")] + public IList Street { get; set; } + + /// + /// Gets or sets the city for this contact + /// + [JsonProperty(PropertyName = "city")] + public string City { get; set; } + + /// + /// Gets or sets the state for this contact + /// + [JsonProperty(PropertyName = "state")] + public string State { get; set; } + + /// + /// Gets or sets the postal code for this contact + /// + [JsonProperty(PropertyName = "postal")] + public string Postal { get; set; } + + /// + /// Gets or sets the country for this contact + /// + [JsonProperty(PropertyName = "country")] + public string Country { get; set; } + + /// + /// Gets or sets the phone number for this contact + /// + [JsonProperty(PropertyName = "phone")] + public string Phone { get; set; } + + /// + /// Gets or sets the fax number for this contact + /// + [JsonProperty(PropertyName = "fax")] + public string Fax { get; set; } + + /// + /// Gets or sets the email address for this contact + /// + [JsonProperty(PropertyName = "email")] + public string Email { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EnrichmentDomainWhoisContacts.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EnrichmentDomainWhoisContacts.cs new file mode 100644 index 0000000000000..767d155e06b32 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EnrichmentDomainWhoisContacts.cs @@ -0,0 +1,80 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The set of contacts associated with this domain + /// + public partial class EnrichmentDomainWhoisContacts + { + /// + /// Initializes a new instance of the EnrichmentDomainWhoisContacts + /// class. + /// + public EnrichmentDomainWhoisContacts() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EnrichmentDomainWhoisContacts + /// class. + /// + /// The admin contact for this whois record + /// The billing contact for this whois + /// record + /// The registrant contact for this whois + /// record + /// The technical contact for this whois + /// record + public EnrichmentDomainWhoisContacts(EnrichmentDomainWhoisContact admin = default(EnrichmentDomainWhoisContact), EnrichmentDomainWhoisContact billing = default(EnrichmentDomainWhoisContact), EnrichmentDomainWhoisContact registrant = default(EnrichmentDomainWhoisContact), EnrichmentDomainWhoisContact tech = default(EnrichmentDomainWhoisContact)) + { + Admin = admin; + Billing = billing; + Registrant = registrant; + Tech = tech; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the admin contact for this whois record + /// + [JsonProperty(PropertyName = "admin")] + public EnrichmentDomainWhoisContact Admin { get; set; } + + /// + /// Gets or sets the billing contact for this whois record + /// + [JsonProperty(PropertyName = "billing")] + public EnrichmentDomainWhoisContact Billing { get; set; } + + /// + /// Gets or sets the registrant contact for this whois record + /// + [JsonProperty(PropertyName = "registrant")] + public EnrichmentDomainWhoisContact Registrant { get; set; } + + /// + /// Gets or sets the technical contact for this whois record + /// + [JsonProperty(PropertyName = "tech")] + public EnrichmentDomainWhoisContact Tech { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EnrichmentDomainWhoisDetails.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EnrichmentDomainWhoisDetails.cs new file mode 100644 index 0000000000000..edb488b43b3a1 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EnrichmentDomainWhoisDetails.cs @@ -0,0 +1,83 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The whois record for a given domain + /// + public partial class EnrichmentDomainWhoisDetails + { + /// + /// Initializes a new instance of the EnrichmentDomainWhoisDetails + /// class. + /// + public EnrichmentDomainWhoisDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EnrichmentDomainWhoisDetails + /// class. + /// + /// The registrar associated with this + /// domain + /// The set of contacts associated with this + /// domain + /// A list of name servers associated with + /// this domain + /// The set of status flags for this whois + /// record + public EnrichmentDomainWhoisDetails(EnrichmentDomainWhoisRegistrarDetails registrar = default(EnrichmentDomainWhoisRegistrarDetails), EnrichmentDomainWhoisContacts contacts = default(EnrichmentDomainWhoisContacts), IList nameServers = default(IList), IList statuses = default(IList)) + { + Registrar = registrar; + Contacts = contacts; + NameServers = nameServers; + Statuses = statuses; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the registrar associated with this domain + /// + [JsonProperty(PropertyName = "registrar")] + public EnrichmentDomainWhoisRegistrarDetails Registrar { get; set; } + + /// + /// Gets or sets the set of contacts associated with this domain + /// + [JsonProperty(PropertyName = "contacts")] + public EnrichmentDomainWhoisContacts Contacts { get; set; } + + /// + /// Gets or sets a list of name servers associated with this domain + /// + [JsonProperty(PropertyName = "nameServers")] + public IList NameServers { get; set; } + + /// + /// Gets or sets the set of status flags for this whois record + /// + [JsonProperty(PropertyName = "statuses")] + public IList Statuses { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EnrichmentDomainWhoisRegistrarDetails.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EnrichmentDomainWhoisRegistrarDetails.cs new file mode 100644 index 0000000000000..54bc98b28674c --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EnrichmentDomainWhoisRegistrarDetails.cs @@ -0,0 +1,98 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The registrar associated with this domain + /// + public partial class EnrichmentDomainWhoisRegistrarDetails + { + /// + /// Initializes a new instance of the + /// EnrichmentDomainWhoisRegistrarDetails class. + /// + public EnrichmentDomainWhoisRegistrarDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// EnrichmentDomainWhoisRegistrarDetails class. + /// + /// The name of this registrar + /// This registrar's abuse contact + /// email + /// This registrar's abuse contact + /// phone number + /// This registrar's Internet Assigned Numbers + /// Authority id + /// This registrar's URL + /// The hostname of this registrar's whois + /// server + public EnrichmentDomainWhoisRegistrarDetails(string name = default(string), string abuseContactEmail = default(string), string abuseContactPhone = default(string), string ianaId = default(string), string url = default(string), string whoisServer = default(string)) + { + Name = name; + AbuseContactEmail = abuseContactEmail; + AbuseContactPhone = abuseContactPhone; + IanaId = ianaId; + Url = url; + WhoisServer = whoisServer; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of this registrar + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets this registrar's abuse contact email + /// + [JsonProperty(PropertyName = "abuseContactEmail")] + public string AbuseContactEmail { get; set; } + + /// + /// Gets or sets this registrar's abuse contact phone number + /// + [JsonProperty(PropertyName = "abuseContactPhone")] + public string AbuseContactPhone { get; set; } + + /// + /// Gets or sets this registrar's Internet Assigned Numbers Authority + /// id + /// + [JsonProperty(PropertyName = "ianaId")] + public string IanaId { get; set; } + + /// + /// Gets or sets this registrar's URL + /// + [JsonProperty(PropertyName = "url")] + public string Url { get; set; } + + /// + /// Gets or sets the hostname of this registrar's whois server + /// + [JsonProperty(PropertyName = "whoisServer")] + public string WhoisServer { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EnrichmentIpGeodata.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EnrichmentIpGeodata.cs new file mode 100644 index 0000000000000..31266d1fddd1f --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EnrichmentIpGeodata.cs @@ -0,0 +1,199 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Geodata information for a given IP address + /// + public partial class EnrichmentIpGeodata + { + /// + /// Initializes a new instance of the EnrichmentIpGeodata class. + /// + public EnrichmentIpGeodata() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EnrichmentIpGeodata class. + /// + /// The autonomous system number associated with this + /// IP address + /// The name of the carrier for this IP + /// address + /// The city this IP address is located in + /// A numeric rating of confidence that the value + /// in the 'city' field is correct, on a scale of 0-100 + /// The continent this IP address is located + /// on + /// The county this IP address is located + /// in + /// A numeric rating of confidence that the + /// value in the 'country' field is correct on a scale of 0-100 + /// The dotted-decimal or colon-separated string + /// representation of the IP address + /// A description of the connection type of + /// this IP address + /// The latitude of this IP address + /// The longitude of this IP address + /// The name of the organization for this IP + /// address + /// The type of the organization for + /// this IP address + /// The geographic region this IP address is + /// located in + /// The state this IP address is located in + /// A numeric rating of confidence that the value + /// in the 'state' field is correct on a scale of 0-100 + /// The abbreviated name for the state this IP + /// address is located in + public EnrichmentIpGeodata(string asn = default(string), string carrier = default(string), string city = default(string), int? cityCf = default(int?), string continent = default(string), string country = default(string), int? countryCf = default(int?), string ipAddr = default(string), string ipRoutingType = default(string), string latitude = default(string), string longitude = default(string), string organization = default(string), string organizationType = default(string), string region = default(string), string state = default(string), int? stateCf = default(int?), string stateCode = default(string)) + { + Asn = asn; + Carrier = carrier; + City = city; + CityCf = cityCf; + Continent = continent; + Country = country; + CountryCf = countryCf; + IpAddr = ipAddr; + IpRoutingType = ipRoutingType; + Latitude = latitude; + Longitude = longitude; + Organization = organization; + OrganizationType = organizationType; + Region = region; + State = state; + StateCf = stateCf; + StateCode = stateCode; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the autonomous system number associated with this IP + /// address + /// + [JsonProperty(PropertyName = "asn")] + public string Asn { get; set; } + + /// + /// Gets or sets the name of the carrier for this IP address + /// + [JsonProperty(PropertyName = "carrier")] + public string Carrier { get; set; } + + /// + /// Gets or sets the city this IP address is located in + /// + [JsonProperty(PropertyName = "city")] + public string City { get; set; } + + /// + /// Gets or sets a numeric rating of confidence that the value in the + /// 'city' field is correct, on a scale of 0-100 + /// + [JsonProperty(PropertyName = "cityCf")] + public int? CityCf { get; set; } + + /// + /// Gets or sets the continent this IP address is located on + /// + [JsonProperty(PropertyName = "continent")] + public string Continent { get; set; } + + /// + /// Gets or sets the county this IP address is located in + /// + [JsonProperty(PropertyName = "country")] + public string Country { get; set; } + + /// + /// Gets or sets a numeric rating of confidence that the value in the + /// 'country' field is correct on a scale of 0-100 + /// + [JsonProperty(PropertyName = "countryCf")] + public int? CountryCf { get; set; } + + /// + /// Gets or sets the dotted-decimal or colon-separated string + /// representation of the IP address + /// + [JsonProperty(PropertyName = "ipAddr")] + public string IpAddr { get; set; } + + /// + /// Gets or sets a description of the connection type of this IP + /// address + /// + [JsonProperty(PropertyName = "ipRoutingType")] + public string IpRoutingType { get; set; } + + /// + /// Gets or sets the latitude of this IP address + /// + [JsonProperty(PropertyName = "latitude")] + public string Latitude { get; set; } + + /// + /// Gets or sets the longitude of this IP address + /// + [JsonProperty(PropertyName = "longitude")] + public string Longitude { get; set; } + + /// + /// Gets or sets the name of the organization for this IP address + /// + [JsonProperty(PropertyName = "organization")] + public string Organization { get; set; } + + /// + /// Gets or sets the type of the organization for this IP address + /// + [JsonProperty(PropertyName = "organizationType")] + public string OrganizationType { get; set; } + + /// + /// Gets or sets the geographic region this IP address is located in + /// + [JsonProperty(PropertyName = "region")] + public string Region { get; set; } + + /// + /// Gets or sets the state this IP address is located in + /// + [JsonProperty(PropertyName = "state")] + public string State { get; set; } + + /// + /// Gets or sets a numeric rating of confidence that the value in the + /// 'state' field is correct on a scale of 0-100 + /// + [JsonProperty(PropertyName = "stateCf")] + public int? StateCf { get; set; } + + /// + /// Gets or sets the abbreviated name for the state this IP address is + /// located in + /// + [JsonProperty(PropertyName = "stateCode")] + public string StateCode { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Entity.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Entity.cs new file mode 100644 index 0000000000000..10b8d057550e2 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Entity.cs @@ -0,0 +1,51 @@ +// +// 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.Models +{ + using System.Linq; + + /// + /// Specific entity. + /// + public partial class Entity : Resource + { + /// + /// Initializes a new instance of the Entity class. + /// + public Entity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Entity class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + public Entity(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData)) + : base(id, name, type, systemData) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityAnalytics.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityAnalytics.cs new file mode 100644 index 0000000000000..9cd4307b7aad5 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityAnalytics.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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Settings with single toggle. + /// + [Rest.Serialization.JsonTransformation] + public partial class EntityAnalytics : Settings + { + /// + /// Initializes a new instance of the EntityAnalytics class. + /// + public EntityAnalytics() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EntityAnalytics class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Etag of the azure resource + /// Determines whether the setting is enable or + /// disabled. + public EntityAnalytics(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string), bool? isEnabled = default(bool?)) + : base(id, name, type, systemData, etag) + { + IsEnabled = isEnabled; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets determines whether the setting is enable or disabled. + /// + [JsonProperty(PropertyName = "properties.isEnabled")] + public bool? IsEnabled { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityCommonProperties.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityCommonProperties.cs new file mode 100644 index 0000000000000..1ea2909c2bb81 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityCommonProperties.cs @@ -0,0 +1,67 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Entity common property bag. + /// + public partial class EntityCommonProperties + { + /// + /// Initializes a new instance of the EntityCommonProperties class. + /// + public EntityCommonProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EntityCommonProperties class. + /// + /// A bag of custom fields that should be + /// part of the entity and will be presented to the user. + /// The graph item display name which is a + /// short humanly readable description of the graph item instance. This + /// property is optional and might be system generated. + public EntityCommonProperties(IDictionary additionalData = default(IDictionary), string friendlyName = default(string)) + { + AdditionalData = additionalData; + FriendlyName = friendlyName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a bag of custom fields that should be part of the entity and + /// will be presented to the user. + /// + [JsonProperty(PropertyName = "additionalData")] + public IDictionary AdditionalData { get; private set; } + + /// + /// Gets the graph item display name which is a short humanly readable + /// description of the graph item instance. This property is optional + /// and might be system generated. + /// + [JsonProperty(PropertyName = "friendlyName")] + public string FriendlyName { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityEdges.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityEdges.cs new file mode 100644 index 0000000000000..440e7c2ed591f --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityEdges.cs @@ -0,0 +1,63 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The edge that connects the entity to the other entity. + /// + public partial class EntityEdges + { + /// + /// Initializes a new instance of the EntityEdges class. + /// + public EntityEdges() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EntityEdges class. + /// + /// The target entity Id. + /// A bag of custom fields that should be + /// part of the entity and will be presented to the user. + public EntityEdges(string targetEntityId = default(string), IDictionary additionalData = default(IDictionary)) + { + TargetEntityId = targetEntityId; + AdditionalData = additionalData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the target entity Id. + /// + [JsonProperty(PropertyName = "targetEntityId")] + public string TargetEntityId { get; set; } + + /// + /// Gets or sets a bag of custom fields that should be part of the + /// entity and will be presented to the user. + /// + [JsonProperty(PropertyName = "additionalData")] + public IDictionary AdditionalData { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityExpandParameters.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityExpandParameters.cs new file mode 100644 index 0000000000000..5a7f826262f86 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityExpandParameters.cs @@ -0,0 +1,73 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The parameters required to execute an expand operation on the given + /// entity. + /// + public partial class EntityExpandParameters + { + /// + /// Initializes a new instance of the EntityExpandParameters class. + /// + public EntityExpandParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EntityExpandParameters class. + /// + /// The end date filter, so the only expansion + /// results returned are before this date. + /// The Id of the expansion to + /// perform. + /// The start date filter, so the only + /// expansion results returned are after this date. + public EntityExpandParameters(System.DateTime? endTime = default(System.DateTime?), System.Guid? expansionId = default(System.Guid?), System.DateTime? startTime = default(System.DateTime?)) + { + EndTime = endTime; + ExpansionId = expansionId; + StartTime = startTime; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the end date filter, so the only expansion results + /// returned are before this date. + /// + [JsonProperty(PropertyName = "endTime")] + public System.DateTime? EndTime { get; set; } + + /// + /// Gets or sets the Id of the expansion to perform. + /// + [JsonProperty(PropertyName = "expansionId")] + public System.Guid? ExpansionId { get; set; } + + /// + /// Gets or sets the start date filter, so the only expansion results + /// returned are after this date. + /// + [JsonProperty(PropertyName = "startTime")] + public System.DateTime? StartTime { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityExpandResponse.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityExpandResponse.cs new file mode 100644 index 0000000000000..d530f5493f6bc --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityExpandResponse.cs @@ -0,0 +1,60 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The entity expansion result operation response. + /// + public partial class EntityExpandResponse + { + /// + /// Initializes a new instance of the EntityExpandResponse class. + /// + public EntityExpandResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EntityExpandResponse class. + /// + /// The metadata from the expansion operation + /// results. + /// The expansion result values. + public EntityExpandResponse(ExpansionResultsMetadata metaData = default(ExpansionResultsMetadata), EntityExpandResponseValue value = default(EntityExpandResponseValue)) + { + MetaData = metaData; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the metadata from the expansion operation results. + /// + [JsonProperty(PropertyName = "metaData")] + public ExpansionResultsMetadata MetaData { get; set; } + + /// + /// Gets or sets the expansion result values. + /// + [JsonProperty(PropertyName = "value")] + public EntityExpandResponseValue Value { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityExpandResponseValue.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityExpandResponseValue.cs new file mode 100644 index 0000000000000..b7208b1fe5777 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityExpandResponseValue.cs @@ -0,0 +1,64 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The expansion result values. + /// + public partial class EntityExpandResponseValue + { + /// + /// Initializes a new instance of the EntityExpandResponseValue class. + /// + public EntityExpandResponseValue() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EntityExpandResponseValue class. + /// + /// Array of the expansion result + /// entities. + /// Array of edges that connects the entity to the + /// list of entities. + public EntityExpandResponseValue(IList entities = default(IList), IList edges = default(IList)) + { + Entities = entities; + Edges = edges; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets array of the expansion result entities. + /// + [JsonProperty(PropertyName = "entities")] + public IList Entities { get; set; } + + /// + /// Gets or sets array of edges that connects the entity to the list of + /// entities. + /// + [JsonProperty(PropertyName = "edges")] + public IList Edges { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityGetInsightsParameters.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityGetInsightsParameters.cs new file mode 100644 index 0000000000000..57412ac7f6ddd --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityGetInsightsParameters.cs @@ -0,0 +1,98 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The parameters required to execute insights operation on the given + /// entity. + /// + public partial class EntityGetInsightsParameters + { + /// + /// Initializes a new instance of the EntityGetInsightsParameters + /// class. + /// + public EntityGetInsightsParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EntityGetInsightsParameters + /// class. + /// + /// The start timeline date, so the results + /// returned are after this date. + /// The end timeline date, so the results + /// returned are before this date. + /// Indicates if query time + /// range should be extended with default time range of the query. + /// Default value is false + /// List of Insights Query Id. If empty, + /// default value is all insights of this entity + public EntityGetInsightsParameters(System.DateTime startTime, System.DateTime endTime, bool? addDefaultExtendedTimeRange = default(bool?), IList insightQueryIds = default(IList)) + { + StartTime = startTime; + EndTime = endTime; + AddDefaultExtendedTimeRange = addDefaultExtendedTimeRange; + InsightQueryIds = insightQueryIds; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the start timeline date, so the results returned are + /// after this date. + /// + [JsonProperty(PropertyName = "startTime")] + public System.DateTime StartTime { get; set; } + + /// + /// Gets or sets the end timeline date, so the results returned are + /// before this date. + /// + [JsonProperty(PropertyName = "endTime")] + public System.DateTime EndTime { get; set; } + + /// + /// Gets or sets indicates if query time range should be extended with + /// default time range of the query. Default value is false + /// + [JsonProperty(PropertyName = "addDefaultExtendedTimeRange")] + public bool? AddDefaultExtendedTimeRange { get; set; } + + /// + /// Gets or sets list of Insights Query Id. If empty, default value is + /// all insights of this entity + /// + [JsonProperty(PropertyName = "insightQueryIds")] + public IList InsightQueryIds { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityGetInsightsResponse.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityGetInsightsResponse.cs new file mode 100644 index 0000000000000..c92e0f54cae85 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityGetInsightsResponse.cs @@ -0,0 +1,75 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The Get Insights result operation response. + /// + public partial class EntityGetInsightsResponse + { + /// + /// Initializes a new instance of the EntityGetInsightsResponse class. + /// + public EntityGetInsightsResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EntityGetInsightsResponse class. + /// + /// The metadata from the get insights operation + /// results. + /// The insights result values. + public EntityGetInsightsResponse(GetInsightsResultsMetadata metaData = default(GetInsightsResultsMetadata), IList value = default(IList)) + { + MetaData = metaData; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the metadata from the get insights operation results. + /// + [JsonProperty(PropertyName = "metaData")] + public GetInsightsResultsMetadata MetaData { get; set; } + + /// + /// Gets or sets the insights result values. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (MetaData != null) + { + MetaData.Validate(); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityInsightItem.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityInsightItem.cs new file mode 100644 index 0000000000000..d46c305595dca --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityInsightItem.cs @@ -0,0 +1,80 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Entity insight Item. + /// + public partial class EntityInsightItem + { + /// + /// Initializes a new instance of the EntityInsightItem class. + /// + public EntityInsightItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EntityInsightItem class. + /// + /// The query id of the insight + /// The Time interval that the query + /// actually executed on. + /// Query results for table insights + /// query. + /// Query results for table insights + /// query. + public EntityInsightItem(string queryId = default(string), EntityInsightItemQueryTimeInterval queryTimeInterval = default(EntityInsightItemQueryTimeInterval), InsightsTableResult tableQueryResults = default(InsightsTableResult), IList chartQueryResults = default(IList)) + { + QueryId = queryId; + QueryTimeInterval = queryTimeInterval; + TableQueryResults = tableQueryResults; + ChartQueryResults = chartQueryResults; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the query id of the insight + /// + [JsonProperty(PropertyName = "queryId")] + public string QueryId { get; set; } + + /// + /// Gets or sets the Time interval that the query actually executed on. + /// + [JsonProperty(PropertyName = "queryTimeInterval")] + public EntityInsightItemQueryTimeInterval QueryTimeInterval { get; set; } + + /// + /// Gets or sets query results for table insights query. + /// + [JsonProperty(PropertyName = "tableQueryResults")] + public InsightsTableResult TableQueryResults { get; set; } + + /// + /// Gets or sets query results for table insights query. + /// + [JsonProperty(PropertyName = "chartQueryResults")] + public IList ChartQueryResults { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityInsightItemQueryTimeInterval.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityInsightItemQueryTimeInterval.cs new file mode 100644 index 0000000000000..4da48fb89a742 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityInsightItemQueryTimeInterval.cs @@ -0,0 +1,61 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The Time interval that the query actually executed on. + /// + public partial class EntityInsightItemQueryTimeInterval + { + /// + /// Initializes a new instance of the + /// EntityInsightItemQueryTimeInterval class. + /// + public EntityInsightItemQueryTimeInterval() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// EntityInsightItemQueryTimeInterval class. + /// + /// Insight query start time + /// Insight query end time + public EntityInsightItemQueryTimeInterval(System.DateTime? startTime = default(System.DateTime?), System.DateTime? endTime = default(System.DateTime?)) + { + StartTime = startTime; + EndTime = endTime; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets insight query start time + /// + [JsonProperty(PropertyName = "startTime")] + public System.DateTime? StartTime { get; set; } + + /// + /// Gets or sets insight query end time + /// + [JsonProperty(PropertyName = "endTime")] + public System.DateTime? EndTime { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityKind.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityKind.cs new file mode 100644 index 0000000000000..2547a43a7e727 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityKind.cs @@ -0,0 +1,104 @@ +// +// 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.Models +{ + + /// + /// Defines values for EntityKind. + /// + public static class EntityKind + { + /// + /// Entity represents account in the system. + /// + public const string Account = "Account"; + /// + /// Entity represents host in the system. + /// + public const string Host = "Host"; + /// + /// Entity represents file in the system. + /// + public const string File = "File"; + /// + /// Entity represents azure resource in the system. + /// + public const string AzureResource = "AzureResource"; + /// + /// Entity represents cloud application in the system. + /// + public const string CloudApplication = "CloudApplication"; + /// + /// Entity represents dns resolution in the system. + /// + public const string DnsResolution = "DnsResolution"; + /// + /// Entity represents file hash in the system. + /// + public const string FileHash = "FileHash"; + /// + /// Entity represents ip in the system. + /// + public const string Ip = "Ip"; + /// + /// Entity represents malware in the system. + /// + public const string Malware = "Malware"; + /// + /// Entity represents process in the system. + /// + public const string Process = "Process"; + /// + /// Entity represents registry key in the system. + /// + public const string RegistryKey = "RegistryKey"; + /// + /// Entity represents registry value in the system. + /// + public const string RegistryValue = "RegistryValue"; + /// + /// Entity represents security group in the system. + /// + public const string SecurityGroup = "SecurityGroup"; + /// + /// Entity represents url in the system. + /// + public const string Url = "Url"; + /// + /// Entity represents IoT device in the system. + /// + public const string IoTDevice = "IoTDevice"; + /// + /// Entity represents security alert in the system. + /// + public const string SecurityAlert = "SecurityAlert"; + /// + /// Entity represents bookmark in the system. + /// + public const string Bookmark = "Bookmark"; + /// + /// Entity represents mail cluster in the system. + /// + public const string MailCluster = "MailCluster"; + /// + /// Entity represents mail message in the system. + /// + public const string MailMessage = "MailMessage"; + /// + /// Entity represents mailbox in the system. + /// + public const string Mailbox = "Mailbox"; + /// + /// Entity represents submission mail in the system. + /// + public const string SubmissionMail = "SubmissionMail"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityMapping.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityMapping.cs new file mode 100644 index 0000000000000..f3a9b34a2d2ee --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityMapping.cs @@ -0,0 +1,70 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Single entity mapping for the alert rule + /// + public partial class EntityMapping + { + /// + /// Initializes a new instance of the EntityMapping class. + /// + public EntityMapping() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EntityMapping class. + /// + /// Possible values include: 'Account', + /// 'Host', 'IP', 'Malware', 'File', 'Process', 'CloudApplication', + /// 'DNS', 'AzureResource', 'FileHash', 'RegistryKey', 'RegistryValue', + /// 'SecurityGroup', 'URL', 'Mailbox', 'MailCluster', 'MailMessage', + /// 'SubmissionMail' + /// array of field mappings for the given + /// entity mapping + public EntityMapping(string entityType = default(string), IList fieldMappings = default(IList)) + { + EntityType = entityType; + FieldMappings = fieldMappings; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets possible values include: 'Account', 'Host', 'IP', + /// 'Malware', 'File', 'Process', 'CloudApplication', 'DNS', + /// 'AzureResource', 'FileHash', 'RegistryKey', 'RegistryValue', + /// 'SecurityGroup', 'URL', 'Mailbox', 'MailCluster', 'MailMessage', + /// 'SubmissionMail' + /// + [JsonProperty(PropertyName = "entityType")] + public string EntityType { get; set; } + + /// + /// Gets or sets array of field mappings for the given entity mapping + /// + [JsonProperty(PropertyName = "fieldMappings")] + public IList FieldMappings { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityMappingType.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityMappingType.cs new file mode 100644 index 0000000000000..2682cc5b441b1 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityMappingType.cs @@ -0,0 +1,92 @@ +// +// 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.Models +{ + + /// + /// Defines values for EntityMappingType. + /// + public static class EntityMappingType + { + /// + /// User account entity type + /// + public const string Account = "Account"; + /// + /// Host entity type + /// + public const string Host = "Host"; + /// + /// IP address entity type + /// + public const string IP = "IP"; + /// + /// Malware entity type + /// + public const string Malware = "Malware"; + /// + /// System file entity type + /// + public const string File = "File"; + /// + /// Process entity type + /// + public const string Process = "Process"; + /// + /// Cloud app entity type + /// + public const string CloudApplication = "CloudApplication"; + /// + /// DNS entity type + /// + public const string DNS = "DNS"; + /// + /// Azure resource entity type + /// + public const string AzureResource = "AzureResource"; + /// + /// File-hash entity type + /// + public const string FileHash = "FileHash"; + /// + /// Registry key entity type + /// + public const string RegistryKey = "RegistryKey"; + /// + /// Registry value entity type + /// + public const string RegistryValue = "RegistryValue"; + /// + /// Security group entity type + /// + public const string SecurityGroup = "SecurityGroup"; + /// + /// URL entity type + /// + public const string URL = "URL"; + /// + /// Mailbox entity type + /// + public const string Mailbox = "Mailbox"; + /// + /// Mail cluster entity type + /// + public const string MailCluster = "MailCluster"; + /// + /// Mail message entity type + /// + public const string MailMessage = "MailMessage"; + /// + /// Submission mail entity type + /// + public const string SubmissionMail = "SubmissionMail"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityQuery.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityQuery.cs new file mode 100644 index 0000000000000..799239036ed69 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityQuery.cs @@ -0,0 +1,52 @@ +// +// 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.Models +{ + using System.Linq; + + /// + /// Specific entity query. + /// + public partial class EntityQuery : ResourceWithEtag + { + /// + /// Initializes a new instance of the EntityQuery class. + /// + public EntityQuery() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EntityQuery class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Etag of the azure resource + public EntityQuery(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string)) + : base(id, name, type, systemData, etag) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityQueryItem.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityQueryItem.cs new file mode 100644 index 0000000000000..3c014936cb7b0 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityQueryItem.cs @@ -0,0 +1,67 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// An abstract Query item for entity + /// + public partial class EntityQueryItem + { + /// + /// Initializes a new instance of the EntityQueryItem class. + /// + public EntityQueryItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EntityQueryItem class. + /// + /// Query Template ARM ID + /// Query Template ARM Name + /// ARM Type + public EntityQueryItem(string id = default(string), string name = default(string), string type = default(string)) + { + Id = id; + Name = name; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets query Template ARM ID + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets or sets query Template ARM Name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets ARM Type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityQueryItemProperties.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityQueryItemProperties.cs new file mode 100644 index 0000000000000..50be53c5ad328 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityQueryItemProperties.cs @@ -0,0 +1,90 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An properties abstract Query item for entity + /// + public partial class EntityQueryItemProperties + { + /// + /// Initializes a new instance of the EntityQueryItemProperties class. + /// + public EntityQueryItemProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EntityQueryItemProperties class. + /// + /// Data types for template + /// The type of the entity. Possible + /// values include: 'Account', 'Host', 'File', 'AzureResource', + /// 'CloudApplication', 'DNS', 'FileHash', 'IP', 'Malware', 'Process', + /// 'RegistryKey', 'RegistryValue', 'SecurityGroup', 'URL', + /// 'IoTDevice', 'SecurityAlert', 'HuntingBookmark', 'MailCluster', + /// 'MailMessage', 'Mailbox', 'SubmissionMail' + /// Data types for + /// template + /// The query applied only to entities + /// matching to all filters + public EntityQueryItemProperties(IList dataTypes = default(IList), string inputEntityType = default(string), IList> requiredInputFieldsSets = default(IList>), object entitiesFilter = default(object)) + { + DataTypes = dataTypes; + InputEntityType = inputEntityType; + RequiredInputFieldsSets = requiredInputFieldsSets; + EntitiesFilter = entitiesFilter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets data types for template + /// + [JsonProperty(PropertyName = "dataTypes")] + public IList DataTypes { get; set; } + + /// + /// Gets or sets the type of the entity. Possible values include: + /// 'Account', 'Host', 'File', 'AzureResource', 'CloudApplication', + /// 'DNS', 'FileHash', 'IP', 'Malware', 'Process', 'RegistryKey', + /// 'RegistryValue', 'SecurityGroup', 'URL', 'IoTDevice', + /// 'SecurityAlert', 'HuntingBookmark', 'MailCluster', 'MailMessage', + /// 'Mailbox', 'SubmissionMail' + /// + [JsonProperty(PropertyName = "inputEntityType")] + public string InputEntityType { get; set; } + + /// + /// Gets or sets data types for template + /// + [JsonProperty(PropertyName = "requiredInputFieldsSets")] + public IList> RequiredInputFieldsSets { get; set; } + + /// + /// Gets or sets the query applied only to entities matching to all + /// filters + /// + [JsonProperty(PropertyName = "entitiesFilter")] + public object EntitiesFilter { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityQueryItemPropertiesDataTypesItem.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityQueryItemPropertiesDataTypesItem.cs new file mode 100644 index 0000000000000..ef3caae09a0fd --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityQueryItemPropertiesDataTypesItem.cs @@ -0,0 +1,50 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class EntityQueryItemPropertiesDataTypesItem + { + /// + /// Initializes a new instance of the + /// EntityQueryItemPropertiesDataTypesItem class. + /// + public EntityQueryItemPropertiesDataTypesItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// EntityQueryItemPropertiesDataTypesItem class. + /// + /// Data type name + public EntityQueryItemPropertiesDataTypesItem(string dataType = default(string)) + { + DataType = dataType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets data type name + /// + [JsonProperty(PropertyName = "dataType")] + public string DataType { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityQueryKind.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityQueryKind.cs new file mode 100644 index 0000000000000..cacfd57754ba1 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityQueryKind.cs @@ -0,0 +1,23 @@ +// +// 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.Models +{ + + /// + /// Defines values for EntityQueryKind. + /// + public static class EntityQueryKind + { + public const string Expansion = "Expansion"; + public const string Insight = "Insight"; + public const string Activity = "Activity"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityQueryTemplate.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityQueryTemplate.cs new file mode 100644 index 0000000000000..a50456bcc0864 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityQueryTemplate.cs @@ -0,0 +1,51 @@ +// +// 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.Models +{ + using System.Linq; + + /// + /// Specific entity query template. + /// + public partial class EntityQueryTemplate : Resource + { + /// + /// Initializes a new instance of the EntityQueryTemplate class. + /// + public EntityQueryTemplate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EntityQueryTemplate class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + public EntityQueryTemplate(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData)) + : base(id, name, type, systemData) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityQueryTemplateKind.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityQueryTemplateKind.cs new file mode 100644 index 0000000000000..6a5573517b807 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityQueryTemplateKind.cs @@ -0,0 +1,21 @@ +// +// 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.Models +{ + + /// + /// Defines values for EntityQueryTemplateKind. + /// + public static class EntityQueryTemplateKind + { + public const string Activity = "Activity"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityTimelineItem.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityTimelineItem.cs new file mode 100644 index 0000000000000..c371b83088019 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityTimelineItem.cs @@ -0,0 +1,35 @@ +// +// 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.Models +{ + using System.Linq; + + /// + /// Entity timeline Item. + /// + public partial class EntityTimelineItem + { + /// + /// Initializes a new instance of the EntityTimelineItem class. + /// + public EntityTimelineItem() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityTimelineKind.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityTimelineKind.cs new file mode 100644 index 0000000000000..7187fa5452ad5 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityTimelineKind.cs @@ -0,0 +1,32 @@ +// +// 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.Models +{ + + /// + /// Defines values for EntityTimelineKind. + /// + public static class EntityTimelineKind + { + /// + /// activity + /// + public const string Activity = "Activity"; + /// + /// bookmarks + /// + public const string Bookmark = "Bookmark"; + /// + /// security alerts + /// + public const string SecurityAlert = "SecurityAlert"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityTimelineParameters.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityTimelineParameters.cs new file mode 100644 index 0000000000000..c1e111d61c0b3 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityTimelineParameters.cs @@ -0,0 +1,92 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The parameters required to execute s timeline operation on the given + /// entity. + /// + public partial class EntityTimelineParameters + { + /// + /// Initializes a new instance of the EntityTimelineParameters class. + /// + public EntityTimelineParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EntityTimelineParameters class. + /// + /// The start timeline date, so the results + /// returned are after this date. + /// The end timeline date, so the results + /// returned are before this date. + /// Array of timeline Item kinds. + /// The number of bucket for timeline + /// queries aggregation. + public EntityTimelineParameters(System.DateTime startTime, System.DateTime endTime, IList kinds = default(IList), int? numberOfBucket = default(int?)) + { + Kinds = kinds; + StartTime = startTime; + EndTime = endTime; + NumberOfBucket = numberOfBucket; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets array of timeline Item kinds. + /// + [JsonProperty(PropertyName = "kinds")] + public IList Kinds { get; set; } + + /// + /// Gets or sets the start timeline date, so the results returned are + /// after this date. + /// + [JsonProperty(PropertyName = "startTime")] + public System.DateTime StartTime { get; set; } + + /// + /// Gets or sets the end timeline date, so the results returned are + /// before this date. + /// + [JsonProperty(PropertyName = "endTime")] + public System.DateTime EndTime { get; set; } + + /// + /// Gets or sets the number of bucket for timeline queries aggregation. + /// + [JsonProperty(PropertyName = "numberOfBucket")] + public int? NumberOfBucket { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityTimelineResponse.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityTimelineResponse.cs new file mode 100644 index 0000000000000..ee0834f9b2a17 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityTimelineResponse.cs @@ -0,0 +1,75 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The entity timeline result operation response. + /// + public partial class EntityTimelineResponse + { + /// + /// Initializes a new instance of the EntityTimelineResponse class. + /// + public EntityTimelineResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EntityTimelineResponse class. + /// + /// The metadata from the timeline operation + /// results. + /// The timeline result values. + public EntityTimelineResponse(TimelineResultsMetadata metaData = default(TimelineResultsMetadata), IList value = default(IList)) + { + MetaData = metaData; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the metadata from the timeline operation results. + /// + [JsonProperty(PropertyName = "metaData")] + public TimelineResultsMetadata MetaData { get; set; } + + /// + /// Gets or sets the timeline result values. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (MetaData != null) + { + MetaData.Validate(); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityType.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityType.cs new file mode 100644 index 0000000000000..0a6dc63eb8a1e --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityType.cs @@ -0,0 +1,104 @@ +// +// 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.Models +{ + + /// + /// Defines values for EntityType. + /// + public static class EntityType + { + /// + /// Entity represents account in the system. + /// + public const string Account = "Account"; + /// + /// Entity represents host in the system. + /// + public const string Host = "Host"; + /// + /// Entity represents file in the system. + /// + public const string File = "File"; + /// + /// Entity represents azure resource in the system. + /// + public const string AzureResource = "AzureResource"; + /// + /// Entity represents cloud application in the system. + /// + public const string CloudApplication = "CloudApplication"; + /// + /// Entity represents dns in the system. + /// + public const string DNS = "DNS"; + /// + /// Entity represents file hash in the system. + /// + public const string FileHash = "FileHash"; + /// + /// Entity represents ip in the system. + /// + public const string IP = "IP"; + /// + /// Entity represents malware in the system. + /// + public const string Malware = "Malware"; + /// + /// Entity represents process in the system. + /// + public const string Process = "Process"; + /// + /// Entity represents registry key in the system. + /// + public const string RegistryKey = "RegistryKey"; + /// + /// Entity represents registry value in the system. + /// + public const string RegistryValue = "RegistryValue"; + /// + /// Entity represents security group in the system. + /// + public const string SecurityGroup = "SecurityGroup"; + /// + /// Entity represents url in the system. + /// + public const string URL = "URL"; + /// + /// Entity represents IoT device in the system. + /// + public const string IoTDevice = "IoTDevice"; + /// + /// Entity represents security alert in the system. + /// + public const string SecurityAlert = "SecurityAlert"; + /// + /// Entity represents HuntingBookmark in the system. + /// + public const string HuntingBookmark = "HuntingBookmark"; + /// + /// Entity represents mail cluster in the system. + /// + public const string MailCluster = "MailCluster"; + /// + /// Entity represents mail message in the system. + /// + public const string MailMessage = "MailMessage"; + /// + /// Entity represents mailbox in the system. + /// + public const string Mailbox = "Mailbox"; + /// + /// Entity represents submission mail in the system. + /// + public const string SubmissionMail = "SubmissionMail"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ErrorDetail.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ErrorDetail.cs new file mode 100644 index 0000000000000..f100dc6720818 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ErrorDetail.cs @@ -0,0 +1,85 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The error detail. + /// + public partial class ErrorDetail + { + /// + /// Initializes a new instance of the ErrorDetail class. + /// + public ErrorDetail() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorDetail class. + /// + /// The error code. + /// The error message. + /// The error target. + /// The error details. + /// The error additional info. + public ErrorDetail(string code = default(string), string message = default(string), string target = default(string), IList details = default(IList), IList additionalInfo = default(IList)) + { + Code = code; + Message = message; + Target = target; + Details = details; + AdditionalInfo = additionalInfo; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the error code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; private set; } + + /// + /// Gets the error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + /// + /// Gets the error target. + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; private set; } + + /// + /// Gets the error details. + /// + [JsonProperty(PropertyName = "details")] + public IList Details { get; private set; } + + /// + /// Gets the error additional info. + /// + [JsonProperty(PropertyName = "additionalInfo")] + public IList AdditionalInfo { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ErrorResponse.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ErrorResponse.cs index a60cf83241746..7d2ad4e463770 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ErrorResponse.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ErrorResponse.cs @@ -11,17 +11,15 @@ namespace Microsoft.Azure.Management.SecurityInsights.Models { using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// - /// Error Response + /// Error response /// /// /// Common error response for all Azure Resource Manager APIs to return /// error details for failed operations. (This also follows the OData error - /// response format.) + /// response format.). /// public partial class ErrorResponse { @@ -36,18 +34,10 @@ public ErrorResponse() /// /// Initializes a new instance of the ErrorResponse class. /// - /// The error code. - /// The error message. - /// The error target. - /// The error details. - /// The error additional info. - public ErrorResponse(string code = default(string), string message = default(string), string target = default(string), IList details = default(IList), IList additionalInfo = default(IList)) + /// The error object. + public ErrorResponse(ErrorDetail error = default(ErrorDetail)) { - Code = code; - Message = message; - Target = target; - Details = details; - AdditionalInfo = additionalInfo; + Error = error; CustomInit(); } @@ -57,34 +47,10 @@ public ErrorResponse() partial void CustomInit(); /// - /// Gets the error code. + /// Gets or sets the error object. /// - [JsonProperty(PropertyName = "code")] - public string Code { get; private set; } - - /// - /// Gets the error message. - /// - [JsonProperty(PropertyName = "message")] - public string Message { get; private set; } - - /// - /// Gets the error target. - /// - [JsonProperty(PropertyName = "target")] - public string Target { get; private set; } - - /// - /// Gets the error details. - /// - [JsonProperty(PropertyName = "details")] - public IList Details { get; private set; } - - /// - /// Gets the error additional info. - /// - [JsonProperty(PropertyName = "additionalInfo")] - public IList AdditionalInfo { get; private set; } + [JsonProperty(PropertyName = "error")] + public ErrorDetail Error { get; set; } } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ErrorResponseException.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ErrorResponseException.cs new file mode 100644 index 0000000000000..93959aa48c537 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ErrorResponseException.cs @@ -0,0 +1,62 @@ +// +// 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.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with ErrorResponse + /// information. + /// + public partial class ErrorResponseException : RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public ErrorResponse Body { get; set; } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + public ErrorResponseException() + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + public ErrorResponseException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + /// Inner exception. + public ErrorResponseException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EventGroupingAggregationKind.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EventGroupingAggregationKind.cs new file mode 100644 index 0000000000000..04a9a21a1c9f7 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EventGroupingAggregationKind.cs @@ -0,0 +1,22 @@ +// +// 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.Models +{ + + /// + /// Defines values for EventGroupingAggregationKind. + /// + public static class EventGroupingAggregationKind + { + public const string SingleAlert = "SingleAlert"; + public const string AlertPerResult = "AlertPerResult"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EventGroupingSettings.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EventGroupingSettings.cs new file mode 100644 index 0000000000000..b721c50df0536 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EventGroupingSettings.cs @@ -0,0 +1,53 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Event grouping settings property bag. + /// + public partial class EventGroupingSettings + { + /// + /// Initializes a new instance of the EventGroupingSettings class. + /// + public EventGroupingSettings() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EventGroupingSettings class. + /// + /// Possible values include: + /// 'SingleAlert', 'AlertPerResult' + public EventGroupingSettings(string aggregationKind = default(string)) + { + AggregationKind = aggregationKind; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets possible values include: 'SingleAlert', + /// 'AlertPerResult' + /// + [JsonProperty(PropertyName = "aggregationKind")] + public string AggregationKind { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ExpansionEntityQuery.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ExpansionEntityQuery.cs new file mode 100644 index 0000000000000..19b310286fbda --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ExpansionEntityQuery.cs @@ -0,0 +1,125 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents Expansion entity query. + /// + [Newtonsoft.Json.JsonObject("Expansion")] + [Rest.Serialization.JsonTransformation] + public partial class ExpansionEntityQuery : EntityQuery + { + /// + /// Initializes a new instance of the ExpansionEntityQuery class. + /// + public ExpansionEntityQuery() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ExpansionEntityQuery class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Etag of the azure resource + /// List of the data sources that are + /// required to run the query + /// The query display name + /// The type of the query's source + /// entity. Possible values include: 'Account', 'Host', 'File', + /// 'AzureResource', 'CloudApplication', 'DNS', 'FileHash', 'IP', + /// 'Malware', 'Process', 'RegistryKey', 'RegistryValue', + /// 'SecurityGroup', 'URL', 'IoTDevice', 'SecurityAlert', + /// 'HuntingBookmark', 'MailCluster', 'MailMessage', 'Mailbox', + /// 'SubmissionMail' + /// List of the fields of the source entity + /// that are required to run the query + /// List of the desired output types to + /// be constructed from the result + /// The template query string to be parsed + /// and formatted + public ExpansionEntityQuery(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string), IList dataSources = default(IList), string displayName = default(string), string inputEntityType = default(string), IList inputFields = default(IList), IList outputEntityTypes = default(IList), string queryTemplate = default(string)) + : base(id, name, type, systemData, etag) + { + DataSources = dataSources; + DisplayName = displayName; + InputEntityType = inputEntityType; + InputFields = inputFields; + OutputEntityTypes = outputEntityTypes; + QueryTemplate = queryTemplate; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of the data sources that are required to run the + /// query + /// + [JsonProperty(PropertyName = "properties.dataSources")] + public IList DataSources { get; set; } + + /// + /// Gets or sets the query display name + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets the type of the query's source entity. Possible values + /// include: 'Account', 'Host', 'File', 'AzureResource', + /// 'CloudApplication', 'DNS', 'FileHash', 'IP', 'Malware', 'Process', + /// 'RegistryKey', 'RegistryValue', 'SecurityGroup', 'URL', + /// 'IoTDevice', 'SecurityAlert', 'HuntingBookmark', 'MailCluster', + /// 'MailMessage', 'Mailbox', 'SubmissionMail' + /// + [JsonProperty(PropertyName = "properties.inputEntityType")] + public string InputEntityType { get; set; } + + /// + /// Gets or sets list of the fields of the source entity that are + /// required to run the query + /// + [JsonProperty(PropertyName = "properties.inputFields")] + public IList InputFields { get; set; } + + /// + /// Gets or sets list of the desired output types to be constructed + /// from the result + /// + [JsonProperty(PropertyName = "properties.outputEntityTypes")] + public IList OutputEntityTypes { get; set; } + + /// + /// Gets or sets the template query string to be parsed and formatted + /// + [JsonProperty(PropertyName = "properties.queryTemplate")] + public string QueryTemplate { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ExpansionResultAggregation.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ExpansionResultAggregation.cs new file mode 100644 index 0000000000000..dbc96904e9819 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ExpansionResultAggregation.cs @@ -0,0 +1,104 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Information of a specific aggregation in the expansion result. + /// + public partial class ExpansionResultAggregation + { + /// + /// Initializes a new instance of the ExpansionResultAggregation class. + /// + public ExpansionResultAggregation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ExpansionResultAggregation class. + /// + /// Total number of aggregations of the given kind + /// (and aggregationType if given) in the expansion result. + /// The kind of the aggregated entity. + /// Possible values include: 'Account', 'Host', 'File', + /// 'AzureResource', 'CloudApplication', 'DnsResolution', 'FileHash', + /// 'Ip', 'Malware', 'Process', 'RegistryKey', 'RegistryValue', + /// 'SecurityGroup', 'Url', 'IoTDevice', 'SecurityAlert', 'Bookmark', + /// 'MailCluster', 'MailMessage', 'Mailbox', 'SubmissionMail' + /// The common type of the aggregation. + /// (for e.g. entity field name) + /// The display name of the aggregation by + /// type. + public ExpansionResultAggregation(int count, string entityKind, string aggregationType = default(string), string displayName = default(string)) + { + AggregationType = aggregationType; + Count = count; + DisplayName = displayName; + EntityKind = entityKind; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the common type of the aggregation. (for e.g. entity + /// field name) + /// + [JsonProperty(PropertyName = "aggregationType")] + public string AggregationType { get; set; } + + /// + /// Gets or sets total number of aggregations of the given kind (and + /// aggregationType if given) in the expansion result. + /// + [JsonProperty(PropertyName = "count")] + public int Count { get; set; } + + /// + /// Gets or sets the display name of the aggregation by type. + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets the kind of the aggregated entity. Possible values + /// include: 'Account', 'Host', 'File', 'AzureResource', + /// 'CloudApplication', 'DnsResolution', 'FileHash', 'Ip', 'Malware', + /// 'Process', 'RegistryKey', 'RegistryValue', 'SecurityGroup', 'Url', + /// 'IoTDevice', 'SecurityAlert', 'Bookmark', 'MailCluster', + /// 'MailMessage', 'Mailbox', 'SubmissionMail' + /// + [JsonProperty(PropertyName = "entityKind")] + public string EntityKind { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (EntityKind == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "EntityKind"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ExpansionResultsMetadata.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ExpansionResultsMetadata.cs new file mode 100644 index 0000000000000..49e89971e9aa7 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ExpansionResultsMetadata.cs @@ -0,0 +1,55 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Expansion result metadata. + /// + public partial class ExpansionResultsMetadata + { + /// + /// Initializes a new instance of the ExpansionResultsMetadata class. + /// + public ExpansionResultsMetadata() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ExpansionResultsMetadata class. + /// + /// Information of the aggregated nodes in + /// the expansion result. + public ExpansionResultsMetadata(IList aggregations = default(IList)) + { + Aggregations = aggregations; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets information of the aggregated nodes in the expansion + /// result. + /// + [JsonProperty(PropertyName = "aggregations")] + public IList Aggregations { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ToggleSettings.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EyesOn.cs similarity index 52% rename from sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ToggleSettings.cs rename to sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EyesOn.cs index 076630967b68c..4a0c5b1d9af9b 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ToggleSettings.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EyesOn.cs @@ -19,27 +19,32 @@ namespace Microsoft.Azure.Management.SecurityInsights.Models /// Settings with single toggle. /// [Rest.Serialization.JsonTransformation] - public partial class ToggleSettings : Settings + public partial class EyesOn : Settings { /// - /// Initializes a new instance of the ToggleSettings class. + /// Initializes a new instance of the EyesOn class. /// - public ToggleSettings() + public EyesOn() { CustomInit(); } /// - /// Initializes a new instance of the ToggleSettings class. + /// Initializes a new instance of the EyesOn class. /// - /// Azure resource Id - /// Azure resource name - /// Azure resource type + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. /// Etag of the azure resource /// Determines whether the setting is enable or /// disabled. - public ToggleSettings(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), bool? isEnabled = default(bool?)) - : base(id, name, type, etag) + public EyesOn(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string), bool? isEnabled = default(bool?)) + : base(id, name, type, systemData, etag) { IsEnabled = isEnabled; CustomInit(); @@ -51,10 +56,10 @@ public ToggleSettings() partial void CustomInit(); /// - /// Gets or sets determines whether the setting is enable or disabled. + /// Gets determines whether the setting is enable or disabled. /// [JsonProperty(PropertyName = "properties.isEnabled")] - public bool? IsEnabled { get; set; } + public bool? IsEnabled { get; private set; } } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/FieldMapping.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/FieldMapping.cs new file mode 100644 index 0000000000000..53539ffc1a984 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/FieldMapping.cs @@ -0,0 +1,60 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A single field mapping of the mapped entity + /// + public partial class FieldMapping + { + /// + /// Initializes a new instance of the FieldMapping class. + /// + public FieldMapping() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FieldMapping class. + /// + /// the V3 identifier of the entity + /// the column name to be mapped to the + /// identifier + public FieldMapping(string identifier = default(string), string columnName = default(string)) + { + Identifier = identifier; + ColumnName = columnName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the V3 identifier of the entity + /// + [JsonProperty(PropertyName = "identifier")] + public string Identifier { get; set; } + + /// + /// Gets or sets the column name to be mapped to the identifier + /// + [JsonProperty(PropertyName = "columnName")] + public string ColumnName { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/FileEntity.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/FileEntity.cs new file mode 100644 index 0000000000000..40bbc9d001384 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/FileEntity.cs @@ -0,0 +1,116 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents a file entity. + /// + [Newtonsoft.Json.JsonObject("File")] + [Rest.Serialization.JsonTransformation] + public partial class FileEntity : Entity + { + /// + /// Initializes a new instance of the FileEntity class. + /// + public FileEntity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FileEntity class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// A bag of custom fields that should be + /// part of the entity and will be presented to the user. + /// The graph item display name which is a + /// short humanly readable description of the graph item instance. This + /// property is optional and might be system generated. + /// The full path to the file. + /// The file hash entity identifiers + /// associated with this file + /// The file name without path (some alerts + /// might not include path). + /// The Host entity id which the file + /// belongs to + public FileEntity(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary additionalData = default(IDictionary), string friendlyName = default(string), string directory = default(string), IList fileHashEntityIds = default(IList), string fileName = default(string), string hostEntityId = default(string)) + : base(id, name, type, systemData) + { + AdditionalData = additionalData; + FriendlyName = friendlyName; + Directory = directory; + FileHashEntityIds = fileHashEntityIds; + FileName = fileName; + HostEntityId = hostEntityId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a bag of custom fields that should be part of the entity and + /// will be presented to the user. + /// + [JsonProperty(PropertyName = "properties.additionalData")] + public IDictionary AdditionalData { get; private set; } + + /// + /// Gets the graph item display name which is a short humanly readable + /// description of the graph item instance. This property is optional + /// and might be system generated. + /// + [JsonProperty(PropertyName = "properties.friendlyName")] + public string FriendlyName { get; private set; } + + /// + /// Gets the full path to the file. + /// + [JsonProperty(PropertyName = "properties.directory")] + public string Directory { get; private set; } + + /// + /// Gets the file hash entity identifiers associated with this file + /// + [JsonProperty(PropertyName = "properties.fileHashEntityIds")] + public IList FileHashEntityIds { get; private set; } + + /// + /// Gets the file name without path (some alerts might not include + /// path). + /// + [JsonProperty(PropertyName = "properties.fileName")] + public string FileName { get; private set; } + + /// + /// Gets the Host entity id which the file belongs to + /// + [JsonProperty(PropertyName = "properties.hostEntityId")] + public string HostEntityId { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/FileHashAlgorithm.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/FileHashAlgorithm.cs new file mode 100644 index 0000000000000..c0bdf6b8df93b --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/FileHashAlgorithm.cs @@ -0,0 +1,40 @@ +// +// 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.Models +{ + + /// + /// Defines values for FileHashAlgorithm. + /// + public static class FileHashAlgorithm + { + /// + /// Unknown hash algorithm + /// + public const string Unknown = "Unknown"; + /// + /// MD5 hash type + /// + public const string MD5 = "MD5"; + /// + /// SHA1 hash type + /// + public const string SHA1 = "SHA1"; + /// + /// SHA256 hash type + /// + public const string SHA256 = "SHA256"; + /// + /// SHA256 Authenticode hash type + /// + public const string SHA256AC = "SHA256AC"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/FileHashEntity.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/FileHashEntity.cs new file mode 100644 index 0000000000000..d2ebd8fa56475 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/FileHashEntity.cs @@ -0,0 +1,98 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents a file hash entity. + /// + [Newtonsoft.Json.JsonObject("FileHash")] + [Rest.Serialization.JsonTransformation] + public partial class FileHashEntity : Entity + { + /// + /// Initializes a new instance of the FileHashEntity class. + /// + public FileHashEntity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FileHashEntity class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// A bag of custom fields that should be + /// part of the entity and will be presented to the user. + /// The graph item display name which is a + /// short humanly readable description of the graph item instance. This + /// property is optional and might be system generated. + /// The hash algorithm type. Possible values + /// include: 'Unknown', 'MD5', 'SHA1', 'SHA256', 'SHA256AC' + /// The file hash value. + public FileHashEntity(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary additionalData = default(IDictionary), string friendlyName = default(string), string algorithm = default(string), string hashValue = default(string)) + : base(id, name, type, systemData) + { + AdditionalData = additionalData; + FriendlyName = friendlyName; + Algorithm = algorithm; + HashValue = hashValue; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a bag of custom fields that should be part of the entity and + /// will be presented to the user. + /// + [JsonProperty(PropertyName = "properties.additionalData")] + public IDictionary AdditionalData { get; private set; } + + /// + /// Gets the graph item display name which is a short humanly readable + /// description of the graph item instance. This property is optional + /// and might be system generated. + /// + [JsonProperty(PropertyName = "properties.friendlyName")] + public string FriendlyName { get; private set; } + + /// + /// Gets the hash algorithm type. Possible values include: 'Unknown', + /// 'MD5', 'SHA1', 'SHA256', 'SHA256AC' + /// + [JsonProperty(PropertyName = "properties.algorithm")] + public string Algorithm { get; private set; } + + /// + /// Gets the file hash value. + /// + [JsonProperty(PropertyName = "properties.hashValue")] + public string HashValue { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/FusionAlertRule.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/FusionAlertRule.cs index c47cecd45ac36..b50d56ed8f5cf 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/FusionAlertRule.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/FusionAlertRule.cs @@ -39,9 +39,14 @@ public FusionAlertRule() /// template used to create this rule. /// Determines whether this alert rule is enabled /// or disabled. - /// Azure resource Id - /// Azure resource name - /// Azure resource type + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. /// Etag of the azure resource /// The description of the alert /// rule. @@ -53,8 +58,8 @@ public FusionAlertRule() /// alert rule. Possible values include: 'High', 'Medium', 'Low', /// 'Informational' /// The tactics of the alert rule - public FusionAlertRule(string alertRuleTemplateName, bool enabled, string id = default(string), string name = default(string), string type = default(string), string etag = default(string), string description = default(string), string displayName = default(string), System.DateTime? lastModifiedUtc = default(System.DateTime?), string severity = default(string), IList tactics = default(IList)) - : base(id, name, type, etag) + public FusionAlertRule(string alertRuleTemplateName, bool enabled, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string), string description = default(string), string displayName = default(string), System.DateTime? lastModifiedUtc = default(System.DateTime?), string severity = default(string), IList tactics = default(IList)) + : base(id, name, type, systemData, etag) { AlertRuleTemplateName = alertRuleTemplateName; Description = description; diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/FusionAlertRuleTemplate.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/FusionAlertRuleTemplate.cs index 54a55ee9dc979..a7be9134d6303 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/FusionAlertRuleTemplate.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/FusionAlertRuleTemplate.cs @@ -35,30 +35,38 @@ public FusionAlertRuleTemplate() /// /// Initializes a new instance of the FusionAlertRuleTemplate class. /// - /// Azure resource Id - /// Azure resource name - /// Azure resource type + /// The severity for alerts created by this + /// alert rule. Possible values include: 'High', 'Medium', 'Low', + /// 'Informational' + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. /// the number of alert /// rules that were created by this template + /// The last time that this alert rule + /// template has been updated. /// The time that this alert rule template /// has been added. /// The description of the alert rule /// template. /// The display name for alert rule /// template. - /// The required data connectors - /// for this template + /// The required data sources for + /// this template /// The alert rule template status. Possible /// values include: 'Installed', 'Available', 'NotAvailable' - /// The severity for alerts created by this - /// alert rule. Possible values include: 'High', 'Medium', 'Low', - /// 'Informational' /// The tactics of the alert rule /// template - public FusionAlertRuleTemplate(string id = default(string), string name = default(string), string type = default(string), int? alertRulesCreatedByTemplateCount = default(int?), System.DateTime? createdDateUTC = default(System.DateTime?), string description = default(string), string displayName = default(string), IList requiredDataConnectors = default(IList), string status = default(string), string severity = default(string), IList tactics = default(IList)) - : base(id, name, type) + public FusionAlertRuleTemplate(string severity, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), int? alertRulesCreatedByTemplateCount = default(int?), System.DateTime? lastUpdatedDateUTC = default(System.DateTime?), System.DateTime? createdDateUTC = default(System.DateTime?), string description = default(string), string displayName = default(string), IList requiredDataConnectors = default(IList), string status = default(string), IList tactics = default(IList)) + : base(id, name, type, systemData) { AlertRulesCreatedByTemplateCount = alertRulesCreatedByTemplateCount; + LastUpdatedDateUTC = lastUpdatedDateUTC; CreatedDateUTC = createdDateUTC; Description = description; DisplayName = displayName; @@ -81,6 +89,12 @@ public FusionAlertRuleTemplate() [JsonProperty(PropertyName = "properties.alertRulesCreatedByTemplateCount")] public int? AlertRulesCreatedByTemplateCount { get; set; } + /// + /// Gets the last time that this alert rule template has been updated. + /// + [JsonProperty(PropertyName = "properties.lastUpdatedDateUTC")] + public System.DateTime? LastUpdatedDateUTC { get; private set; } + /// /// Gets the time that this alert rule template has been added. /// @@ -100,7 +114,7 @@ public FusionAlertRuleTemplate() public string DisplayName { get; set; } /// - /// Gets or sets the required data connectors for this template + /// Gets or sets the required data sources for this template /// [JsonProperty(PropertyName = "properties.requiredDataConnectors")] public IList RequiredDataConnectors { get; set; } @@ -125,5 +139,18 @@ public FusionAlertRuleTemplate() [JsonProperty(PropertyName = "properties.tactics")] public IList Tactics { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Severity == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Severity"); + } + } } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/GeoLocation.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/GeoLocation.cs new file mode 100644 index 0000000000000..5538c24adb388 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/GeoLocation.cs @@ -0,0 +1,116 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The geo-location context attached to the ip entity + /// + public partial class GeoLocation + { + /// + /// Initializes a new instance of the GeoLocation class. + /// + public GeoLocation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GeoLocation class. + /// + /// Autonomous System Number + /// City name + /// The country code according to ISO 3166 + /// format + /// Country name according to ISO 3166 Alpha + /// 2: the lowercase of the English Short Name + /// The longitude of the identified location, + /// expressed as a floating point number with range of -180 to 180, + /// with positive numbers representing East and negative numbers + /// representing West. Latitude and longitude are derived from the city + /// or postal code. + /// The latitude of the identified location, + /// expressed as a floating point number with range of - 90 to 90, with + /// positive numbers representing North and negative numbers + /// representing South. Latitude and longitude are derived from the + /// city or postal code. + /// State name + public GeoLocation(int? asn = default(int?), string city = default(string), string countryCode = default(string), string countryName = default(string), double? latitude = default(double?), double? longitude = default(double?), string state = default(string)) + { + Asn = asn; + City = city; + CountryCode = countryCode; + CountryName = countryName; + Latitude = latitude; + Longitude = longitude; + State = state; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets autonomous System Number + /// + [JsonProperty(PropertyName = "asn")] + public int? Asn { get; private set; } + + /// + /// Gets city name + /// + [JsonProperty(PropertyName = "city")] + public string City { get; private set; } + + /// + /// Gets the country code according to ISO 3166 format + /// + [JsonProperty(PropertyName = "countryCode")] + public string CountryCode { get; private set; } + + /// + /// Gets country name according to ISO 3166 Alpha 2: the lowercase of + /// the English Short Name + /// + [JsonProperty(PropertyName = "countryName")] + public string CountryName { get; private set; } + + /// + /// Gets the longitude of the identified location, expressed as a + /// floating point number with range of -180 to 180, with positive + /// numbers representing East and negative numbers representing West. + /// Latitude and longitude are derived from the city or postal code. + /// + [JsonProperty(PropertyName = "latitude")] + public double? Latitude { get; private set; } + + /// + /// Gets the latitude of the identified location, expressed as a + /// floating point number with range of - 90 to 90, with positive + /// numbers representing North and negative numbers representing South. + /// Latitude and longitude are derived from the city or postal code. + /// + [JsonProperty(PropertyName = "longitude")] + public double? Longitude { get; private set; } + + /// + /// Gets state name + /// + [JsonProperty(PropertyName = "state")] + public string State { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/GetInsightsError.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/GetInsightsError.cs new file mode 100644 index 0000000000000..bd8427d852eaa --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/GetInsightsError.cs @@ -0,0 +1,86 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// GetInsights Query Errors. + /// + public partial class GetInsightsError + { + /// + /// Initializes a new instance of the GetInsightsError class. + /// + public GetInsightsError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GetInsightsError class. + /// + /// the error message + /// the query id + public GetInsightsError(string errorMessage, string queryId = default(string)) + { + QueryId = queryId; + ErrorMessage = errorMessage; + CustomInit(); + } + /// + /// Static constructor for GetInsightsError class. + /// + static GetInsightsError() + { + Kind = "Insight"; + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the query id + /// + [JsonProperty(PropertyName = "queryId")] + public string QueryId { get; set; } + + /// + /// Gets or sets the error message + /// + [JsonProperty(PropertyName = "errorMessage")] + public string ErrorMessage { get; set; } + + /// + /// the query kind + /// + [JsonProperty(PropertyName = "kind")] + public static string Kind { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ErrorMessage == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ErrorMessage"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/GetInsightsResultsMetadata.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/GetInsightsResultsMetadata.cs new file mode 100644 index 0000000000000..c8fae0960be3e --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/GetInsightsResultsMetadata.cs @@ -0,0 +1,81 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Get Insights result metadata. + /// + public partial class GetInsightsResultsMetadata + { + /// + /// Initializes a new instance of the GetInsightsResultsMetadata class. + /// + public GetInsightsResultsMetadata() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GetInsightsResultsMetadata class. + /// + /// the total items found for the insights + /// request + /// information about the failed queries + public GetInsightsResultsMetadata(int totalCount, IList errors = default(IList)) + { + TotalCount = totalCount; + Errors = errors; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the total items found for the insights request + /// + [JsonProperty(PropertyName = "totalCount")] + public int TotalCount { get; set; } + + /// + /// Gets or sets information about the failed queries + /// + [JsonProperty(PropertyName = "errors")] + public IList Errors { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Errors != null) + { + foreach (var element in Errors) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/GetQueriesResponse.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/GetQueriesResponse.cs new file mode 100644 index 0000000000000..e99416ec586a3 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/GetQueriesResponse.cs @@ -0,0 +1,53 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Retrieve queries for entity result operation response. + /// + public partial class GetQueriesResponse + { + /// + /// Initializes a new instance of the GetQueriesResponse class. + /// + public GetQueriesResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GetQueriesResponse class. + /// + /// The query result values. + public GetQueriesResponse(IList value = default(IList)) + { + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the query result values. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/GraphQueries.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/GraphQueries.cs new file mode 100644 index 0000000000000..49fbc054ee412 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/GraphQueries.cs @@ -0,0 +1,68 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The graph query to show the current data status + /// + public partial class GraphQueries + { + /// + /// Initializes a new instance of the GraphQueries class. + /// + public GraphQueries() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GraphQueries class. + /// + /// the metric that the query is + /// checking + /// The legend for the graph + /// The base query for the graph + public GraphQueries(string metricName = default(string), string legend = default(string), string baseQuery = default(string)) + { + MetricName = metricName; + Legend = legend; + BaseQuery = baseQuery; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the metric that the query is checking + /// + [JsonProperty(PropertyName = "metricName")] + public string MetricName { get; set; } + + /// + /// Gets or sets the legend for the graph + /// + [JsonProperty(PropertyName = "legend")] + public string Legend { get; set; } + + /// + /// Gets or sets the base query for the graph + /// + [JsonProperty(PropertyName = "baseQuery")] + public string BaseQuery { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/GroupingConfiguration.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/GroupingConfiguration.cs new file mode 100644 index 0000000000000..be8d556224b51 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/GroupingConfiguration.cs @@ -0,0 +1,134 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Grouping configuration property bag. + /// + public partial class GroupingConfiguration + { + /// + /// Initializes a new instance of the GroupingConfiguration class. + /// + public GroupingConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GroupingConfiguration class. + /// + /// Grouping enabled + /// Re-open closed matching + /// incidents + /// Limit the group to alerts created + /// within the lookback duration (in ISO 8601 duration format) + /// Grouping matching method. When method + /// is Selected at least one of groupByEntities, groupByAlertDetails, + /// groupByCustomDetails must be provided and not empty. Possible + /// values include: 'AllEntities', 'AnyAlert', 'Selected' + /// A list of entity types to group by + /// (when matchingMethod is Selected). Only entities defined in the + /// current alert rule may be used. + /// A list of alert details to group + /// by (when matchingMethod is Selected) + /// A list of custom details keys to + /// group by (when matchingMethod is Selected). Only keys defined in + /// the current alert rule may be used. + public GroupingConfiguration(bool enabled, bool reopenClosedIncident, System.TimeSpan lookbackDuration, string matchingMethod, IList groupByEntities = default(IList), IList groupByAlertDetails = default(IList), IList groupByCustomDetails = default(IList)) + { + Enabled = enabled; + ReopenClosedIncident = reopenClosedIncident; + LookbackDuration = lookbackDuration; + MatchingMethod = matchingMethod; + GroupByEntities = groupByEntities; + GroupByAlertDetails = groupByAlertDetails; + GroupByCustomDetails = groupByCustomDetails; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets grouping enabled + /// + [JsonProperty(PropertyName = "enabled")] + public bool Enabled { get; set; } + + /// + /// Gets or sets re-open closed matching incidents + /// + [JsonProperty(PropertyName = "reopenClosedIncident")] + public bool ReopenClosedIncident { get; set; } + + /// + /// Gets or sets limit the group to alerts created within the lookback + /// duration (in ISO 8601 duration format) + /// + [JsonProperty(PropertyName = "lookbackDuration")] + public System.TimeSpan LookbackDuration { get; set; } + + /// + /// Gets or sets grouping matching method. When method is Selected at + /// least one of groupByEntities, groupByAlertDetails, + /// groupByCustomDetails must be provided and not empty. Possible + /// values include: 'AllEntities', 'AnyAlert', 'Selected' + /// + [JsonProperty(PropertyName = "matchingMethod")] + public string MatchingMethod { get; set; } + + /// + /// Gets or sets a list of entity types to group by (when + /// matchingMethod is Selected). Only entities defined in the current + /// alert rule may be used. + /// + [JsonProperty(PropertyName = "groupByEntities")] + public IList GroupByEntities { get; set; } + + /// + /// Gets or sets a list of alert details to group by (when + /// matchingMethod is Selected) + /// + [JsonProperty(PropertyName = "groupByAlertDetails")] + public IList GroupByAlertDetails { get; set; } + + /// + /// Gets or sets a list of custom details keys to group by (when + /// matchingMethod is Selected). Only keys defined in the current alert + /// rule may be used. + /// + [JsonProperty(PropertyName = "groupByCustomDetails")] + public IList GroupByCustomDetails { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (MatchingMethod == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "MatchingMethod"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/HostEntity.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/HostEntity.cs new file mode 100644 index 0000000000000..c9f2118c37073 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/HostEntity.cs @@ -0,0 +1,165 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents a host entity. + /// + [Newtonsoft.Json.JsonObject("Host")] + [Rest.Serialization.JsonTransformation] + public partial class HostEntity : Entity + { + /// + /// Initializes a new instance of the HostEntity class. + /// + public HostEntity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HostEntity class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// A bag of custom fields that should be + /// part of the entity and will be presented to the user. + /// The graph item display name which is a + /// short humanly readable description of the graph item instance. This + /// property is optional and might be system generated. + /// The azure resource id of the VM. + /// The DNS domain that this host belongs to. + /// Should contain the compete DNS suffix for the domain + /// The hostname without the domain + /// suffix. + /// Determines whether this host belongs + /// to a domain. + /// The host name (pre-windows2000). + /// The NT domain that this host belongs + /// to. + /// The OMS agent id, if the host has OMS + /// agent installed. + /// The operating system type. Possible values + /// include: 'Linux', 'Windows', 'Android', 'IOS', 'Unknown' + /// A free text representation of the operating + /// system. This field is meant to hold specific versions the are more + /// fine grained than OSFamily or future values not supported by + /// OSFamily enumeration + public HostEntity(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary additionalData = default(IDictionary), string friendlyName = default(string), string azureID = default(string), string dnsDomain = default(string), string hostName = default(string), bool? isDomainJoined = default(bool?), string netBiosName = default(string), string ntDomain = default(string), string omsAgentID = default(string), OSFamily? osFamily = default(OSFamily?), string osVersion = default(string)) + : base(id, name, type, systemData) + { + AdditionalData = additionalData; + FriendlyName = friendlyName; + AzureID = azureID; + DnsDomain = dnsDomain; + HostName = hostName; + IsDomainJoined = isDomainJoined; + NetBiosName = netBiosName; + NtDomain = ntDomain; + OmsAgentID = omsAgentID; + OsFamily = osFamily; + OsVersion = osVersion; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a bag of custom fields that should be part of the entity and + /// will be presented to the user. + /// + [JsonProperty(PropertyName = "properties.additionalData")] + public IDictionary AdditionalData { get; private set; } + + /// + /// Gets the graph item display name which is a short humanly readable + /// description of the graph item instance. This property is optional + /// and might be system generated. + /// + [JsonProperty(PropertyName = "properties.friendlyName")] + public string FriendlyName { get; private set; } + + /// + /// Gets the azure resource id of the VM. + /// + [JsonProperty(PropertyName = "properties.azureID")] + public string AzureID { get; private set; } + + /// + /// Gets the DNS domain that this host belongs to. Should contain the + /// compete DNS suffix for the domain + /// + [JsonProperty(PropertyName = "properties.dnsDomain")] + public string DnsDomain { get; private set; } + + /// + /// Gets the hostname without the domain suffix. + /// + [JsonProperty(PropertyName = "properties.hostName")] + public string HostName { get; private set; } + + /// + /// Gets determines whether this host belongs to a domain. + /// + [JsonProperty(PropertyName = "properties.isDomainJoined")] + public bool? IsDomainJoined { get; private set; } + + /// + /// Gets the host name (pre-windows2000). + /// + [JsonProperty(PropertyName = "properties.netBiosName")] + public string NetBiosName { get; private set; } + + /// + /// Gets the NT domain that this host belongs to. + /// + [JsonProperty(PropertyName = "properties.ntDomain")] + public string NtDomain { get; private set; } + + /// + /// Gets the OMS agent id, if the host has OMS agent installed. + /// + [JsonProperty(PropertyName = "properties.omsAgentID")] + public string OmsAgentID { get; private set; } + + /// + /// Gets or sets the operating system type. Possible values include: + /// 'Linux', 'Windows', 'Android', 'IOS', 'Unknown' + /// + [JsonProperty(PropertyName = "properties.osFamily")] + public OSFamily? OsFamily { get; set; } + + /// + /// Gets a free text representation of the operating system. This field + /// is meant to hold specific versions the are more fine grained than + /// OSFamily or future values not supported by OSFamily enumeration + /// + [JsonProperty(PropertyName = "properties.osVersion")] + public string OsVersion { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/HuntingBookmark.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/HuntingBookmark.cs new file mode 100644 index 0000000000000..b8308cccc64b8 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/HuntingBookmark.cs @@ -0,0 +1,190 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents a Hunting bookmark entity. + /// + [Newtonsoft.Json.JsonObject("Bookmark")] + [Rest.Serialization.JsonTransformation] + public partial class HuntingBookmark : Entity + { + /// + /// Initializes a new instance of the HuntingBookmark class. + /// + public HuntingBookmark() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HuntingBookmark class. + /// + /// The display name of the bookmark + /// The query of the bookmark. + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// A bag of custom fields that should be + /// part of the entity and will be presented to the user. + /// The graph item display name which is a + /// short humanly readable description of the graph item instance. This + /// property is optional and might be system generated. + /// The time the bookmark was created + /// Describes a user that created the + /// bookmark + /// The time of the event + /// List of labels relevant to this + /// bookmark + /// The notes of the bookmark + /// The query result of the bookmark. + /// The last time the bookmark was + /// updated + /// Describes a user that updated the + /// bookmark + /// Describes an incident that relates to + /// bookmark + public HuntingBookmark(string displayName, string query, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary additionalData = default(IDictionary), string friendlyName = default(string), System.DateTime? created = default(System.DateTime?), UserInfo createdBy = default(UserInfo), System.DateTime? eventTime = default(System.DateTime?), IList labels = default(IList), string notes = default(string), string queryResult = default(string), System.DateTime? updated = default(System.DateTime?), UserInfo updatedBy = default(UserInfo), IncidentInfo incidentInfo = default(IncidentInfo)) + : base(id, name, type, systemData) + { + AdditionalData = additionalData; + FriendlyName = friendlyName; + Created = created; + CreatedBy = createdBy; + DisplayName = displayName; + EventTime = eventTime; + Labels = labels; + Notes = notes; + Query = query; + QueryResult = queryResult; + Updated = updated; + UpdatedBy = updatedBy; + IncidentInfo = incidentInfo; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a bag of custom fields that should be part of the entity and + /// will be presented to the user. + /// + [JsonProperty(PropertyName = "properties.additionalData")] + public IDictionary AdditionalData { get; private set; } + + /// + /// Gets the graph item display name which is a short humanly readable + /// description of the graph item instance. This property is optional + /// and might be system generated. + /// + [JsonProperty(PropertyName = "properties.friendlyName")] + public string FriendlyName { get; private set; } + + /// + /// Gets or sets the time the bookmark was created + /// + [JsonProperty(PropertyName = "properties.created")] + public System.DateTime? Created { get; set; } + + /// + /// Gets or sets describes a user that created the bookmark + /// + [JsonProperty(PropertyName = "properties.createdBy")] + public UserInfo CreatedBy { get; set; } + + /// + /// Gets or sets the display name of the bookmark + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets the time of the event + /// + [JsonProperty(PropertyName = "properties.eventTime")] + public System.DateTime? EventTime { get; set; } + + /// + /// Gets or sets list of labels relevant to this bookmark + /// + [JsonProperty(PropertyName = "properties.labels")] + public IList Labels { get; set; } + + /// + /// Gets or sets the notes of the bookmark + /// + [JsonProperty(PropertyName = "properties.notes")] + public string Notes { get; set; } + + /// + /// Gets or sets the query of the bookmark. + /// + [JsonProperty(PropertyName = "properties.query")] + public string Query { get; set; } + + /// + /// Gets or sets the query result of the bookmark. + /// + [JsonProperty(PropertyName = "properties.queryResult")] + public string QueryResult { get; set; } + + /// + /// Gets or sets the last time the bookmark was updated + /// + [JsonProperty(PropertyName = "properties.updated")] + public System.DateTime? Updated { get; set; } + + /// + /// Gets or sets describes a user that updated the bookmark + /// + [JsonProperty(PropertyName = "properties.updatedBy")] + public UserInfo UpdatedBy { get; set; } + + /// + /// Gets or sets describes an incident that relates to bookmark + /// + [JsonProperty(PropertyName = "properties.incidentInfo")] + public IncidentInfo IncidentInfo { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DisplayName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DisplayName"); + } + if (Query == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Query"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Incident.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Incident.cs index 9d7d25e0af371..fdebb69a377d4 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Incident.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Incident.cs @@ -39,9 +39,14 @@ public Incident() /// The status of the incident. Possible values /// include: 'New', 'Active', 'Closed' /// The title of the incident - /// Azure resource Id - /// Azure resource name - /// Azure resource type + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. /// Etag of the azure resource /// Additional data on the /// incident @@ -64,6 +69,10 @@ public Incident() /// A sequential number /// List of labels relevant to this /// incident + /// The name of the source provider that + /// generated the incident + /// The incident ID assigned by the + /// incident provider /// The time of the last activity in /// the incident /// The last time the incident was @@ -72,8 +81,8 @@ public Incident() /// to /// List of resource ids of /// Analytic rules related to the incident - public Incident(string severity, string status, string title, string id = default(string), string name = default(string), string type = default(string), string etag = default(string), IncidentAdditionalData additionalData = default(IncidentAdditionalData), string classification = default(string), string classificationComment = default(string), string classificationReason = default(string), System.DateTime? createdTimeUtc = default(System.DateTime?), string description = default(string), System.DateTime? firstActivityTimeUtc = default(System.DateTime?), string incidentUrl = default(string), int? incidentNumber = default(int?), IList labels = default(IList), System.DateTime? lastActivityTimeUtc = default(System.DateTime?), System.DateTime? lastModifiedTimeUtc = default(System.DateTime?), IncidentOwnerInfo owner = default(IncidentOwnerInfo), IList relatedAnalyticRuleIds = default(IList)) - : base(id, name, type, etag) + public Incident(string severity, string status, string title, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string), IncidentAdditionalData additionalData = default(IncidentAdditionalData), string classification = default(string), string classificationComment = default(string), string classificationReason = default(string), System.DateTime? createdTimeUtc = default(System.DateTime?), string description = default(string), System.DateTime? firstActivityTimeUtc = default(System.DateTime?), string incidentUrl = default(string), int? incidentNumber = default(int?), IList labels = default(IList), string providerName = default(string), string providerIncidentId = default(string), System.DateTime? lastActivityTimeUtc = default(System.DateTime?), System.DateTime? lastModifiedTimeUtc = default(System.DateTime?), IncidentOwnerInfo owner = default(IncidentOwnerInfo), IList relatedAnalyticRuleIds = default(IList)) + : base(id, name, type, systemData, etag) { AdditionalData = additionalData; Classification = classification; @@ -85,6 +94,8 @@ public Incident() IncidentUrl = incidentUrl; IncidentNumber = incidentNumber; Labels = labels; + ProviderName = providerName; + ProviderIncidentId = providerIncidentId; LastActivityTimeUtc = lastActivityTimeUtc; LastModifiedTimeUtc = lastModifiedTimeUtc; Owner = owner; @@ -164,6 +175,19 @@ public Incident() [JsonProperty(PropertyName = "properties.labels")] public IList Labels { get; set; } + /// + /// Gets or sets the name of the source provider that generated the + /// incident + /// + [JsonProperty(PropertyName = "properties.providerName")] + public string ProviderName { get; set; } + + /// + /// Gets or sets the incident ID assigned by the incident provider + /// + [JsonProperty(PropertyName = "properties.providerIncidentId")] + public string ProviderIncidentId { get; set; } + /// /// Gets or sets the time of the last activity in the incident /// diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeConsentList.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IncidentAlertList.cs similarity index 63% rename from sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeConsentList.cs rename to sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IncidentAlertList.cs index 18fff9f137df9..79db6d79bfc51 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeConsentList.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IncidentAlertList.cs @@ -17,27 +17,24 @@ namespace Microsoft.Azure.Management.SecurityInsights.Models using System.Linq; /// - /// List of all the office365 consents. + /// List of incident alerts. /// - public partial class OfficeConsentList + public partial class IncidentAlertList { /// - /// Initializes a new instance of the OfficeConsentList class. + /// Initializes a new instance of the IncidentAlertList class. /// - public OfficeConsentList() + public IncidentAlertList() { CustomInit(); } /// - /// Initializes a new instance of the OfficeConsentList class. + /// Initializes a new instance of the IncidentAlertList class. /// - /// Array of the consents. - /// URL to fetch the next set of office - /// consents. - public OfficeConsentList(IList value, string nextLink = default(string)) + /// Array of incident alerts. + public IncidentAlertList(IList value) { - NextLink = nextLink; Value = value; CustomInit(); } @@ -48,16 +45,10 @@ public OfficeConsentList() partial void CustomInit(); /// - /// Gets URL to fetch the next set of office consents. - /// - [JsonProperty(PropertyName = "nextLink")] - public string NextLink { get; private set; } - - /// - /// Gets or sets array of the consents. + /// Gets or sets array of incident alerts. /// [JsonProperty(PropertyName = "value")] - public IList Value { get; set; } + public IList Value { get; set; } /// /// Validate the object. diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IncidentBookmarkList.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IncidentBookmarkList.cs new file mode 100644 index 0000000000000..721d7dc4a0a80 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IncidentBookmarkList.cs @@ -0,0 +1,77 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// List of incident bookmarks. + /// + public partial class IncidentBookmarkList + { + /// + /// Initializes a new instance of the IncidentBookmarkList class. + /// + public IncidentBookmarkList() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IncidentBookmarkList class. + /// + /// Array of incident bookmarks. + public IncidentBookmarkList(IList value) + { + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets array of incident bookmarks. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Value == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Value"); + } + if (Value != null) + { + foreach (var element in Value) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IncidentComment.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IncidentComment.cs index d1031fc39c108..ddd11a29a4ea4 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IncidentComment.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IncidentComment.cs @@ -19,7 +19,7 @@ namespace Microsoft.Azure.Management.SecurityInsights.Models /// Represents an incident comment /// [Rest.Serialization.JsonTransformation] - public partial class IncidentComment : Resource + public partial class IncidentComment : ResourceWithEtag { /// /// Initializes a new instance of the IncidentComment class. @@ -33,17 +33,26 @@ public IncidentComment() /// Initializes a new instance of the IncidentComment class. /// /// The comment message - /// Azure resource Id - /// Azure resource name - /// Azure resource type + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Etag of the azure resource /// The time the comment was /// created + /// The time the comment was + /// updated /// Describes the client that created the /// comment - public IncidentComment(string message, string id = default(string), string name = default(string), string type = default(string), System.DateTime? createdTimeUtc = default(System.DateTime?), ClientInfo author = default(ClientInfo)) - : base(id, name, type) + public IncidentComment(string message, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string), System.DateTime? createdTimeUtc = default(System.DateTime?), System.DateTime? lastModifiedTimeUtc = default(System.DateTime?), ClientInfo author = default(ClientInfo)) + : base(id, name, type, systemData, etag) { CreatedTimeUtc = createdTimeUtc; + LastModifiedTimeUtc = lastModifiedTimeUtc; Message = message; Author = author; CustomInit(); @@ -60,6 +69,12 @@ public IncidentComment() [JsonProperty(PropertyName = "properties.createdTimeUtc")] public System.DateTime? CreatedTimeUtc { get; private set; } + /// + /// Gets the time the comment was updated + /// + [JsonProperty(PropertyName = "properties.lastModifiedTimeUtc")] + public System.DateTime? LastModifiedTimeUtc { get; private set; } + /// /// Gets or sets the comment message /// diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IncidentConfiguration.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IncidentConfiguration.cs new file mode 100644 index 0000000000000..a1ec0918d2a69 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IncidentConfiguration.cs @@ -0,0 +1,77 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Incident Configuration property bag. + /// + public partial class IncidentConfiguration + { + /// + /// Initializes a new instance of the IncidentConfiguration class. + /// + public IncidentConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IncidentConfiguration class. + /// + /// Create incidents from alerts triggered + /// by this analytics rule + /// Set how the alerts that are + /// triggered by this analytics rule, are grouped into + /// incidents + public IncidentConfiguration(bool createIncident, GroupingConfiguration groupingConfiguration = default(GroupingConfiguration)) + { + CreateIncident = createIncident; + GroupingConfiguration = groupingConfiguration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets create incidents from alerts triggered by this + /// analytics rule + /// + [JsonProperty(PropertyName = "createIncident")] + public bool CreateIncident { get; set; } + + /// + /// Gets or sets set how the alerts that are triggered by this + /// analytics rule, are grouped into incidents + /// + [JsonProperty(PropertyName = "groupingConfiguration")] + public GroupingConfiguration GroupingConfiguration { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (GroupingConfiguration != null) + { + GroupingConfiguration.Validate(); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IncidentEntitiesResponse.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IncidentEntitiesResponse.cs new file mode 100644 index 0000000000000..977788a73b0b0 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IncidentEntitiesResponse.cs @@ -0,0 +1,64 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The incident related entities response. + /// + public partial class IncidentEntitiesResponse + { + /// + /// Initializes a new instance of the IncidentEntitiesResponse class. + /// + public IncidentEntitiesResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IncidentEntitiesResponse class. + /// + /// Array of the incident related + /// entities. + /// The metadata from the incident related + /// entities results. + public IncidentEntitiesResponse(IList entities = default(IList), IList metaData = default(IList)) + { + Entities = entities; + MetaData = metaData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets array of the incident related entities. + /// + [JsonProperty(PropertyName = "entities")] + public IList Entities { get; set; } + + /// + /// Gets or sets the metadata from the incident related entities + /// results. + /// + [JsonProperty(PropertyName = "metaData")] + public IList MetaData { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IncidentEntitiesResultsMetadata.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IncidentEntitiesResultsMetadata.cs new file mode 100644 index 0000000000000..4731429847eb9 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IncidentEntitiesResultsMetadata.cs @@ -0,0 +1,88 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Information of a specific aggregation in the incident related entities + /// result. + /// + public partial class IncidentEntitiesResultsMetadata + { + /// + /// Initializes a new instance of the IncidentEntitiesResultsMetadata + /// class. + /// + public IncidentEntitiesResultsMetadata() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IncidentEntitiesResultsMetadata + /// class. + /// + /// Total number of aggregations of the given kind + /// in the incident related entities result. + /// The kind of the aggregated entity. + /// Possible values include: 'Account', 'Host', 'File', + /// 'AzureResource', 'CloudApplication', 'DnsResolution', 'FileHash', + /// 'Ip', 'Malware', 'Process', 'RegistryKey', 'RegistryValue', + /// 'SecurityGroup', 'Url', 'IoTDevice', 'SecurityAlert', 'Bookmark', + /// 'MailCluster', 'MailMessage', 'Mailbox', 'SubmissionMail' + public IncidentEntitiesResultsMetadata(int count, string entityKind) + { + Count = count; + EntityKind = entityKind; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets total number of aggregations of the given kind in the + /// incident related entities result. + /// + [JsonProperty(PropertyName = "count")] + public int Count { get; set; } + + /// + /// Gets or sets the kind of the aggregated entity. Possible values + /// include: 'Account', 'Host', 'File', 'AzureResource', + /// 'CloudApplication', 'DnsResolution', 'FileHash', 'Ip', 'Malware', + /// 'Process', 'RegistryKey', 'RegistryValue', 'SecurityGroup', 'Url', + /// 'IoTDevice', 'SecurityAlert', 'Bookmark', 'MailCluster', + /// 'MailMessage', 'Mailbox', 'SubmissionMail' + /// + [JsonProperty(PropertyName = "entityKind")] + public string EntityKind { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (EntityKind == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "EntityKind"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IncidentInfo.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IncidentInfo.cs index ad9298165dfde..4bff183b19a84 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IncidentInfo.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IncidentInfo.cs @@ -31,8 +31,7 @@ public IncidentInfo() /// /// Incident Id /// The severity of the incident. Possible - /// values include: 'Critical', 'High', 'Medium', 'Low', - /// 'Informational' + /// values include: 'High', 'Medium', 'Low', 'Informational' /// The title of the incident /// Relation Name public IncidentInfo(string incidentId = default(string), string severity = default(string), string title = default(string), string relationName = default(string)) @@ -57,7 +56,7 @@ public IncidentInfo() /// /// Gets or sets the severity of the incident. Possible values include: - /// 'Critical', 'High', 'Medium', 'Low', 'Informational' + /// 'High', 'Medium', 'Low', 'Informational' /// [JsonProperty(PropertyName = "severity")] public string Severity { get; set; } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IncidentOwnerInfo.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IncidentOwnerInfo.cs index 0259c7dd01bdd..7f0e76a11915e 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IncidentOwnerInfo.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IncidentOwnerInfo.cs @@ -37,12 +37,16 @@ public IncidentOwnerInfo() /// assigned to. /// The user principal name of the user /// the incident is assigned to. - public IncidentOwnerInfo(string email = default(string), string assignedTo = default(string), System.Guid? objectId = default(System.Guid?), string userPrincipalName = default(string)) + /// The type of the owner the incident is + /// assigned to. Possible values include: 'Unknown', 'User', + /// 'Group' + public IncidentOwnerInfo(string email = default(string), string assignedTo = default(string), System.Guid? objectId = default(System.Guid?), string userPrincipalName = default(string), string ownerType = default(string)) { Email = email; AssignedTo = assignedTo; ObjectId = objectId; UserPrincipalName = userPrincipalName; + OwnerType = ownerType; CustomInit(); } @@ -76,5 +80,12 @@ public IncidentOwnerInfo() [JsonProperty(PropertyName = "userPrincipalName")] public string UserPrincipalName { get; set; } + /// + /// Gets the type of the owner the incident is assigned to. Possible + /// values include: 'Unknown', 'User', 'Group' + /// + [JsonProperty(PropertyName = "ownerType")] + public string OwnerType { get; private set; } + } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/InsightQueryItem.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/InsightQueryItem.cs new file mode 100644 index 0000000000000..bbbca350341fb --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/InsightQueryItem.cs @@ -0,0 +1,57 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents Insight Query. + /// + [Newtonsoft.Json.JsonObject("Insight")] + public partial class InsightQueryItem : EntityQueryItem + { + /// + /// Initializes a new instance of the InsightQueryItem class. + /// + public InsightQueryItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InsightQueryItem class. + /// + /// Query Template ARM ID + /// Query Template ARM Name + /// ARM Type + /// Properties bag for + /// InsightQueryItem + public InsightQueryItem(string id = default(string), string name = default(string), string type = default(string), InsightQueryItemProperties properties = default(InsightQueryItemProperties)) + : base(id, name, type) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets properties bag for InsightQueryItem + /// + [JsonProperty(PropertyName = "properties")] + public InsightQueryItemProperties Properties { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/InsightQueryItemProperties.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/InsightQueryItemProperties.cs new file mode 100644 index 0000000000000..ac1af8ad82335 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/InsightQueryItemProperties.cs @@ -0,0 +1,122 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents Insight Query. + /// + public partial class InsightQueryItemProperties : EntityQueryItemProperties + { + /// + /// Initializes a new instance of the InsightQueryItemProperties class. + /// + public InsightQueryItemProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InsightQueryItemProperties class. + /// + /// Data types for template + /// The type of the entity. Possible + /// values include: 'Account', 'Host', 'File', 'AzureResource', + /// 'CloudApplication', 'DNS', 'FileHash', 'IP', 'Malware', 'Process', + /// 'RegistryKey', 'RegistryValue', 'SecurityGroup', 'URL', + /// 'IoTDevice', 'SecurityAlert', 'HuntingBookmark', 'MailCluster', + /// 'MailMessage', 'Mailbox', 'SubmissionMail' + /// Data types for + /// template + /// The query applied only to entities + /// matching to all filters + /// The insight display name. + /// The insight description. + /// The base query of the insight. + /// The insight table query. + /// The insight chart query. + /// The activity query + /// definitions. + /// The insight chart query. + /// The insight chart query. + public InsightQueryItemProperties(IList dataTypes = default(IList), string inputEntityType = default(string), IList> requiredInputFieldsSets = default(IList>), object entitiesFilter = default(object), string displayName = default(string), string description = default(string), string baseQuery = default(string), InsightQueryItemPropertiesTableQuery tableQuery = default(InsightQueryItemPropertiesTableQuery), object chartQuery = default(object), InsightQueryItemPropertiesAdditionalQuery additionalQuery = default(InsightQueryItemPropertiesAdditionalQuery), InsightQueryItemPropertiesDefaultTimeRange defaultTimeRange = default(InsightQueryItemPropertiesDefaultTimeRange), InsightQueryItemPropertiesReferenceTimeRange referenceTimeRange = default(InsightQueryItemPropertiesReferenceTimeRange)) + : base(dataTypes, inputEntityType, requiredInputFieldsSets, entitiesFilter) + { + DisplayName = displayName; + Description = description; + BaseQuery = baseQuery; + TableQuery = tableQuery; + ChartQuery = chartQuery; + AdditionalQuery = additionalQuery; + DefaultTimeRange = defaultTimeRange; + ReferenceTimeRange = referenceTimeRange; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the insight display name. + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets the insight description. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets the base query of the insight. + /// + [JsonProperty(PropertyName = "baseQuery")] + public string BaseQuery { get; set; } + + /// + /// Gets or sets the insight table query. + /// + [JsonProperty(PropertyName = "tableQuery")] + public InsightQueryItemPropertiesTableQuery TableQuery { get; set; } + + /// + /// Gets or sets the insight chart query. + /// + [JsonProperty(PropertyName = "chartQuery")] + public object ChartQuery { get; set; } + + /// + /// Gets or sets the activity query definitions. + /// + [JsonProperty(PropertyName = "additionalQuery")] + public InsightQueryItemPropertiesAdditionalQuery AdditionalQuery { get; set; } + + /// + /// Gets or sets the insight chart query. + /// + [JsonProperty(PropertyName = "defaultTimeRange")] + public InsightQueryItemPropertiesDefaultTimeRange DefaultTimeRange { get; set; } + + /// + /// Gets or sets the insight chart query. + /// + [JsonProperty(PropertyName = "referenceTimeRange")] + public InsightQueryItemPropertiesReferenceTimeRange ReferenceTimeRange { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/InsightQueryItemPropertiesAdditionalQuery.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/InsightQueryItemPropertiesAdditionalQuery.cs new file mode 100644 index 0000000000000..60480cc3e7a28 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/InsightQueryItemPropertiesAdditionalQuery.cs @@ -0,0 +1,61 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The activity query definitions. + /// + public partial class InsightQueryItemPropertiesAdditionalQuery + { + /// + /// Initializes a new instance of the + /// InsightQueryItemPropertiesAdditionalQuery class. + /// + public InsightQueryItemPropertiesAdditionalQuery() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// InsightQueryItemPropertiesAdditionalQuery class. + /// + /// The insight query. + /// The insight text. + public InsightQueryItemPropertiesAdditionalQuery(string query = default(string), string text = default(string)) + { + Query = query; + Text = text; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the insight query. + /// + [JsonProperty(PropertyName = "query")] + public string Query { get; set; } + + /// + /// Gets or sets the insight text. + /// + [JsonProperty(PropertyName = "text")] + public string Text { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/InsightQueryItemPropertiesDefaultTimeRange.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/InsightQueryItemPropertiesDefaultTimeRange.cs new file mode 100644 index 0000000000000..f4392ca2832c5 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/InsightQueryItemPropertiesDefaultTimeRange.cs @@ -0,0 +1,63 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The insight chart query. + /// + public partial class InsightQueryItemPropertiesDefaultTimeRange + { + /// + /// Initializes a new instance of the + /// InsightQueryItemPropertiesDefaultTimeRange class. + /// + public InsightQueryItemPropertiesDefaultTimeRange() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// InsightQueryItemPropertiesDefaultTimeRange class. + /// + /// The padding for the start time of the + /// query. + /// The padding for the end time of the + /// query. + public InsightQueryItemPropertiesDefaultTimeRange(string beforeRange = default(string), string afterRange = default(string)) + { + BeforeRange = beforeRange; + AfterRange = afterRange; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the padding for the start time of the query. + /// + [JsonProperty(PropertyName = "beforeRange")] + public string BeforeRange { get; set; } + + /// + /// Gets or sets the padding for the end time of the query. + /// + [JsonProperty(PropertyName = "afterRange")] + public string AfterRange { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/InsightQueryItemPropertiesReferenceTimeRange.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/InsightQueryItemPropertiesReferenceTimeRange.cs new file mode 100644 index 0000000000000..dc43f315b7b42 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/InsightQueryItemPropertiesReferenceTimeRange.cs @@ -0,0 +1,54 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The insight chart query. + /// + public partial class InsightQueryItemPropertiesReferenceTimeRange + { + /// + /// Initializes a new instance of the + /// InsightQueryItemPropertiesReferenceTimeRange class. + /// + public InsightQueryItemPropertiesReferenceTimeRange() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// InsightQueryItemPropertiesReferenceTimeRange class. + /// + /// Additional query time for looking + /// back. + public InsightQueryItemPropertiesReferenceTimeRange(string beforeRange = default(string)) + { + BeforeRange = beforeRange; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets additional query time for looking back. + /// + [JsonProperty(PropertyName = "beforeRange")] + public string BeforeRange { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/InsightQueryItemPropertiesTableQuery.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/InsightQueryItemPropertiesTableQuery.cs new file mode 100644 index 0000000000000..e6c0155561d18 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/InsightQueryItemPropertiesTableQuery.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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The insight table query. + /// + public partial class InsightQueryItemPropertiesTableQuery + { + /// + /// Initializes a new instance of the + /// InsightQueryItemPropertiesTableQuery class. + /// + public InsightQueryItemPropertiesTableQuery() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// InsightQueryItemPropertiesTableQuery class. + /// + /// List of insight column + /// definitions. + /// List of insight queries + /// definitions. + public InsightQueryItemPropertiesTableQuery(IList columnsDefinitions = default(IList), IList queriesDefinitions = default(IList)) + { + ColumnsDefinitions = columnsDefinitions; + QueriesDefinitions = queriesDefinitions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of insight column definitions. + /// + [JsonProperty(PropertyName = "columnsDefinitions")] + public IList ColumnsDefinitions { get; set; } + + /// + /// Gets or sets list of insight queries definitions. + /// + [JsonProperty(PropertyName = "queriesDefinitions")] + public IList QueriesDefinitions { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem.cs new file mode 100644 index 0000000000000..68c0b92c15a7b --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem.cs @@ -0,0 +1,68 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem + { + /// + /// Initializes a new instance of the + /// InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem class. + /// + public InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem class. + /// + /// Insight column header. + /// Insights Column type. Possible values + /// include: 'Number', 'String', 'Date', 'Entity' + /// Is query supports deep-link. + public InsightQueryItemPropertiesTableQueryColumnsDefinitionsItem(string header = default(string), string outputType = default(string), bool? supportDeepLink = default(bool?)) + { + Header = header; + OutputType = outputType; + SupportDeepLink = supportDeepLink; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets insight column header. + /// + [JsonProperty(PropertyName = "header")] + public string Header { get; set; } + + /// + /// Gets or sets insights Column type. Possible values include: + /// 'Number', 'String', 'Date', 'Entity' + /// + [JsonProperty(PropertyName = "outputType")] + public string OutputType { get; set; } + + /// + /// Gets or sets is query supports deep-link. + /// + [JsonProperty(PropertyName = "supportDeepLink")] + public bool? SupportDeepLink { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem.cs new file mode 100644 index 0000000000000..25c8c83e6b7f2 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem.cs @@ -0,0 +1,76 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem + { + /// + /// Initializes a new instance of the + /// InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem class. + /// + public InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem class. + /// + /// Insight column header. + /// Insight column header. + /// Insight column header. + /// Insight column header. + public InsightQueryItemPropertiesTableQueryQueriesDefinitionsItem(string filter = default(string), string summarize = default(string), string project = default(string), IList linkColumnsDefinitions = default(IList)) + { + Filter = filter; + Summarize = summarize; + Project = project; + LinkColumnsDefinitions = linkColumnsDefinitions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets insight column header. + /// + [JsonProperty(PropertyName = "filter")] + public string Filter { get; set; } + + /// + /// Gets or sets insight column header. + /// + [JsonProperty(PropertyName = "summarize")] + public string Summarize { get; set; } + + /// + /// Gets or sets insight column header. + /// + [JsonProperty(PropertyName = "project")] + public string Project { get; set; } + + /// + /// Gets or sets insight column header. + /// + [JsonProperty(PropertyName = "linkColumnsDefinitions")] + public IList LinkColumnsDefinitions { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/InsightQueryItemPropertiesTableQueryQueriesDefinitionsItemLinkColumnsDefinitionsItem.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/InsightQueryItemPropertiesTableQueryQueriesDefinitionsItemLinkColumnsDefinitionsItem.cs new file mode 100644 index 0000000000000..e08d55d4383e1 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/InsightQueryItemPropertiesTableQueryQueriesDefinitionsItemLinkColumnsDefinitionsItem.cs @@ -0,0 +1,61 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class InsightQueryItemPropertiesTableQueryQueriesDefinitionsItemLinkColumnsDefinitionsItem + { + /// + /// Initializes a new instance of the + /// InsightQueryItemPropertiesTableQueryQueriesDefinitionsItemLinkColumnsDefinitionsItem + /// class. + /// + public InsightQueryItemPropertiesTableQueryQueriesDefinitionsItemLinkColumnsDefinitionsItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// InsightQueryItemPropertiesTableQueryQueriesDefinitionsItemLinkColumnsDefinitionsItem + /// class. + /// + /// Insight Link Definition Projected + /// Name. + /// Insight Link Definition Query. + public InsightQueryItemPropertiesTableQueryQueriesDefinitionsItemLinkColumnsDefinitionsItem(string projectedName = default(string), string query = default(string)) + { + ProjectedName = projectedName; + Query = query; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets insight Link Definition Projected Name. + /// + [JsonProperty(PropertyName = "projectedName")] + public string ProjectedName { get; set; } + + /// + /// Gets or sets insight Link Definition Query. + /// + [JsonProperty(PropertyName = "Query")] + public string Query { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/InsightsTableResult.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/InsightsTableResult.cs new file mode 100644 index 0000000000000..07fdde8d4470d --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/InsightsTableResult.cs @@ -0,0 +1,61 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Query results for table insights query. + /// + public partial class InsightsTableResult + { + /// + /// Initializes a new instance of the InsightsTableResult class. + /// + public InsightsTableResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InsightsTableResult class. + /// + /// Columns Metadata of the table + /// Rows data of the table + public InsightsTableResult(IList columns = default(IList), IList> rows = default(IList>)) + { + Columns = columns; + Rows = rows; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets columns Metadata of the table + /// + [JsonProperty(PropertyName = "columns")] + public IList Columns { get; set; } + + /// + /// Gets or sets rows data of the table + /// + [JsonProperty(PropertyName = "rows")] + public IList> Rows { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/InsightsTableResultColumnsItem.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/InsightsTableResultColumnsItem.cs new file mode 100644 index 0000000000000..0af432ad43c71 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/InsightsTableResultColumnsItem.cs @@ -0,0 +1,58 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class InsightsTableResultColumnsItem + { + /// + /// Initializes a new instance of the InsightsTableResultColumnsItem + /// class. + /// + public InsightsTableResultColumnsItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InsightsTableResultColumnsItem + /// class. + /// + /// the type of the colum + /// the name of the colum + public InsightsTableResultColumnsItem(string type = default(string), string name = default(string)) + { + Type = type; + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the type of the colum + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or sets the name of the colum + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/InstructionSteps.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/InstructionSteps.cs new file mode 100644 index 0000000000000..17f6aa4273c1d --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/InstructionSteps.cs @@ -0,0 +1,69 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Instruction steps to enable the connector + /// + public partial class InstructionSteps + { + /// + /// Initializes a new instance of the InstructionSteps class. + /// + public InstructionSteps() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InstructionSteps class. + /// + /// Instruction step title + /// Instruction step description + /// Instruction step details + public InstructionSteps(string title = default(string), string description = default(string), IList instructions = default(IList)) + { + Title = title; + Description = description; + Instructions = instructions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets instruction step title + /// + [JsonProperty(PropertyName = "title")] + public string Title { get; set; } + + /// + /// Gets or sets instruction step description + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets instruction step details + /// + [JsonProperty(PropertyName = "instructions")] + public IList Instructions { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/InstructionStepsInstructionsItem.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/InstructionStepsInstructionsItem.cs new file mode 100644 index 0000000000000..f78d430c9203e --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/InstructionStepsInstructionsItem.cs @@ -0,0 +1,56 @@ +// +// 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.Models +{ + using System.Linq; + + public partial class InstructionStepsInstructionsItem : ConnectorInstructionModelBase + { + /// + /// Initializes a new instance of the InstructionStepsInstructionsItem + /// class. + /// + public InstructionStepsInstructionsItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the InstructionStepsInstructionsItem + /// class. + /// + /// The kind of the setting. Possible values + /// include: 'CopyableLabel', 'InstructionStepsGroup', + /// 'InfoMessage' + /// The parameters for the setting + public InstructionStepsInstructionsItem(string type, object parameters = default(object)) + : base(type, parameters) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IoTDeviceEntity.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IoTDeviceEntity.cs new file mode 100644 index 0000000000000..bf806cb66aa6c --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IoTDeviceEntity.cs @@ -0,0 +1,225 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents an IoT device entity. + /// + [Newtonsoft.Json.JsonObject("IoTDevice")] + [Rest.Serialization.JsonTransformation] + public partial class IoTDeviceEntity : Entity + { + /// + /// Initializes a new instance of the IoTDeviceEntity class. + /// + public IoTDeviceEntity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IoTDeviceEntity class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// A bag of custom fields that should be + /// part of the entity and will be presented to the user. + /// The graph item display name which is a + /// short humanly readable description of the graph item instance. This + /// property is optional and might be system generated. + /// The ID of the IoT Device in the IoT + /// Hub + /// The friendly name of the device + /// The source of the device + /// The ID of the security agent + /// running on the device + /// The type of the device + /// The vendor of the device + /// The ID of the edge device + /// The MAC address of the device + /// The model of the device + /// The serial number of the device + /// The firmware version of the + /// device + /// The operating system of the + /// device + /// The AzureResource entity id of the IoT + /// Hub + /// The Host entity id of this + /// device + /// The IP entity if of this + /// device + /// A list of TI contexts attached to + /// the IoTDevice entity. + /// A list of protocols of the IoTDevice + /// entity. + public IoTDeviceEntity(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary additionalData = default(IDictionary), string friendlyName = default(string), string deviceId = default(string), string deviceName = default(string), string source = default(string), System.Guid? iotSecurityAgentId = default(System.Guid?), string deviceType = default(string), string vendor = default(string), string edgeId = default(string), string macAddress = default(string), string model = default(string), string serialNumber = default(string), string firmwareVersion = default(string), string operatingSystem = default(string), string iotHubEntityId = default(string), string hostEntityId = default(string), string ipAddressEntityId = default(string), IList threatIntelligence = default(IList), IList protocols = default(IList)) + : base(id, name, type, systemData) + { + AdditionalData = additionalData; + FriendlyName = friendlyName; + DeviceId = deviceId; + DeviceName = deviceName; + Source = source; + IotSecurityAgentId = iotSecurityAgentId; + DeviceType = deviceType; + Vendor = vendor; + EdgeId = edgeId; + MacAddress = macAddress; + Model = model; + SerialNumber = serialNumber; + FirmwareVersion = firmwareVersion; + OperatingSystem = operatingSystem; + IotHubEntityId = iotHubEntityId; + HostEntityId = hostEntityId; + IpAddressEntityId = ipAddressEntityId; + ThreatIntelligence = threatIntelligence; + Protocols = protocols; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a bag of custom fields that should be part of the entity and + /// will be presented to the user. + /// + [JsonProperty(PropertyName = "properties.additionalData")] + public IDictionary AdditionalData { get; private set; } + + /// + /// Gets the graph item display name which is a short humanly readable + /// description of the graph item instance. This property is optional + /// and might be system generated. + /// + [JsonProperty(PropertyName = "properties.friendlyName")] + public string FriendlyName { get; private set; } + + /// + /// Gets the ID of the IoT Device in the IoT Hub + /// + [JsonProperty(PropertyName = "properties.deviceId")] + public string DeviceId { get; private set; } + + /// + /// Gets the friendly name of the device + /// + [JsonProperty(PropertyName = "properties.deviceName")] + public string DeviceName { get; private set; } + + /// + /// Gets the source of the device + /// + [JsonProperty(PropertyName = "properties.source")] + public string Source { get; private set; } + + /// + /// Gets the ID of the security agent running on the device + /// + [JsonProperty(PropertyName = "properties.iotSecurityAgentId")] + public System.Guid? IotSecurityAgentId { get; private set; } + + /// + /// Gets the type of the device + /// + [JsonProperty(PropertyName = "properties.deviceType")] + public string DeviceType { get; private set; } + + /// + /// Gets the vendor of the device + /// + [JsonProperty(PropertyName = "properties.vendor")] + public string Vendor { get; private set; } + + /// + /// Gets the ID of the edge device + /// + [JsonProperty(PropertyName = "properties.edgeId")] + public string EdgeId { get; private set; } + + /// + /// Gets the MAC address of the device + /// + [JsonProperty(PropertyName = "properties.macAddress")] + public string MacAddress { get; private set; } + + /// + /// Gets the model of the device + /// + [JsonProperty(PropertyName = "properties.model")] + public string Model { get; private set; } + + /// + /// Gets the serial number of the device + /// + [JsonProperty(PropertyName = "properties.serialNumber")] + public string SerialNumber { get; private set; } + + /// + /// Gets the firmware version of the device + /// + [JsonProperty(PropertyName = "properties.firmwareVersion")] + public string FirmwareVersion { get; private set; } + + /// + /// Gets the operating system of the device + /// + [JsonProperty(PropertyName = "properties.operatingSystem")] + public string OperatingSystem { get; private set; } + + /// + /// Gets the AzureResource entity id of the IoT Hub + /// + [JsonProperty(PropertyName = "properties.iotHubEntityId")] + public string IotHubEntityId { get; private set; } + + /// + /// Gets the Host entity id of this device + /// + [JsonProperty(PropertyName = "properties.hostEntityId")] + public string HostEntityId { get; private set; } + + /// + /// Gets the IP entity if of this device + /// + [JsonProperty(PropertyName = "properties.ipAddressEntityId")] + public string IpAddressEntityId { get; private set; } + + /// + /// Gets a list of TI contexts attached to the IoTDevice entity. + /// + [JsonProperty(PropertyName = "properties.threatIntelligence")] + public IList ThreatIntelligence { get; private set; } + + /// + /// Gets a list of protocols of the IoTDevice entity. + /// + [JsonProperty(PropertyName = "properties.protocols")] + public IList Protocols { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IpEntity.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IpEntity.cs new file mode 100644 index 0000000000000..92ad4e8230635 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IpEntity.cs @@ -0,0 +1,108 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents an ip entity. + /// + [Newtonsoft.Json.JsonObject("Ip")] + [Rest.Serialization.JsonTransformation] + public partial class IpEntity : Entity + { + /// + /// Initializes a new instance of the IpEntity class. + /// + public IpEntity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IpEntity class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// A bag of custom fields that should be + /// part of the entity and will be presented to the user. + /// The graph item display name which is a + /// short humanly readable description of the graph item instance. This + /// property is optional and might be system generated. + /// The IP address as string, e.g. 127.0.0.1 + /// (either in Ipv4 or Ipv6) + /// The geo-location context attached to the ip + /// entity + /// A list of TI contexts attached to + /// the ip entity. + public IpEntity(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary additionalData = default(IDictionary), string friendlyName = default(string), string address = default(string), GeoLocation location = default(GeoLocation), IList threatIntelligence = default(IList)) + : base(id, name, type, systemData) + { + AdditionalData = additionalData; + FriendlyName = friendlyName; + Address = address; + Location = location; + ThreatIntelligence = threatIntelligence; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a bag of custom fields that should be part of the entity and + /// will be presented to the user. + /// + [JsonProperty(PropertyName = "properties.additionalData")] + public IDictionary AdditionalData { get; private set; } + + /// + /// Gets the graph item display name which is a short humanly readable + /// description of the graph item instance. This property is optional + /// and might be system generated. + /// + [JsonProperty(PropertyName = "properties.friendlyName")] + public string FriendlyName { get; private set; } + + /// + /// Gets the IP address as string, e.g. 127.0.0.1 (either in Ipv4 or + /// Ipv6) + /// + [JsonProperty(PropertyName = "properties.address")] + public string Address { get; private set; } + + /// + /// Gets or sets the geo-location context attached to the ip entity + /// + [JsonProperty(PropertyName = "properties.location")] + public GeoLocation Location { get; set; } + + /// + /// Gets a list of TI contexts attached to the ip entity. + /// + [JsonProperty(PropertyName = "properties.threatIntelligence")] + public IList ThreatIntelligence { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/KillChainIntent.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/KillChainIntent.cs new file mode 100644 index 0000000000000..8fe2ba76d4313 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/KillChainIntent.cs @@ -0,0 +1,136 @@ +// +// 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.Models +{ + + /// + /// Defines values for KillChainIntent. + /// + public static class KillChainIntent + { + /// + /// The default value. + /// + public const string Unknown = "Unknown"; + /// + /// Probing could be an attempt to access a certain resource regardless + /// of a malicious intent or a failed attempt to gain access to a + /// target system to gather information prior to exploitation. This + /// step is usually detected as an attempt originating from outside the + /// network in attempt to scan the target system and find a way in. + /// + public const string Probing = "Probing"; + /// + /// Exploitation is the stage where an attacker manage to get foothold + /// on the attacked resource. This stage is applicable not only for + /// compute hosts, but also for resources such as user accounts, + /// certificates etc. Adversaries will often be able to control the + /// resource after this stage. + /// + public const string Exploitation = "Exploitation"; + /// + /// Persistence is any access, action, or configuration change to a + /// system that gives an adversary a persistent presence on that + /// system. Adversaries will often need to maintain access to systems + /// through interruptions such as system restarts, loss of credentials, + /// or other failures that would require a remote access tool to + /// restart or alternate backdoor for them to regain access. + /// + public const string Persistence = "Persistence"; + /// + /// Privilege escalation is the result of actions that allow an + /// adversary to obtain a higher level of permissions on a system or + /// network. Certain tools or actions require a higher level of + /// privilege to work and are likely necessary at many points + /// throughout an operation. User accounts with permissions to access + /// specific systems or perform specific functions necessary for + /// adversaries to achieve their objective may also be considered an + /// escalation of privilege. + /// + public const string PrivilegeEscalation = "PrivilegeEscalation"; + /// + /// Defense evasion consists of techniques an adversary may use to + /// evade detection or avoid other defenses. Sometimes these actions + /// are the same as or variations of techniques in other categories + /// that have the added benefit of subverting a particular defense or + /// mitigation. + /// + public const string DefenseEvasion = "DefenseEvasion"; + /// + /// Credential access represents techniques resulting in access to or + /// control over system, domain, or service credentials that are used + /// within an enterprise environment. Adversaries will likely attempt + /// to obtain legitimate credentials from users or administrator + /// accounts (local system administrator or domain users with + /// administrator access) to use within the network. With sufficient + /// access within a network, an adversary can create accounts for later + /// use within the environment. + /// + public const string CredentialAccess = "CredentialAccess"; + /// + /// Discovery consists of techniques that allow the adversary to gain + /// knowledge about the system and internal network. When adversaries + /// gain access to a new system, they must orient themselves to what + /// they now have control of and what benefits operating from that + /// system give to their current objective or overall goals during the + /// intrusion. The operating system provides many native tools that aid + /// in this post-compromise information-gathering phase. + /// + public const string Discovery = "Discovery"; + /// + /// Lateral movement consists of techniques that enable an adversary to + /// access and control remote systems on a network and could, but does + /// not necessarily, include execution of tools on remote systems. The + /// lateral movement techniques could allow an adversary to gather + /// information from a system without needing additional tools, such as + /// a remote access tool. An adversary can use lateral movement for + /// many purposes, including remote Execution of tools, pivoting to + /// additional systems, access to specific information or files, access + /// to additional credentials, or to cause an effect. + /// + public const string LateralMovement = "LateralMovement"; + /// + /// The execution tactic represents techniques that result in execution + /// of adversary-controlled code on a local or remote system. This + /// tactic is often used in conjunction with lateral movement to expand + /// access to remote systems on a network. + /// + public const string Execution = "Execution"; + /// + /// Collection consists of techniques used to identify and gather + /// information, such as sensitive files, from a target network prior + /// to exfiltration. This category also covers locations on a system or + /// network where the adversary may look for information to exfiltrate. + /// + public const string Collection = "Collection"; + /// + /// Exfiltration refers to techniques and attributes that result or aid + /// in the adversary removing files and information from a target + /// network. This category also covers locations on a system or network + /// where the adversary may look for information to exfiltrate. + /// + public const string Exfiltration = "Exfiltration"; + /// + /// The command and control tactic represents how adversaries + /// communicate with systems under their control within a target + /// network. + /// + public const string CommandAndControl = "CommandAndControl"; + /// + /// The impact intent primary objective is to directly reduce the + /// availability or integrity of a system, service, or network; + /// including manipulation of data to impact a business or operational + /// process. This would often refer to techniques such as ransom-ware, + /// defacement, data manipulation and others. + /// + public const string Impact = "Impact"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Kind.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Kind.cs new file mode 100644 index 0000000000000..40245664f69f4 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Kind.cs @@ -0,0 +1,34 @@ +// +// 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.Models +{ + + /// + /// Defines values for Kind. + /// + public static class Kind + { + public const string DataConnector = "DataConnector"; + public const string DataType = "DataType"; + public const string Workbook = "Workbook"; + public const string WorkbookTemplate = "WorkbookTemplate"; + public const string Playbook = "Playbook"; + public const string PlaybookTemplate = "PlaybookTemplate"; + public const string AnalyticsRuleTemplate = "AnalyticsRuleTemplate"; + public const string AnalyticsRule = "AnalyticsRule"; + public const string HuntingQuery = "HuntingQuery"; + public const string InvestigationQuery = "InvestigationQuery"; + public const string Parser = "Parser"; + public const string Watchlist = "Watchlist"; + public const string WatchlistTemplate = "WatchlistTemplate"; + public const string Solution = "Solution"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/LastDataReceivedDataType.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/LastDataReceivedDataType.cs new file mode 100644 index 0000000000000..82a21d26c8329 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/LastDataReceivedDataType.cs @@ -0,0 +1,62 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Data type for last data received + /// + public partial class LastDataReceivedDataType + { + /// + /// Initializes a new instance of the LastDataReceivedDataType class. + /// + public LastDataReceivedDataType() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LastDataReceivedDataType class. + /// + /// Name of the data type to show in the graph. can + /// be use with {{graphQueriesTableName}} placeholder + /// Query for indicate last data + /// received + public LastDataReceivedDataType(string name = default(string), string lastDataReceivedQuery = default(string)) + { + Name = name; + LastDataReceivedQuery = lastDataReceivedQuery; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of the data type to show in the graph. can be use + /// with {{graphQueriesTableName}} placeholder + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets query for indicate last data received + /// + [JsonProperty(PropertyName = "lastDataReceivedQuery")] + public string LastDataReceivedQuery { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MCASCheckRequirements.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MCASCheckRequirements.cs new file mode 100644 index 0000000000000..2141fe88c009a --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MCASCheckRequirements.cs @@ -0,0 +1,70 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents MCAS (Microsoft Cloud App Security) requirements check + /// request. + /// + [Newtonsoft.Json.JsonObject("MicrosoftCloudAppSecurity")] + [Rest.Serialization.JsonTransformation] + public partial class MCASCheckRequirements : DataConnectorsCheckRequirements + { + /// + /// Initializes a new instance of the MCASCheckRequirements class. + /// + public MCASCheckRequirements() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MCASCheckRequirements class. + /// + /// The tenant id to connect to, and get the + /// data from. + public MCASCheckRequirements(string tenantId) + { + TenantId = tenantId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the tenant id to connect to, and get the data from. + /// + [JsonProperty(PropertyName = "properties.tenantId")] + public string TenantId { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (TenantId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TenantId"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MCASDataConnector.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MCASDataConnector.cs index 77df2ea8a0738..75978d4c8e427 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MCASDataConnector.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MCASDataConnector.cs @@ -33,16 +33,21 @@ public MCASDataConnector() /// /// Initializes a new instance of the MCASDataConnector class. /// - /// Azure resource Id - /// Azure resource name - /// Azure resource type - /// Etag of the azure resource /// The tenant id to connect to, and get the /// data from. /// The available data types for the /// connector. - public MCASDataConnector(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), string tenantId = default(string), MCASDataConnectorDataTypes dataTypes = default(MCASDataConnectorDataTypes)) - : base(id, name, type, etag) + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Etag of the azure resource + public MCASDataConnector(string tenantId, MCASDataConnectorDataTypes dataTypes, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string)) + : base(id, name, type, systemData, etag) { TenantId = tenantId; DataTypes = dataTypes; @@ -66,5 +71,26 @@ public MCASDataConnector() [JsonProperty(PropertyName = "properties.dataTypes")] public MCASDataConnectorDataTypes DataTypes { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (TenantId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TenantId"); + } + if (DataTypes == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DataTypes"); + } + if (DataTypes != null) + { + DataTypes.Validate(); + } + } } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MCASDataConnectorDataTypes.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MCASDataConnectorDataTypes.cs index 0c04dc116f3e1..9e34dbe52654e 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MCASDataConnectorDataTypes.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MCASDataConnectorDataTypes.cs @@ -33,7 +33,7 @@ public MCASDataConnectorDataTypes() /// Alerts data type connection. /// Discovery log data type /// connection. - public MCASDataConnectorDataTypes(DataConnectorDataTypeCommon alerts = default(DataConnectorDataTypeCommon), DataConnectorDataTypeCommon discoveryLogs = default(DataConnectorDataTypeCommon)) + public MCASDataConnectorDataTypes(DataConnectorDataTypeCommon alerts, DataConnectorDataTypeCommon discoveryLogs = default(DataConnectorDataTypeCommon)) : base(alerts) { DiscoveryLogs = discoveryLogs; @@ -51,5 +51,19 @@ public MCASDataConnectorDataTypes() [JsonProperty(PropertyName = "discoveryLogs")] public DataConnectorDataTypeCommon DiscoveryLogs { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (DiscoveryLogs != null) + { + DiscoveryLogs.Validate(); + } + } } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MDATPCheckRequirements.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MDATPCheckRequirements.cs new file mode 100644 index 0000000000000..8bf39c59133e8 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MDATPCheckRequirements.cs @@ -0,0 +1,70 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents MDATP (Microsoft Defender Advanced Threat Protection) + /// requirements check request. + /// + [Newtonsoft.Json.JsonObject("MicrosoftDefenderAdvancedThreatProtection")] + [Rest.Serialization.JsonTransformation] + public partial class MDATPCheckRequirements : DataConnectorsCheckRequirements + { + /// + /// Initializes a new instance of the MDATPCheckRequirements class. + /// + public MDATPCheckRequirements() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MDATPCheckRequirements class. + /// + /// The tenant id to connect to, and get the + /// data from. + public MDATPCheckRequirements(string tenantId) + { + TenantId = tenantId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the tenant id to connect to, and get the data from. + /// + [JsonProperty(PropertyName = "properties.tenantId")] + public string TenantId { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (TenantId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TenantId"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MDATPDataConnector.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MDATPDataConnector.cs index 5cbec5f4150b6..cfeaedadc5dd5 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MDATPDataConnector.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MDATPDataConnector.cs @@ -34,16 +34,21 @@ public MDATPDataConnector() /// /// Initializes a new instance of the MDATPDataConnector class. /// - /// Azure resource Id - /// Azure resource name - /// Azure resource type - /// Etag of the azure resource /// The tenant id to connect to, and get the /// data from. + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Etag of the azure resource /// The available data types for the /// connector. - public MDATPDataConnector(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), string tenantId = default(string), AlertsDataTypeOfDataConnector dataTypes = default(AlertsDataTypeOfDataConnector)) - : base(id, name, type, etag) + public MDATPDataConnector(string tenantId, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string), AlertsDataTypeOfDataConnector dataTypes = default(AlertsDataTypeOfDataConnector)) + : base(id, name, type, systemData, etag) { TenantId = tenantId; DataTypes = dataTypes; @@ -67,5 +72,22 @@ public MDATPDataConnector() [JsonProperty(PropertyName = "properties.dataTypes")] public AlertsDataTypeOfDataConnector DataTypes { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (TenantId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TenantId"); + } + if (DataTypes != null) + { + DataTypes.Validate(); + } + } } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MLBehaviorAnalyticsAlertRule.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MLBehaviorAnalyticsAlertRule.cs new file mode 100644 index 0000000000000..f4ab67d2d5a07 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MLBehaviorAnalyticsAlertRule.cs @@ -0,0 +1,140 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents MLBehaviorAnalytics alert rule. + /// + [Newtonsoft.Json.JsonObject("MLBehaviorAnalytics")] + [Rest.Serialization.JsonTransformation] + public partial class MLBehaviorAnalyticsAlertRule : AlertRule + { + /// + /// Initializes a new instance of the MLBehaviorAnalyticsAlertRule + /// class. + /// + public MLBehaviorAnalyticsAlertRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MLBehaviorAnalyticsAlertRule + /// class. + /// + /// The Name of the alert rule + /// template used to create this rule. + /// Determines whether this alert rule is enabled + /// or disabled. + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Etag of the azure resource + /// The description of the alert + /// rule. + /// The display name for alerts created by + /// this alert rule. + /// The last time that this alert rule + /// has been modified. + /// The severity for alerts created by this + /// alert rule. Possible values include: 'High', 'Medium', 'Low', + /// 'Informational' + /// The tactics of the alert rule + public MLBehaviorAnalyticsAlertRule(string alertRuleTemplateName, bool enabled, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string), string description = default(string), string displayName = default(string), System.DateTime? lastModifiedUtc = default(System.DateTime?), string severity = default(string), IList tactics = default(IList)) + : base(id, name, type, systemData, etag) + { + AlertRuleTemplateName = alertRuleTemplateName; + Description = description; + DisplayName = displayName; + Enabled = enabled; + LastModifiedUtc = lastModifiedUtc; + Severity = severity; + Tactics = tactics; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Name of the alert rule template used to create + /// this rule. + /// + [JsonProperty(PropertyName = "properties.alertRuleTemplateName")] + public string AlertRuleTemplateName { get; set; } + + /// + /// Gets the description of the alert rule. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; private set; } + + /// + /// Gets the display name for alerts created by this alert rule. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; private set; } + + /// + /// Gets or sets determines whether this alert rule is enabled or + /// disabled. + /// + [JsonProperty(PropertyName = "properties.enabled")] + public bool Enabled { get; set; } + + /// + /// Gets the last time that this alert rule has been modified. + /// + [JsonProperty(PropertyName = "properties.lastModifiedUtc")] + public System.DateTime? LastModifiedUtc { get; private set; } + + /// + /// Gets the severity for alerts created by this alert rule. Possible + /// values include: 'High', 'Medium', 'Low', 'Informational' + /// + [JsonProperty(PropertyName = "properties.severity")] + public string Severity { get; private set; } + + /// + /// Gets the tactics of the alert rule + /// + [JsonProperty(PropertyName = "properties.tactics")] + public IList Tactics { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (AlertRuleTemplateName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AlertRuleTemplateName"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MLBehaviorAnalyticsAlertRuleTemplate.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MLBehaviorAnalyticsAlertRuleTemplate.cs new file mode 100644 index 0000000000000..4b9b054cff4b3 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MLBehaviorAnalyticsAlertRuleTemplate.cs @@ -0,0 +1,158 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents MLBehaviorAnalytics alert rule template. + /// + [Newtonsoft.Json.JsonObject("MLBehaviorAnalytics")] + [Rest.Serialization.JsonTransformation] + public partial class MLBehaviorAnalyticsAlertRuleTemplate : AlertRuleTemplate + { + /// + /// Initializes a new instance of the + /// MLBehaviorAnalyticsAlertRuleTemplate class. + /// + public MLBehaviorAnalyticsAlertRuleTemplate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// MLBehaviorAnalyticsAlertRuleTemplate class. + /// + /// The severity for alerts created by this + /// alert rule. Possible values include: 'High', 'Medium', 'Low', + /// 'Informational' + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// the number of alert + /// rules that were created by this template + /// The last time that this alert rule + /// template has been updated. + /// The time that this alert rule template + /// has been added. + /// The description of the alert rule + /// template. + /// The display name for alert rule + /// template. + /// The required data sources for + /// this template + /// The alert rule template status. Possible + /// values include: 'Installed', 'Available', 'NotAvailable' + /// The tactics of the alert rule + /// template. + public MLBehaviorAnalyticsAlertRuleTemplate(string severity, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), int? alertRulesCreatedByTemplateCount = default(int?), System.DateTime? lastUpdatedDateUTC = default(System.DateTime?), System.DateTime? createdDateUTC = default(System.DateTime?), string description = default(string), string displayName = default(string), IList requiredDataConnectors = default(IList), string status = default(string), IList tactics = default(IList)) + : base(id, name, type, systemData) + { + AlertRulesCreatedByTemplateCount = alertRulesCreatedByTemplateCount; + LastUpdatedDateUTC = lastUpdatedDateUTC; + CreatedDateUTC = createdDateUTC; + Description = description; + DisplayName = displayName; + RequiredDataConnectors = requiredDataConnectors; + Status = status; + Severity = severity; + Tactics = tactics; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the number of alert rules that were created by this + /// template + /// + [JsonProperty(PropertyName = "properties.alertRulesCreatedByTemplateCount")] + public int? AlertRulesCreatedByTemplateCount { get; set; } + + /// + /// Gets the last time that this alert rule template has been updated. + /// + [JsonProperty(PropertyName = "properties.lastUpdatedDateUTC")] + public System.DateTime? LastUpdatedDateUTC { get; private set; } + + /// + /// Gets the time that this alert rule template has been added. + /// + [JsonProperty(PropertyName = "properties.createdDateUTC")] + public System.DateTime? CreatedDateUTC { get; private set; } + + /// + /// Gets or sets the description of the alert rule template. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the display name for alert rule template. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets the required data sources for this template + /// + [JsonProperty(PropertyName = "properties.requiredDataConnectors")] + public IList RequiredDataConnectors { get; set; } + + /// + /// Gets or sets the alert rule template status. Possible values + /// include: 'Installed', 'Available', 'NotAvailable' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; set; } + + /// + /// Gets or sets the severity for alerts created by this alert rule. + /// Possible values include: 'High', 'Medium', 'Low', 'Informational' + /// + [JsonProperty(PropertyName = "properties.severity")] + public string Severity { get; set; } + + /// + /// Gets or sets the tactics of the alert rule template. + /// + [JsonProperty(PropertyName = "properties.tactics")] + public IList Tactics { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Severity == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Severity"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MSTICheckRequirements.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MSTICheckRequirements.cs new file mode 100644 index 0000000000000..e5c2176c2f643 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MSTICheckRequirements.cs @@ -0,0 +1,69 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents Microsoft Threat Intelligence requirements check request. + /// + [Newtonsoft.Json.JsonObject("MicrosoftThreatIntelligence")] + [Rest.Serialization.JsonTransformation] + public partial class MSTICheckRequirements : DataConnectorsCheckRequirements + { + /// + /// Initializes a new instance of the MSTICheckRequirements class. + /// + public MSTICheckRequirements() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MSTICheckRequirements class. + /// + /// The tenant id to connect to, and get the + /// data from. + public MSTICheckRequirements(string tenantId) + { + TenantId = tenantId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the tenant id to connect to, and get the data from. + /// + [JsonProperty(PropertyName = "properties.tenantId")] + public string TenantId { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (TenantId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TenantId"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MSTIDataConnector.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MSTIDataConnector.cs new file mode 100644 index 0000000000000..e1cb6bdd36252 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MSTIDataConnector.cs @@ -0,0 +1,96 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents Microsoft Threat Intelligence data connector. + /// + [Newtonsoft.Json.JsonObject("MicrosoftThreatIntelligence")] + [Rest.Serialization.JsonTransformation] + public partial class MSTIDataConnector : DataConnector + { + /// + /// Initializes a new instance of the MSTIDataConnector class. + /// + public MSTIDataConnector() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MSTIDataConnector class. + /// + /// The tenant id to connect to, and get the + /// data from. + /// The available data types for the + /// connector. + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Etag of the azure resource + public MSTIDataConnector(string tenantId, MSTIDataConnectorDataTypes dataTypes, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string)) + : base(id, name, type, systemData, etag) + { + TenantId = tenantId; + DataTypes = dataTypes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the tenant id to connect to, and get the data from. + /// + [JsonProperty(PropertyName = "properties.tenantId")] + public string TenantId { get; set; } + + /// + /// Gets or sets the available data types for the connector. + /// + [JsonProperty(PropertyName = "properties.dataTypes")] + public MSTIDataConnectorDataTypes DataTypes { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (TenantId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TenantId"); + } + if (DataTypes == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DataTypes"); + } + if (DataTypes != null) + { + DataTypes.Validate(); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MSTIDataConnectorDataTypes.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MSTIDataConnectorDataTypes.cs new file mode 100644 index 0000000000000..3cf83d17cd1de --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MSTIDataConnectorDataTypes.cs @@ -0,0 +1,90 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The available data types for Microsoft Threat Intelligence Platforms + /// data connector. + /// + public partial class MSTIDataConnectorDataTypes + { + /// + /// Initializes a new instance of the MSTIDataConnectorDataTypes class. + /// + public MSTIDataConnectorDataTypes() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MSTIDataConnectorDataTypes class. + /// + /// Data type for Microsoft Threat + /// Intelligence Platforms data connector. + /// Data type for Microsoft + /// Threat Intelligence Platforms data connector. + public MSTIDataConnectorDataTypes(MSTIDataConnectorDataTypesBingSafetyPhishingURL bingSafetyPhishingURL, MSTIDataConnectorDataTypesMicrosoftEmergingThreatFeed microsoftEmergingThreatFeed) + { + BingSafetyPhishingURL = bingSafetyPhishingURL; + MicrosoftEmergingThreatFeed = microsoftEmergingThreatFeed; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets data type for Microsoft Threat Intelligence Platforms + /// data connector. + /// + [JsonProperty(PropertyName = "bingSafetyPhishingURL")] + public MSTIDataConnectorDataTypesBingSafetyPhishingURL BingSafetyPhishingURL { get; set; } + + /// + /// Gets or sets data type for Microsoft Threat Intelligence Platforms + /// data connector. + /// + [JsonProperty(PropertyName = "microsoftEmergingThreatFeed")] + public MSTIDataConnectorDataTypesMicrosoftEmergingThreatFeed MicrosoftEmergingThreatFeed { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (BingSafetyPhishingURL == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "BingSafetyPhishingURL"); + } + if (MicrosoftEmergingThreatFeed == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "MicrosoftEmergingThreatFeed"); + } + if (BingSafetyPhishingURL != null) + { + BingSafetyPhishingURL.Validate(); + } + if (MicrosoftEmergingThreatFeed != null) + { + MicrosoftEmergingThreatFeed.Validate(); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MSTIDataConnectorDataTypesBingSafetyPhishingURL.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MSTIDataConnectorDataTypesBingSafetyPhishingURL.cs new file mode 100644 index 0000000000000..2677ca78ee994 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MSTIDataConnectorDataTypesBingSafetyPhishingURL.cs @@ -0,0 +1,72 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Data type for Microsoft Threat Intelligence Platforms data connector. + /// + public partial class MSTIDataConnectorDataTypesBingSafetyPhishingURL : DataConnectorDataTypeCommon + { + /// + /// Initializes a new instance of the + /// MSTIDataConnectorDataTypesBingSafetyPhishingURL class. + /// + public MSTIDataConnectorDataTypesBingSafetyPhishingURL() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// MSTIDataConnectorDataTypesBingSafetyPhishingURL class. + /// + /// Describe whether this data type connection is + /// enabled or not. Possible values include: 'Enabled', + /// 'Disabled' + /// lookback period + public MSTIDataConnectorDataTypesBingSafetyPhishingURL(string state, string lookbackPeriod) + : base(state) + { + LookbackPeriod = lookbackPeriod; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets lookback period + /// + [JsonProperty(PropertyName = "lookbackPeriod")] + public string LookbackPeriod { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (LookbackPeriod == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "LookbackPeriod"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MSTIDataConnectorDataTypesMicrosoftEmergingThreatFeed.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MSTIDataConnectorDataTypesMicrosoftEmergingThreatFeed.cs new file mode 100644 index 0000000000000..def7500ee9385 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MSTIDataConnectorDataTypesMicrosoftEmergingThreatFeed.cs @@ -0,0 +1,72 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Data type for Microsoft Threat Intelligence Platforms data connector. + /// + public partial class MSTIDataConnectorDataTypesMicrosoftEmergingThreatFeed : DataConnectorDataTypeCommon + { + /// + /// Initializes a new instance of the + /// MSTIDataConnectorDataTypesMicrosoftEmergingThreatFeed class. + /// + public MSTIDataConnectorDataTypesMicrosoftEmergingThreatFeed() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// MSTIDataConnectorDataTypesMicrosoftEmergingThreatFeed class. + /// + /// Describe whether this data type connection is + /// enabled or not. Possible values include: 'Enabled', + /// 'Disabled' + /// lookback period + public MSTIDataConnectorDataTypesMicrosoftEmergingThreatFeed(string state, string lookbackPeriod) + : base(state) + { + LookbackPeriod = lookbackPeriod; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets lookback period + /// + [JsonProperty(PropertyName = "lookbackPeriod")] + public string LookbackPeriod { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (LookbackPeriod == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "LookbackPeriod"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MTPDataConnector.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MTPDataConnector.cs new file mode 100644 index 0000000000000..cdcc1410708f8 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MTPDataConnector.cs @@ -0,0 +1,96 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents MTP (Microsoft Threat Protection) data connector. + /// + [Newtonsoft.Json.JsonObject("MicrosoftThreatProtection")] + [Rest.Serialization.JsonTransformation] + public partial class MTPDataConnector : DataConnector + { + /// + /// Initializes a new instance of the MTPDataConnector class. + /// + public MTPDataConnector() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MTPDataConnector class. + /// + /// The tenant id to connect to, and get the + /// data from. + /// The available data types for the + /// connector. + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Etag of the azure resource + public MTPDataConnector(string tenantId, MTPDataConnectorDataTypes dataTypes, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string)) + : base(id, name, type, systemData, etag) + { + TenantId = tenantId; + DataTypes = dataTypes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the tenant id to connect to, and get the data from. + /// + [JsonProperty(PropertyName = "properties.tenantId")] + public string TenantId { get; set; } + + /// + /// Gets or sets the available data types for the connector. + /// + [JsonProperty(PropertyName = "properties.dataTypes")] + public MTPDataConnectorDataTypes DataTypes { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (TenantId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TenantId"); + } + if (DataTypes == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DataTypes"); + } + if (DataTypes != null) + { + DataTypes.Validate(); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MTPDataConnectorDataTypes.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MTPDataConnectorDataTypes.cs new file mode 100644 index 0000000000000..f915074d96ea5 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MTPDataConnectorDataTypes.cs @@ -0,0 +1,72 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The available data types for Microsoft Threat Protection Platforms data + /// connector. + /// + public partial class MTPDataConnectorDataTypes + { + /// + /// Initializes a new instance of the MTPDataConnectorDataTypes class. + /// + public MTPDataConnectorDataTypes() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MTPDataConnectorDataTypes class. + /// + /// Data type for Microsoft Threat Protection + /// Platforms data connector. + public MTPDataConnectorDataTypes(MTPDataConnectorDataTypesIncidents incidents) + { + Incidents = incidents; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets data type for Microsoft Threat Protection Platforms + /// data connector. + /// + [JsonProperty(PropertyName = "incidents")] + public MTPDataConnectorDataTypesIncidents Incidents { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Incidents == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Incidents"); + } + if (Incidents != null) + { + Incidents.Validate(); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MTPDataConnectorDataTypesIncidents.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MTPDataConnectorDataTypesIncidents.cs new file mode 100644 index 0000000000000..9f99cdec5bc43 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MTPDataConnectorDataTypesIncidents.cs @@ -0,0 +1,58 @@ +// +// 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.Models +{ + using System.Linq; + + /// + /// Data type for Microsoft Threat Protection Platforms data connector. + /// + public partial class MTPDataConnectorDataTypesIncidents : DataConnectorDataTypeCommon + { + /// + /// Initializes a new instance of the + /// MTPDataConnectorDataTypesIncidents class. + /// + public MTPDataConnectorDataTypesIncidents() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// MTPDataConnectorDataTypesIncidents class. + /// + /// Describe whether this data type connection is + /// enabled or not. Possible values include: 'Enabled', + /// 'Disabled' + public MTPDataConnectorDataTypesIncidents(string state) + : base(state) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MailClusterEntity.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MailClusterEntity.cs new file mode 100644 index 0000000000000..79d74752017a5 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MailClusterEntity.cs @@ -0,0 +1,215 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents a mail cluster entity. + /// + [Newtonsoft.Json.JsonObject("MailCluster")] + [Rest.Serialization.JsonTransformation] + public partial class MailClusterEntity : Entity + { + /// + /// Initializes a new instance of the MailClusterEntity class. + /// + public MailClusterEntity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MailClusterEntity class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// A bag of custom fields that should be + /// part of the entity and will be presented to the user. + /// The graph item display name which is a + /// short humanly readable description of the graph item instance. This + /// property is optional and might be system generated. + /// The mail message IDs that are part + /// of the mail cluster + /// Count of mail messages by + /// DeliveryStatus string representation + /// Count of mail messages by + /// ThreatType string representation + /// Count of mail messages by + /// ProtectionStatus string representation + /// The threats of mail messages that are part of + /// the mail cluster + /// The query that was used to identify the + /// messages of the mail cluster + /// The query time + /// The number of mail messages that are part + /// of the mail cluster + /// Is this a volume anomaly mail + /// cluster + /// The source of the mail cluster (default is + /// 'O365 ATP') + /// The id of the cluster + /// source + /// The type of the cluster + /// source + /// The cluster query start + /// time + /// The cluster query end + /// time + /// The cluster group + public MailClusterEntity(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary additionalData = default(IDictionary), string friendlyName = default(string), IList networkMessageIds = default(IList), object countByDeliveryStatus = default(object), object countByThreatType = default(object), object countByProtectionStatus = default(object), IList threats = default(IList), string query = default(string), System.DateTime? queryTime = default(System.DateTime?), int? mailCount = default(int?), bool? isVolumeAnomaly = default(bool?), string source = default(string), string clusterSourceIdentifier = default(string), string clusterSourceType = default(string), System.DateTime? clusterQueryStartTime = default(System.DateTime?), System.DateTime? clusterQueryEndTime = default(System.DateTime?), string clusterGroup = default(string)) + : base(id, name, type, systemData) + { + AdditionalData = additionalData; + FriendlyName = friendlyName; + NetworkMessageIds = networkMessageIds; + CountByDeliveryStatus = countByDeliveryStatus; + CountByThreatType = countByThreatType; + CountByProtectionStatus = countByProtectionStatus; + Threats = threats; + Query = query; + QueryTime = queryTime; + MailCount = mailCount; + IsVolumeAnomaly = isVolumeAnomaly; + Source = source; + ClusterSourceIdentifier = clusterSourceIdentifier; + ClusterSourceType = clusterSourceType; + ClusterQueryStartTime = clusterQueryStartTime; + ClusterQueryEndTime = clusterQueryEndTime; + ClusterGroup = clusterGroup; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a bag of custom fields that should be part of the entity and + /// will be presented to the user. + /// + [JsonProperty(PropertyName = "properties.additionalData")] + public IDictionary AdditionalData { get; private set; } + + /// + /// Gets the graph item display name which is a short humanly readable + /// description of the graph item instance. This property is optional + /// and might be system generated. + /// + [JsonProperty(PropertyName = "properties.friendlyName")] + public string FriendlyName { get; private set; } + + /// + /// Gets the mail message IDs that are part of the mail cluster + /// + [JsonProperty(PropertyName = "properties.networkMessageIds")] + public IList NetworkMessageIds { get; private set; } + + /// + /// Gets count of mail messages by DeliveryStatus string representation + /// + [JsonProperty(PropertyName = "properties.countByDeliveryStatus")] + public object CountByDeliveryStatus { get; private set; } + + /// + /// Gets count of mail messages by ThreatType string representation + /// + [JsonProperty(PropertyName = "properties.countByThreatType")] + public object CountByThreatType { get; private set; } + + /// + /// Gets count of mail messages by ProtectionStatus string + /// representation + /// + [JsonProperty(PropertyName = "properties.countByProtectionStatus")] + public object CountByProtectionStatus { get; private set; } + + /// + /// Gets the threats of mail messages that are part of the mail cluster + /// + [JsonProperty(PropertyName = "properties.threats")] + public IList Threats { get; private set; } + + /// + /// Gets the query that was used to identify the messages of the mail + /// cluster + /// + [JsonProperty(PropertyName = "properties.query")] + public string Query { get; private set; } + + /// + /// Gets the query time + /// + [JsonProperty(PropertyName = "properties.queryTime")] + public System.DateTime? QueryTime { get; private set; } + + /// + /// Gets the number of mail messages that are part of the mail cluster + /// + [JsonProperty(PropertyName = "properties.mailCount")] + public int? MailCount { get; private set; } + + /// + /// Gets is this a volume anomaly mail cluster + /// + [JsonProperty(PropertyName = "properties.isVolumeAnomaly")] + public bool? IsVolumeAnomaly { get; private set; } + + /// + /// Gets the source of the mail cluster (default is 'O365 ATP') + /// + [JsonProperty(PropertyName = "properties.source")] + public string Source { get; private set; } + + /// + /// Gets the id of the cluster source + /// + [JsonProperty(PropertyName = "properties.clusterSourceIdentifier")] + public string ClusterSourceIdentifier { get; private set; } + + /// + /// Gets the type of the cluster source + /// + [JsonProperty(PropertyName = "properties.clusterSourceType")] + public string ClusterSourceType { get; private set; } + + /// + /// Gets the cluster query start time + /// + [JsonProperty(PropertyName = "properties.clusterQueryStartTime")] + public System.DateTime? ClusterQueryStartTime { get; private set; } + + /// + /// Gets the cluster query end time + /// + [JsonProperty(PropertyName = "properties.clusterQueryEndTime")] + public System.DateTime? ClusterQueryEndTime { get; private set; } + + /// + /// Gets the cluster group + /// + [JsonProperty(PropertyName = "properties.clusterGroup")] + public string ClusterGroup { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MailMessageEntity.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MailMessageEntity.cs new file mode 100644 index 0000000000000..3ae71bd9ae363 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MailMessageEntity.cs @@ -0,0 +1,304 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents a mail message entity. + /// + [Newtonsoft.Json.JsonObject("MailMessage")] + [Rest.Serialization.JsonTransformation] + public partial class MailMessageEntity : Entity + { + /// + /// Initializes a new instance of the MailMessageEntity class. + /// + public MailMessageEntity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MailMessageEntity class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// A bag of custom fields that should be + /// part of the entity and will be presented to the user. + /// The graph item display name which is a + /// short humanly readable description of the graph item instance. This + /// property is optional and might be system generated. + /// The File entity ids of this mail + /// message's attachments + /// The recipient of this mail message. Note + /// that in case of multiple recipients the mail message is forked and + /// each copy has one recipient + /// The Urls contained in this mail message + /// The threats of this mail message + /// The p1 sender's email address + /// The p1 sender's display + /// name + /// The p1 sender's domain + /// The sender's IP address + /// The p2 sender's email address + /// The p2 sender's display + /// name + /// The p2 sender's domain + /// The receive date of this message + /// The network message id of this mail + /// message + /// The internet message id of this + /// mail message + /// The subject of this mail message + /// The language of this mail message + /// The threat detection + /// methods + /// The bodyFingerprintBin1 + /// The bodyFingerprintBin2 + /// The bodyFingerprintBin3 + /// The bodyFingerprintBin4 + /// The bodyFingerprintBin5 + /// The directionality of this mail + /// message. Possible values include: 'Unknown', 'Inbound', 'Outbound', + /// 'Intraorg' + /// The delivery action of this mail + /// message like Delivered, Blocked, Replaced etc. Possible values + /// include: 'Unknown', 'DeliveredAsSpam', 'Delivered', 'Blocked', + /// 'Replaced' + /// The delivery location of this mail + /// message like Inbox, JunkFolder etc. Possible values include: + /// 'Unknown', 'Inbox', 'JunkFolder', 'DeletedFolder', 'Quarantine', + /// 'External', 'Failed', 'Dropped', 'Forwarded' + public MailMessageEntity(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary additionalData = default(IDictionary), string friendlyName = default(string), IList fileEntityIds = default(IList), string recipient = default(string), IList urls = default(IList), IList threats = default(IList), string p1Sender = default(string), string p1SenderDisplayName = default(string), string p1SenderDomain = default(string), string senderIP = default(string), string p2Sender = default(string), string p2SenderDisplayName = default(string), string p2SenderDomain = default(string), System.DateTime? receiveDate = default(System.DateTime?), System.Guid? networkMessageId = default(System.Guid?), string internetMessageId = default(string), string subject = default(string), string language = default(string), IList threatDetectionMethods = default(IList), int? bodyFingerprintBin1 = default(int?), int? bodyFingerprintBin2 = default(int?), int? bodyFingerprintBin3 = default(int?), int? bodyFingerprintBin4 = default(int?), int? bodyFingerprintBin5 = default(int?), string antispamDirection = default(string), DeliveryAction? deliveryAction = default(DeliveryAction?), DeliveryLocation? deliveryLocation = default(DeliveryLocation?)) + : base(id, name, type, systemData) + { + AdditionalData = additionalData; + FriendlyName = friendlyName; + FileEntityIds = fileEntityIds; + Recipient = recipient; + Urls = urls; + Threats = threats; + P1Sender = p1Sender; + P1SenderDisplayName = p1SenderDisplayName; + P1SenderDomain = p1SenderDomain; + SenderIP = senderIP; + P2Sender = p2Sender; + P2SenderDisplayName = p2SenderDisplayName; + P2SenderDomain = p2SenderDomain; + ReceiveDate = receiveDate; + NetworkMessageId = networkMessageId; + InternetMessageId = internetMessageId; + Subject = subject; + Language = language; + ThreatDetectionMethods = threatDetectionMethods; + BodyFingerprintBin1 = bodyFingerprintBin1; + BodyFingerprintBin2 = bodyFingerprintBin2; + BodyFingerprintBin3 = bodyFingerprintBin3; + BodyFingerprintBin4 = bodyFingerprintBin4; + BodyFingerprintBin5 = bodyFingerprintBin5; + AntispamDirection = antispamDirection; + DeliveryAction = deliveryAction; + DeliveryLocation = deliveryLocation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a bag of custom fields that should be part of the entity and + /// will be presented to the user. + /// + [JsonProperty(PropertyName = "properties.additionalData")] + public IDictionary AdditionalData { get; private set; } + + /// + /// Gets the graph item display name which is a short humanly readable + /// description of the graph item instance. This property is optional + /// and might be system generated. + /// + [JsonProperty(PropertyName = "properties.friendlyName")] + public string FriendlyName { get; private set; } + + /// + /// Gets the File entity ids of this mail message's attachments + /// + [JsonProperty(PropertyName = "properties.fileEntityIds")] + public IList FileEntityIds { get; private set; } + + /// + /// Gets the recipient of this mail message. Note that in case of + /// multiple recipients the mail message is forked and each copy has + /// one recipient + /// + [JsonProperty(PropertyName = "properties.recipient")] + public string Recipient { get; private set; } + + /// + /// Gets the Urls contained in this mail message + /// + [JsonProperty(PropertyName = "properties.urls")] + public IList Urls { get; private set; } + + /// + /// Gets the threats of this mail message + /// + [JsonProperty(PropertyName = "properties.threats")] + public IList Threats { get; private set; } + + /// + /// Gets the p1 sender's email address + /// + [JsonProperty(PropertyName = "properties.p1Sender")] + public string P1Sender { get; private set; } + + /// + /// Gets the p1 sender's display name + /// + [JsonProperty(PropertyName = "properties.p1SenderDisplayName")] + public string P1SenderDisplayName { get; private set; } + + /// + /// Gets the p1 sender's domain + /// + [JsonProperty(PropertyName = "properties.p1SenderDomain")] + public string P1SenderDomain { get; private set; } + + /// + /// Gets the sender's IP address + /// + [JsonProperty(PropertyName = "properties.senderIP")] + public string SenderIP { get; private set; } + + /// + /// Gets the p2 sender's email address + /// + [JsonProperty(PropertyName = "properties.p2Sender")] + public string P2Sender { get; private set; } + + /// + /// Gets the p2 sender's display name + /// + [JsonProperty(PropertyName = "properties.p2SenderDisplayName")] + public string P2SenderDisplayName { get; private set; } + + /// + /// Gets the p2 sender's domain + /// + [JsonProperty(PropertyName = "properties.p2SenderDomain")] + public string P2SenderDomain { get; private set; } + + /// + /// Gets the receive date of this message + /// + [JsonProperty(PropertyName = "properties.receiveDate")] + public System.DateTime? ReceiveDate { get; private set; } + + /// + /// Gets the network message id of this mail message + /// + [JsonProperty(PropertyName = "properties.networkMessageId")] + public System.Guid? NetworkMessageId { get; private set; } + + /// + /// Gets the internet message id of this mail message + /// + [JsonProperty(PropertyName = "properties.internetMessageId")] + public string InternetMessageId { get; private set; } + + /// + /// Gets the subject of this mail message + /// + [JsonProperty(PropertyName = "properties.subject")] + public string Subject { get; private set; } + + /// + /// Gets the language of this mail message + /// + [JsonProperty(PropertyName = "properties.language")] + public string Language { get; private set; } + + /// + /// Gets the threat detection methods + /// + [JsonProperty(PropertyName = "properties.threatDetectionMethods")] + public IList ThreatDetectionMethods { get; private set; } + + /// + /// Gets or sets the bodyFingerprintBin1 + /// + [JsonProperty(PropertyName = "properties.bodyFingerprintBin1")] + public int? BodyFingerprintBin1 { get; set; } + + /// + /// Gets or sets the bodyFingerprintBin2 + /// + [JsonProperty(PropertyName = "properties.bodyFingerprintBin2")] + public int? BodyFingerprintBin2 { get; set; } + + /// + /// Gets or sets the bodyFingerprintBin3 + /// + [JsonProperty(PropertyName = "properties.bodyFingerprintBin3")] + public int? BodyFingerprintBin3 { get; set; } + + /// + /// Gets or sets the bodyFingerprintBin4 + /// + [JsonProperty(PropertyName = "properties.bodyFingerprintBin4")] + public int? BodyFingerprintBin4 { get; set; } + + /// + /// Gets or sets the bodyFingerprintBin5 + /// + [JsonProperty(PropertyName = "properties.bodyFingerprintBin5")] + public int? BodyFingerprintBin5 { get; set; } + + /// + /// Gets or sets the directionality of this mail message. Possible + /// values include: 'Unknown', 'Inbound', 'Outbound', 'Intraorg' + /// + [JsonProperty(PropertyName = "properties.antispamDirection")] + public string AntispamDirection { get; set; } + + /// + /// Gets or sets the delivery action of this mail message like + /// Delivered, Blocked, Replaced etc. Possible values include: + /// 'Unknown', 'DeliveredAsSpam', 'Delivered', 'Blocked', 'Replaced' + /// + [JsonProperty(PropertyName = "properties.deliveryAction")] + public DeliveryAction? DeliveryAction { get; set; } + + /// + /// Gets or sets the delivery location of this mail message like Inbox, + /// JunkFolder etc. Possible values include: 'Unknown', 'Inbox', + /// 'JunkFolder', 'DeletedFolder', 'Quarantine', 'External', 'Failed', + /// 'Dropped', 'Forwarded' + /// + [JsonProperty(PropertyName = "properties.deliveryLocation")] + public DeliveryLocation? DeliveryLocation { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MailboxEntity.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MailboxEntity.cs new file mode 100644 index 0000000000000..27f98521c87bb --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MailboxEntity.cs @@ -0,0 +1,117 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents a mailbox entity. + /// + [Newtonsoft.Json.JsonObject("Mailbox")] + [Rest.Serialization.JsonTransformation] + public partial class MailboxEntity : Entity + { + /// + /// Initializes a new instance of the MailboxEntity class. + /// + public MailboxEntity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MailboxEntity class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// A bag of custom fields that should be + /// part of the entity and will be presented to the user. + /// The graph item display name which is a + /// short humanly readable description of the graph item instance. This + /// property is optional and might be system generated. + /// The mailbox's primary + /// address + /// The mailbox's display name + /// The mailbox's UPN + /// The AzureAD identifier of + /// mailbox. Similar to AadUserId in account entity but this property + /// is specific to mailbox object on office side + public MailboxEntity(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary additionalData = default(IDictionary), string friendlyName = default(string), string mailboxPrimaryAddress = default(string), string displayName = default(string), string upn = default(string), System.Guid? externalDirectoryObjectId = default(System.Guid?)) + : base(id, name, type, systemData) + { + AdditionalData = additionalData; + FriendlyName = friendlyName; + MailboxPrimaryAddress = mailboxPrimaryAddress; + DisplayName = displayName; + Upn = upn; + ExternalDirectoryObjectId = externalDirectoryObjectId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a bag of custom fields that should be part of the entity and + /// will be presented to the user. + /// + [JsonProperty(PropertyName = "properties.additionalData")] + public IDictionary AdditionalData { get; private set; } + + /// + /// Gets the graph item display name which is a short humanly readable + /// description of the graph item instance. This property is optional + /// and might be system generated. + /// + [JsonProperty(PropertyName = "properties.friendlyName")] + public string FriendlyName { get; private set; } + + /// + /// Gets the mailbox's primary address + /// + [JsonProperty(PropertyName = "properties.mailboxPrimaryAddress")] + public string MailboxPrimaryAddress { get; private set; } + + /// + /// Gets the mailbox's display name + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; private set; } + + /// + /// Gets the mailbox's UPN + /// + [JsonProperty(PropertyName = "properties.upn")] + public string Upn { get; private set; } + + /// + /// Gets the AzureAD identifier of mailbox. Similar to AadUserId in + /// account entity but this property is specific to mailbox object on + /// office side + /// + [JsonProperty(PropertyName = "properties.externalDirectoryObjectId")] + public System.Guid? ExternalDirectoryObjectId { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MalwareEntity.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MalwareEntity.cs new file mode 100644 index 0000000000000..d0db206af2a2d --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MalwareEntity.cs @@ -0,0 +1,118 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents a malware entity. + /// + [Newtonsoft.Json.JsonObject("Malware")] + [Rest.Serialization.JsonTransformation] + public partial class MalwareEntity : Entity + { + /// + /// Initializes a new instance of the MalwareEntity class. + /// + public MalwareEntity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MalwareEntity class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// A bag of custom fields that should be + /// part of the entity and will be presented to the user. + /// The graph item display name which is a + /// short humanly readable description of the graph item instance. This + /// property is optional and might be system generated. + /// The malware category by the vendor, e.g. + /// Trojan + /// List of linked file entity identifiers + /// on which the malware was found + /// The malware name by the vendor, e.g. + /// Win32/Toga!rfn + /// List of linked process entity + /// identifiers on which the malware was found. + public MalwareEntity(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary additionalData = default(IDictionary), string friendlyName = default(string), string category = default(string), IList fileEntityIds = default(IList), string malwareName = default(string), IList processEntityIds = default(IList)) + : base(id, name, type, systemData) + { + AdditionalData = additionalData; + FriendlyName = friendlyName; + Category = category; + FileEntityIds = fileEntityIds; + MalwareName = malwareName; + ProcessEntityIds = processEntityIds; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a bag of custom fields that should be part of the entity and + /// will be presented to the user. + /// + [JsonProperty(PropertyName = "properties.additionalData")] + public IDictionary AdditionalData { get; private set; } + + /// + /// Gets the graph item display name which is a short humanly readable + /// description of the graph item instance. This property is optional + /// and might be system generated. + /// + [JsonProperty(PropertyName = "properties.friendlyName")] + public string FriendlyName { get; private set; } + + /// + /// Gets the malware category by the vendor, e.g. Trojan + /// + [JsonProperty(PropertyName = "properties.category")] + public string Category { get; private set; } + + /// + /// Gets list of linked file entity identifiers on which the malware + /// was found + /// + [JsonProperty(PropertyName = "properties.fileEntityIds")] + public IList FileEntityIds { get; private set; } + + /// + /// Gets the malware name by the vendor, e.g. Win32/Toga!rfn + /// + [JsonProperty(PropertyName = "properties.malwareName")] + public string MalwareName { get; private set; } + + /// + /// Gets list of linked process entity identifiers on which the malware + /// was found. + /// + [JsonProperty(PropertyName = "properties.processEntityIds")] + public IList ProcessEntityIds { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MatchingMethod.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MatchingMethod.cs new file mode 100644 index 0000000000000..009decedc79f1 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MatchingMethod.cs @@ -0,0 +1,33 @@ +// +// 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.Models +{ + + /// + /// Defines values for MatchingMethod. + /// + public static class MatchingMethod + { + /// + /// Grouping alerts into a single incident if all the entities match + /// + public const string AllEntities = "AllEntities"; + /// + /// Grouping any alerts triggered by this rule into a single incident + /// + public const string AnyAlert = "AnyAlert"; + /// + /// Grouping alerts into a single incident if the selected entities, + /// custom details and alert details match + /// + public const string Selected = "Selected"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MetadataAuthor.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MetadataAuthor.cs new file mode 100644 index 0000000000000..935c27b32e804 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MetadataAuthor.cs @@ -0,0 +1,67 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Publisher or creator of the content item. + /// + public partial class MetadataAuthor + { + /// + /// Initializes a new instance of the MetadataAuthor class. + /// + public MetadataAuthor() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetadataAuthor class. + /// + /// Name of the author. Company or person. + /// Email of author contact + /// Link for author/vendor page + public MetadataAuthor(string name = default(string), string email = default(string), string link = default(string)) + { + Name = name; + Email = email; + Link = link; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of the author. Company or person. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets email of author contact + /// + [JsonProperty(PropertyName = "email")] + public string Email { get; set; } + + /// + /// Gets or sets link for author/vendor page + /// + [JsonProperty(PropertyName = "link")] + public string Link { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MetadataCategories.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MetadataCategories.cs new file mode 100644 index 0000000000000..81c2220f2e669 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MetadataCategories.cs @@ -0,0 +1,62 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// ies for the solution content item + /// + public partial class MetadataCategories + { + /// + /// Initializes a new instance of the MetadataCategories class. + /// + public MetadataCategories() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetadataCategories class. + /// + /// domain for the solution content item + /// Industry verticals for the solution content + /// item + public MetadataCategories(IList domains = default(IList), IList verticals = default(IList)) + { + Domains = domains; + Verticals = verticals; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets domain for the solution content item + /// + [JsonProperty(PropertyName = "domains")] + public IList Domains { get; set; } + + /// + /// Gets or sets industry verticals for the solution content item + /// + [JsonProperty(PropertyName = "verticals")] + public IList Verticals { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MetadataDependencies.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MetadataDependencies.cs new file mode 100644 index 0000000000000..6183f38a85245 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MetadataDependencies.cs @@ -0,0 +1,117 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Dependencies for the content item, what other content items it requires + /// to work. Can describe more complex dependencies using a + /// recursive/nested structure. For a single dependency an id/kind/version + /// can be supplied or operator/criteria for complex dependencies. + /// + public partial class MetadataDependencies + { + /// + /// Initializes a new instance of the MetadataDependencies class. + /// + public MetadataDependencies() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetadataDependencies class. + /// + /// Id of the content item we depend on + /// Type of the content item we depend on. Possible + /// values include: 'DataConnector', 'DataType', 'Workbook', + /// 'WorkbookTemplate', 'Playbook', 'PlaybookTemplate', + /// 'AnalyticsRuleTemplate', 'AnalyticsRule', 'HuntingQuery', + /// 'InvestigationQuery', 'Parser', 'Watchlist', 'WatchlistTemplate', + /// 'Solution' + /// Version of the the content item we depend on. + /// Can be blank, * or missing to indicate any version fulfills the + /// dependency. If version does not match our defined numeric format + /// then an exact match is required. + /// Name of the content item + /// Operator used for list of + /// dependencies in criteria array. Possible values include: 'AND', + /// 'OR' + /// This is the list of dependencies we must + /// fulfill, according to the AND/OR operator + public MetadataDependencies(string contentId = default(string), string kind = default(string), string version = default(string), string name = default(string), string operatorProperty = default(string), IList criteria = default(IList)) + { + ContentId = contentId; + Kind = kind; + Version = version; + Name = name; + OperatorProperty = operatorProperty; + Criteria = criteria; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets id of the content item we depend on + /// + [JsonProperty(PropertyName = "contentId")] + public string ContentId { get; set; } + + /// + /// Gets or sets type of the content item we depend on. Possible values + /// include: 'DataConnector', 'DataType', 'Workbook', + /// 'WorkbookTemplate', 'Playbook', 'PlaybookTemplate', + /// 'AnalyticsRuleTemplate', 'AnalyticsRule', 'HuntingQuery', + /// 'InvestigationQuery', 'Parser', 'Watchlist', 'WatchlistTemplate', + /// 'Solution' + /// + [JsonProperty(PropertyName = "kind")] + public string Kind { get; set; } + + /// + /// Gets or sets version of the the content item we depend on. Can be + /// blank, * or missing to indicate any version fulfills the + /// dependency. If version does not match our defined numeric format + /// then an exact match is required. + /// + [JsonProperty(PropertyName = "version")] + public string Version { get; set; } + + /// + /// Gets or sets name of the content item + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets operator used for list of dependencies in criteria + /// array. Possible values include: 'AND', 'OR' + /// + [JsonProperty(PropertyName = "operator")] + public string OperatorProperty { get; set; } + + /// + /// Gets or sets this is the list of dependencies we must fulfill, + /// according to the AND/OR operator + /// + [JsonProperty(PropertyName = "criteria")] + public IList Criteria { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MetadataModel.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MetadataModel.cs new file mode 100644 index 0000000000000..a9042e7f7bc2c --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MetadataModel.cs @@ -0,0 +1,223 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Metadata resource definition. + /// + [Rest.Serialization.JsonTransformation] + public partial class MetadataModel : ResourceWithEtag + { + /// + /// Initializes a new instance of the MetadataModel class. + /// + public MetadataModel() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetadataModel class. + /// + /// Full parent resource ID of the content item + /// the metadata is for. This is the full resource ID including the + /// scope (subscription and resource group) + /// The kind of content the metadata is for. + /// Possible values include: 'DataConnector', 'DataType', 'Workbook', + /// 'WorkbookTemplate', 'Playbook', 'PlaybookTemplate', + /// 'AnalyticsRuleTemplate', 'AnalyticsRule', 'HuntingQuery', + /// 'InvestigationQuery', 'Parser', 'Watchlist', 'WatchlistTemplate', + /// 'Solution' + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Etag of the azure resource + /// Static ID for the content. Used to + /// identify dependencies and content from solutions or community. + /// Hard-coded/static for out of the box content and solutions. Dynamic + /// for user-created. This is the resource name + /// Version of the content. Default and + /// recommended format is numeric (e.g. 1, 1.0, 1.0.0, 1.0.0.0), + /// following ARM template best practices. Can also be any string, but + /// then we cannot guarantee any version checks + /// Source of the content. This is where/how it + /// was created. + /// The creator of the content item. + /// Support information for the metadata - type, + /// name, contact information + /// Dependencies for the content item, what + /// other content items it requires to work. Can describe more complex + /// dependencies using a recursive/nested structure. For a single + /// dependency an id/kind/version can be supplied or operator/criteria + /// for complex formats. + /// Categories for the solution content + /// item + /// Providers for the solution content + /// item + /// first publish date solution content + /// item + /// last publish date for the solution + /// content item + public MetadataModel(string parentId, string kind, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string), string contentId = default(string), string version = default(string), MetadataSource source = default(MetadataSource), MetadataAuthor author = default(MetadataAuthor), MetadataSupport support = default(MetadataSupport), MetadataDependencies dependencies = default(MetadataDependencies), MetadataCategories categories = default(MetadataCategories), IList providers = default(IList), System.DateTime? firstPublishDate = default(System.DateTime?), System.DateTime? lastPublishDate = default(System.DateTime?)) + : base(id, name, type, systemData, etag) + { + ContentId = contentId; + ParentId = parentId; + Version = version; + Kind = kind; + Source = source; + Author = author; + Support = support; + Dependencies = dependencies; + Categories = categories; + Providers = providers; + FirstPublishDate = firstPublishDate; + LastPublishDate = lastPublishDate; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets static ID for the content. Used to identify + /// dependencies and content from solutions or community. + /// Hard-coded/static for out of the box content and solutions. Dynamic + /// for user-created. This is the resource name + /// + [JsonProperty(PropertyName = "properties.contentId")] + public string ContentId { get; set; } + + /// + /// Gets or sets full parent resource ID of the content item the + /// metadata is for. This is the full resource ID including the scope + /// (subscription and resource group) + /// + [JsonProperty(PropertyName = "properties.parentId")] + public string ParentId { get; set; } + + /// + /// Gets or sets version of the content. Default and recommended + /// format is numeric (e.g. 1, 1.0, 1.0.0, 1.0.0.0), following ARM + /// template best practices. Can also be any string, but then we + /// cannot guarantee any version checks + /// + [JsonProperty(PropertyName = "properties.version")] + public string Version { get; set; } + + /// + /// Gets or sets the kind of content the metadata is for. Possible + /// values include: 'DataConnector', 'DataType', 'Workbook', + /// 'WorkbookTemplate', 'Playbook', 'PlaybookTemplate', + /// 'AnalyticsRuleTemplate', 'AnalyticsRule', 'HuntingQuery', + /// 'InvestigationQuery', 'Parser', 'Watchlist', 'WatchlistTemplate', + /// 'Solution' + /// + [JsonProperty(PropertyName = "properties.kind")] + public string Kind { get; set; } + + /// + /// Gets or sets source of the content. This is where/how it was + /// created. + /// + [JsonProperty(PropertyName = "properties.source")] + public MetadataSource Source { get; set; } + + /// + /// Gets or sets the creator of the content item. + /// + [JsonProperty(PropertyName = "properties.author")] + public MetadataAuthor Author { get; set; } + + /// + /// Gets or sets support information for the metadata - type, name, + /// contact information + /// + [JsonProperty(PropertyName = "properties.support")] + public MetadataSupport Support { get; set; } + + /// + /// Gets or sets dependencies for the content item, what other content + /// items it requires to work. Can describe more complex dependencies + /// using a recursive/nested structure. For a single dependency an + /// id/kind/version can be supplied or operator/criteria for complex + /// formats. + /// + [JsonProperty(PropertyName = "properties.dependencies")] + public MetadataDependencies Dependencies { get; set; } + + /// + /// Gets or sets categories for the solution content item + /// + [JsonProperty(PropertyName = "properties.categories")] + public MetadataCategories Categories { get; set; } + + /// + /// Gets or sets providers for the solution content item + /// + [JsonProperty(PropertyName = "properties.providers")] + public IList Providers { get; set; } + + /// + /// Gets or sets first publish date solution content item + /// + [JsonConverter(typeof(DateJsonConverter))] + [JsonProperty(PropertyName = "properties.firstPublishDate")] + public System.DateTime? FirstPublishDate { get; set; } + + /// + /// Gets or sets last publish date for the solution content item + /// + [JsonConverter(typeof(DateJsonConverter))] + [JsonProperty(PropertyName = "properties.lastPublishDate")] + public System.DateTime? LastPublishDate { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ParentId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ParentId"); + } + if (Kind == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Kind"); + } + if (Source != null) + { + Source.Validate(); + } + if (Support != null) + { + Support.Validate(); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MetadataPatch.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MetadataPatch.cs new file mode 100644 index 0000000000000..adf330c9966a5 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MetadataPatch.cs @@ -0,0 +1,215 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Metadata patch request body. + /// + [Rest.Serialization.JsonTransformation] + public partial class MetadataPatch : ResourceWithEtag + { + /// + /// Initializes a new instance of the MetadataPatch class. + /// + public MetadataPatch() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetadataPatch class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Etag of the azure resource + /// Static ID for the content. Used to + /// identify dependencies and content from solutions or community. + /// Hard-coded/static for out of the box content and solutions. Dynamic + /// for user-created. This is the resource name + /// Full parent resource ID of the content item + /// the metadata is for. This is the full resource ID including the + /// scope (subscription and resource group) + /// Version of the content. Default and + /// recommended format is numeric (e.g. 1, 1.0, 1.0.0, 1.0.0.0), + /// following ARM template best practices. Can also be any string, but + /// then we cannot guarantee any version checks + /// The kind of content the metadata is for. + /// Possible values include: 'DataConnector', 'DataType', 'Workbook', + /// 'WorkbookTemplate', 'Playbook', 'PlaybookTemplate', + /// 'AnalyticsRuleTemplate', 'AnalyticsRule', 'HuntingQuery', + /// 'InvestigationQuery', 'Parser', 'Watchlist', 'WatchlistTemplate', + /// 'Solution' + /// Source of the content. This is where/how it + /// was created. + /// The creator of the content item. + /// Support information for the metadata - type, + /// name, contact information + /// Dependencies for the content item, what + /// other content items it requires to work. Can describe more complex + /// dependencies using a recursive/nested structure. For a single + /// dependency an id/kind/version can be supplied or operator/criteria + /// for complex formats. + /// Categories for the solution content + /// item + /// Providers for the solution content + /// item + /// first publish date solution content + /// item + /// last publish date for the solution + /// content item + public MetadataPatch(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string), string contentId = default(string), string parentId = default(string), string version = default(string), string kind = default(string), MetadataSource source = default(MetadataSource), MetadataAuthor author = default(MetadataAuthor), MetadataSupport support = default(MetadataSupport), MetadataDependencies dependencies = default(MetadataDependencies), MetadataCategories categories = default(MetadataCategories), IList providers = default(IList), System.DateTime? firstPublishDate = default(System.DateTime?), System.DateTime? lastPublishDate = default(System.DateTime?)) + : base(id, name, type, systemData, etag) + { + ContentId = contentId; + ParentId = parentId; + Version = version; + Kind = kind; + Source = source; + Author = author; + Support = support; + Dependencies = dependencies; + Categories = categories; + Providers = providers; + FirstPublishDate = firstPublishDate; + LastPublishDate = lastPublishDate; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets static ID for the content. Used to identify + /// dependencies and content from solutions or community. + /// Hard-coded/static for out of the box content and solutions. Dynamic + /// for user-created. This is the resource name + /// + [JsonProperty(PropertyName = "properties.contentId")] + public string ContentId { get; set; } + + /// + /// Gets or sets full parent resource ID of the content item the + /// metadata is for. This is the full resource ID including the scope + /// (subscription and resource group) + /// + [JsonProperty(PropertyName = "properties.parentId")] + public string ParentId { get; set; } + + /// + /// Gets or sets version of the content. Default and recommended + /// format is numeric (e.g. 1, 1.0, 1.0.0, 1.0.0.0), following ARM + /// template best practices. Can also be any string, but then we + /// cannot guarantee any version checks + /// + [JsonProperty(PropertyName = "properties.version")] + public string Version { get; set; } + + /// + /// Gets or sets the kind of content the metadata is for. Possible + /// values include: 'DataConnector', 'DataType', 'Workbook', + /// 'WorkbookTemplate', 'Playbook', 'PlaybookTemplate', + /// 'AnalyticsRuleTemplate', 'AnalyticsRule', 'HuntingQuery', + /// 'InvestigationQuery', 'Parser', 'Watchlist', 'WatchlistTemplate', + /// 'Solution' + /// + [JsonProperty(PropertyName = "properties.kind")] + public string Kind { get; set; } + + /// + /// Gets or sets source of the content. This is where/how it was + /// created. + /// + [JsonProperty(PropertyName = "properties.source")] + public MetadataSource Source { get; set; } + + /// + /// Gets or sets the creator of the content item. + /// + [JsonProperty(PropertyName = "properties.author")] + public MetadataAuthor Author { get; set; } + + /// + /// Gets or sets support information for the metadata - type, name, + /// contact information + /// + [JsonProperty(PropertyName = "properties.support")] + public MetadataSupport Support { get; set; } + + /// + /// Gets or sets dependencies for the content item, what other content + /// items it requires to work. Can describe more complex dependencies + /// using a recursive/nested structure. For a single dependency an + /// id/kind/version can be supplied or operator/criteria for complex + /// formats. + /// + [JsonProperty(PropertyName = "properties.dependencies")] + public MetadataDependencies Dependencies { get; set; } + + /// + /// Gets or sets categories for the solution content item + /// + [JsonProperty(PropertyName = "properties.categories")] + public MetadataCategories Categories { get; set; } + + /// + /// Gets or sets providers for the solution content item + /// + [JsonProperty(PropertyName = "properties.providers")] + public IList Providers { get; set; } + + /// + /// Gets or sets first publish date solution content item + /// + [JsonConverter(typeof(DateJsonConverter))] + [JsonProperty(PropertyName = "properties.firstPublishDate")] + public System.DateTime? FirstPublishDate { get; set; } + + /// + /// Gets or sets last publish date for the solution content item + /// + [JsonConverter(typeof(DateJsonConverter))] + [JsonProperty(PropertyName = "properties.lastPublishDate")] + public System.DateTime? LastPublishDate { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Source != null) + { + Source.Validate(); + } + if (Support != null) + { + Support.Validate(); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MetadataSource.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MetadataSource.cs new file mode 100644 index 0000000000000..ce9528ca81910 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MetadataSource.cs @@ -0,0 +1,88 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The original source of the content item, where it comes from. + /// + public partial class MetadataSource + { + /// + /// Initializes a new instance of the MetadataSource class. + /// + public MetadataSource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetadataSource class. + /// + /// Source type of the content. Possible values + /// include: 'LocalWorkspace', 'Community', 'Solution', + /// 'SourceRepository' + /// Name of the content source. The repo name, + /// solution name, LA workspace name etc. + /// ID of the content source. The solution ID, + /// workspace ID, etc + public MetadataSource(string kind, string name = default(string), string sourceId = default(string)) + { + Kind = kind; + Name = name; + SourceId = sourceId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets source type of the content. Possible values include: + /// 'LocalWorkspace', 'Community', 'Solution', 'SourceRepository' + /// + [JsonProperty(PropertyName = "kind")] + public string Kind { get; set; } + + /// + /// Gets or sets name of the content source. The repo name, solution + /// name, LA workspace name etc. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets ID of the content source. The solution ID, workspace + /// ID, etc + /// + [JsonProperty(PropertyName = "sourceId")] + public string SourceId { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Kind == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Kind"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MetadataSupport.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MetadataSupport.cs new file mode 100644 index 0000000000000..0f9a81c34077e --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MetadataSupport.cs @@ -0,0 +1,94 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Support information for the content item. + /// + public partial class MetadataSupport + { + /// + /// Initializes a new instance of the MetadataSupport class. + /// + public MetadataSupport() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MetadataSupport class. + /// + /// Type of support for content item. Possible + /// values include: 'Microsoft', 'Partner', 'Community' + /// Name of the support contact. Company or + /// person. + /// Email of support contact + /// Link for support help, like to support page to + /// open a ticket etc. + public MetadataSupport(string tier, string name = default(string), string email = default(string), string link = default(string)) + { + Tier = tier; + Name = name; + Email = email; + Link = link; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets type of support for content item. Possible values + /// include: 'Microsoft', 'Partner', 'Community' + /// + [JsonProperty(PropertyName = "tier")] + public string Tier { get; set; } + + /// + /// Gets or sets name of the support contact. Company or person. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets email of support contact + /// + [JsonProperty(PropertyName = "email")] + public string Email { get; set; } + + /// + /// Gets or sets link for support help, like to support page to open a + /// ticket etc. + /// + [JsonProperty(PropertyName = "link")] + public string Link { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Tier == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Tier"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MicrosoftSecurityIncidentCreationAlertRule.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MicrosoftSecurityIncidentCreationAlertRule.cs index c8775e0769254..c0379d7f97834 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MicrosoftSecurityIncidentCreationAlertRule.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MicrosoftSecurityIncidentCreationAlertRule.cs @@ -41,14 +41,20 @@ public MicrosoftSecurityIncidentCreationAlertRule() /// cases will be generated. Possible values include: 'Microsoft Cloud /// App Security', 'Azure Security Center', 'Azure Advanced Threat /// Protection', 'Azure Active Directory Identity Protection', 'Azure - /// Security Center for IoT' + /// Security Center for IoT', 'Office 365 Advanced Threat Protection', + /// 'Microsoft Defender Advanced Threat Protection' /// The display name for alerts created by /// this alert rule. /// Determines whether this alert rule is enabled /// or disabled. - /// Azure resource Id - /// Azure resource name - /// Azure resource type + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. /// Etag of the azure resource /// the alerts' displayNames on which /// the cases will be generated @@ -62,8 +68,8 @@ public MicrosoftSecurityIncidentCreationAlertRule() /// rule. /// The last time that this alert has /// been modified. - public MicrosoftSecurityIncidentCreationAlertRule(string productFilter, string displayName, bool enabled, string id = default(string), string name = default(string), string type = default(string), string etag = default(string), IList displayNamesFilter = default(IList), IList displayNamesExcludeFilter = default(IList), IList severitiesFilter = default(IList), string alertRuleTemplateName = default(string), string description = default(string), System.DateTime? lastModifiedUtc = default(System.DateTime?)) - : base(id, name, type, etag) + public MicrosoftSecurityIncidentCreationAlertRule(string productFilter, string displayName, bool enabled, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string), IList displayNamesFilter = default(IList), IList displayNamesExcludeFilter = default(IList), IList severitiesFilter = default(IList), string alertRuleTemplateName = default(string), string description = default(string), System.DateTime? lastModifiedUtc = default(System.DateTime?)) + : base(id, name, type, systemData, etag) { DisplayNamesFilter = displayNamesFilter; DisplayNamesExcludeFilter = displayNamesExcludeFilter; @@ -101,7 +107,8 @@ public MicrosoftSecurityIncidentCreationAlertRule() /// generated. Possible values include: 'Microsoft Cloud App Security', /// 'Azure Security Center', 'Azure Advanced Threat Protection', 'Azure /// Active Directory Identity Protection', 'Azure Security Center for - /// IoT' + /// IoT', 'Office 365 Advanced Threat Protection', 'Microsoft Defender + /// Advanced Threat Protection' /// [JsonProperty(PropertyName = "properties.productFilter")] public string ProductFilter { get; set; } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MicrosoftSecurityIncidentCreationAlertRuleCommonProperties.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MicrosoftSecurityIncidentCreationAlertRuleCommonProperties.cs index a5aa31e08a1a3..0ba49b7cad1ab 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MicrosoftSecurityIncidentCreationAlertRuleCommonProperties.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MicrosoftSecurityIncidentCreationAlertRuleCommonProperties.cs @@ -38,7 +38,8 @@ public MicrosoftSecurityIncidentCreationAlertRuleCommonProperties() /// cases will be generated. Possible values include: 'Microsoft Cloud /// App Security', 'Azure Security Center', 'Azure Advanced Threat /// Protection', 'Azure Active Directory Identity Protection', 'Azure - /// Security Center for IoT' + /// Security Center for IoT', 'Office 365 Advanced Threat Protection', + /// 'Microsoft Defender Advanced Threat Protection' /// the alerts' displayNames on which /// the cases will be generated /// the alerts' displayNames on @@ -78,7 +79,8 @@ public MicrosoftSecurityIncidentCreationAlertRuleCommonProperties() /// generated. Possible values include: 'Microsoft Cloud App Security', /// 'Azure Security Center', 'Azure Advanced Threat Protection', 'Azure /// Active Directory Identity Protection', 'Azure Security Center for - /// IoT' + /// IoT', 'Office 365 Advanced Threat Protection', 'Microsoft Defender + /// Advanced Threat Protection' /// [JsonProperty(PropertyName = "productFilter")] public string ProductFilter { get; set; } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MicrosoftSecurityIncidentCreationAlertRuleTemplate.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MicrosoftSecurityIncidentCreationAlertRuleTemplate.cs index e28afd8d01410..cc5b9d4a8f531 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MicrosoftSecurityIncidentCreationAlertRuleTemplate.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MicrosoftSecurityIncidentCreationAlertRuleTemplate.cs @@ -37,14 +37,6 @@ public MicrosoftSecurityIncidentCreationAlertRuleTemplate() /// Initializes a new instance of the /// MicrosoftSecurityIncidentCreationAlertRuleTemplate class. /// - /// The alerts' productName on which the - /// cases will be generated. Possible values include: 'Microsoft Cloud - /// App Security', 'Azure Security Center', 'Azure Advanced Threat - /// Protection', 'Azure Active Directory Identity Protection', 'Azure - /// Security Center for IoT' - /// Azure resource Id - /// Azure resource name - /// Azure resource type /// the number of alert /// rules that were created by this template /// The time that this alert rule template @@ -53,20 +45,37 @@ public MicrosoftSecurityIncidentCreationAlertRuleTemplate() /// template. /// The display name for alert rule /// template. - /// The required data connectors - /// for this template /// The alert rule template status. Possible /// values include: 'Installed', 'Available', 'NotAvailable' + /// The alerts' productName on which the + /// cases will be generated. Possible values include: 'Microsoft Cloud + /// App Security', 'Azure Security Center', 'Azure Advanced Threat + /// Protection', 'Azure Active Directory Identity Protection', 'Azure + /// Security Center for IoT', 'Office 365 Advanced Threat Protection', + /// 'Microsoft Defender Advanced Threat Protection' + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// The last time that this alert rule + /// template has been updated. + /// The required data sources for + /// this template /// the alerts' displayNames on which /// the cases will be generated /// the alerts' displayNames on /// which the cases will not be generated /// the alerts' severities on which the /// cases will be generated - public MicrosoftSecurityIncidentCreationAlertRuleTemplate(string productFilter, string id = default(string), string name = default(string), string type = default(string), int? alertRulesCreatedByTemplateCount = default(int?), System.DateTime? createdDateUTC = default(System.DateTime?), string description = default(string), string displayName = default(string), IList requiredDataConnectors = default(IList), string status = default(string), IList displayNamesFilter = default(IList), IList displayNamesExcludeFilter = default(IList), IList severitiesFilter = default(IList)) - : base(id, name, type) + public MicrosoftSecurityIncidentCreationAlertRuleTemplate(int alertRulesCreatedByTemplateCount, System.DateTime createdDateUTC, string description, string displayName, string status, string productFilter, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), System.DateTime? lastUpdatedDateUTC = default(System.DateTime?), IList requiredDataConnectors = default(IList), IList displayNamesFilter = default(IList), IList displayNamesExcludeFilter = default(IList), IList severitiesFilter = default(IList)) + : base(id, name, type, systemData) { AlertRulesCreatedByTemplateCount = alertRulesCreatedByTemplateCount; + LastUpdatedDateUTC = lastUpdatedDateUTC; CreatedDateUTC = createdDateUTC; Description = description; DisplayName = displayName; @@ -89,13 +98,19 @@ public MicrosoftSecurityIncidentCreationAlertRuleTemplate() /// template /// [JsonProperty(PropertyName = "properties.alertRulesCreatedByTemplateCount")] - public int? AlertRulesCreatedByTemplateCount { get; set; } + public int AlertRulesCreatedByTemplateCount { get; set; } + + /// + /// Gets the last time that this alert rule template has been updated. + /// + [JsonProperty(PropertyName = "properties.lastUpdatedDateUTC")] + public System.DateTime? LastUpdatedDateUTC { get; private set; } /// /// Gets the time that this alert rule template has been added. /// [JsonProperty(PropertyName = "properties.createdDateUTC")] - public System.DateTime? CreatedDateUTC { get; private set; } + public System.DateTime CreatedDateUTC { get; private set; } /// /// Gets or sets the description of the alert rule template. @@ -110,7 +125,7 @@ public MicrosoftSecurityIncidentCreationAlertRuleTemplate() public string DisplayName { get; set; } /// - /// Gets or sets the required data connectors for this template + /// Gets or sets the required data sources for this template /// [JsonProperty(PropertyName = "properties.requiredDataConnectors")] public IList RequiredDataConnectors { get; set; } @@ -141,7 +156,8 @@ public MicrosoftSecurityIncidentCreationAlertRuleTemplate() /// generated. Possible values include: 'Microsoft Cloud App Security', /// 'Azure Security Center', 'Azure Advanced Threat Protection', 'Azure /// Active Directory Identity Protection', 'Azure Security Center for - /// IoT' + /// IoT', 'Office 365 Advanced Threat Protection', 'Microsoft Defender + /// Advanced Threat Protection' /// [JsonProperty(PropertyName = "properties.productFilter")] public string ProductFilter { get; set; } @@ -161,6 +177,18 @@ public MicrosoftSecurityIncidentCreationAlertRuleTemplate() /// public virtual void Validate() { + if (Description == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Description"); + } + if (DisplayName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DisplayName"); + } + if (Status == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Status"); + } if (ProductFilter == null) { throw new ValidationException(ValidationRules.CannotBeNull, "ProductFilter"); diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MicrosoftSecurityProductName.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MicrosoftSecurityProductName.cs index 253b3b48f9caa..f0652cf74a91f 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MicrosoftSecurityProductName.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MicrosoftSecurityProductName.cs @@ -21,5 +21,7 @@ public static class MicrosoftSecurityProductName public const string AzureAdvancedThreatProtection = "Azure Advanced Threat Protection"; public const string AzureActiveDirectoryIdentityProtection = "Azure Active Directory Identity Protection"; public const string AzureSecurityCenterforIoT = "Azure Security Center for IoT"; + public const string Office365AdvancedThreatProtection = "Office 365 Advanced Threat Protection"; + public const string MicrosoftDefenderAdvancedThreatProtection = "Microsoft Defender Advanced Threat Protection"; } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MtpCheckRequirements.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MtpCheckRequirements.cs new file mode 100644 index 0000000000000..3eab2c1fda1e2 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MtpCheckRequirements.cs @@ -0,0 +1,70 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents MTP (Microsoft Threat Protection) requirements check + /// request. + /// + [Newtonsoft.Json.JsonObject("MicrosoftThreatProtection")] + [Rest.Serialization.JsonTransformation] + public partial class MtpCheckRequirements : DataConnectorsCheckRequirements + { + /// + /// Initializes a new instance of the MtpCheckRequirements class. + /// + public MtpCheckRequirements() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MtpCheckRequirements class. + /// + /// The tenant id to connect to, and get the + /// data from. + public MtpCheckRequirements(string tenantId) + { + TenantId = tenantId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the tenant id to connect to, and get the data from. + /// + [JsonProperty(PropertyName = "properties.tenantId")] + public string TenantId { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (TenantId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TenantId"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/NrtAlertRule.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/NrtAlertRule.cs new file mode 100644 index 0000000000000..5779fd535d2fe --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/NrtAlertRule.cs @@ -0,0 +1,223 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents NRT alert rule. + /// + [Newtonsoft.Json.JsonObject("NRT")] + [Rest.Serialization.JsonTransformation] + public partial class NrtAlertRule : AlertRule + { + /// + /// Initializes a new instance of the NrtAlertRule class. + /// + public NrtAlertRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NrtAlertRule class. + /// + /// The display name for alerts created by + /// this alert rule. + /// Determines whether this alert rule is enabled + /// or disabled. + /// The suppression (in ISO 8601 + /// duration format) to wait since last time this alert rule been + /// triggered. + /// Determines whether the suppression + /// for this alert rule is enabled or disabled. + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Etag of the azure resource + /// The Name of the alert rule + /// template used to create this rule. + /// The version of the alert rule + /// template used to create this rule - in format <a.b.c>, where + /// all are numbers, for example 0 <1.0.2> + /// The description of the alert + /// rule. + /// The query that creates alerts for this + /// rule. + /// The last time that this alert rule + /// has been modified. + /// The severity for alerts created by this + /// alert rule. Possible values include: 'High', 'Medium', 'Low', + /// 'Informational' + /// The tactics of the alert rule + /// The settings of the incidents + /// that created from alerts triggered by this analytics rule + /// Dictionary of string key-value pairs of + /// columns to be attached to the alert + /// Array of the entity mappings of the + /// alert rule + /// The alert details override + /// settings + public NrtAlertRule(string displayName, bool enabled, System.TimeSpan suppressionDuration, bool suppressionEnabled, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string), string alertRuleTemplateName = default(string), string templateVersion = default(string), string description = default(string), string query = default(string), System.DateTime? lastModifiedUtc = default(System.DateTime?), string severity = default(string), IList tactics = default(IList), IncidentConfiguration incidentConfiguration = default(IncidentConfiguration), IDictionary customDetails = default(IDictionary), IList entityMappings = default(IList), AlertDetailsOverride alertDetailsOverride = default(AlertDetailsOverride)) + : base(id, name, type, systemData, etag) + { + AlertRuleTemplateName = alertRuleTemplateName; + TemplateVersion = templateVersion; + Description = description; + Query = query; + DisplayName = displayName; + Enabled = enabled; + LastModifiedUtc = lastModifiedUtc; + SuppressionDuration = suppressionDuration; + SuppressionEnabled = suppressionEnabled; + Severity = severity; + Tactics = tactics; + IncidentConfiguration = incidentConfiguration; + CustomDetails = customDetails; + EntityMappings = entityMappings; + AlertDetailsOverride = alertDetailsOverride; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Name of the alert rule template used to create + /// this rule. + /// + [JsonProperty(PropertyName = "properties.alertRuleTemplateName")] + public string AlertRuleTemplateName { get; set; } + + /// + /// Gets or sets the version of the alert rule template used to create + /// this rule - in format &lt;a.b.c&gt;, where all are numbers, + /// for example 0 &lt;1.0.2&gt; + /// + [JsonProperty(PropertyName = "properties.templateVersion")] + public string TemplateVersion { get; set; } + + /// + /// Gets or sets the description of the alert rule. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the query that creates alerts for this rule. + /// + [JsonProperty(PropertyName = "properties.query")] + public string Query { get; set; } + + /// + /// Gets or sets the display name for alerts created by this alert + /// rule. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets determines whether this alert rule is enabled or + /// disabled. + /// + [JsonProperty(PropertyName = "properties.enabled")] + public bool Enabled { get; set; } + + /// + /// Gets the last time that this alert rule has been modified. + /// + [JsonProperty(PropertyName = "properties.lastModifiedUtc")] + public System.DateTime? LastModifiedUtc { get; private set; } + + /// + /// Gets or sets the suppression (in ISO 8601 duration format) to wait + /// since last time this alert rule been triggered. + /// + [JsonProperty(PropertyName = "properties.suppressionDuration")] + public System.TimeSpan SuppressionDuration { get; set; } + + /// + /// Gets or sets determines whether the suppression for this alert rule + /// is enabled or disabled. + /// + [JsonProperty(PropertyName = "properties.suppressionEnabled")] + public bool SuppressionEnabled { get; set; } + + /// + /// Gets or sets the severity for alerts created by this alert rule. + /// Possible values include: 'High', 'Medium', 'Low', 'Informational' + /// + [JsonProperty(PropertyName = "properties.severity")] + public string Severity { get; set; } + + /// + /// Gets or sets the tactics of the alert rule + /// + [JsonProperty(PropertyName = "properties.tactics")] + public IList Tactics { get; set; } + + /// + /// Gets or sets the settings of the incidents that created from alerts + /// triggered by this analytics rule + /// + [JsonProperty(PropertyName = "properties.incidentConfiguration")] + public IncidentConfiguration IncidentConfiguration { get; set; } + + /// + /// Gets or sets dictionary of string key-value pairs of columns to be + /// attached to the alert + /// + [JsonProperty(PropertyName = "properties.customDetails")] + public IDictionary CustomDetails { get; set; } + + /// + /// Gets or sets array of the entity mappings of the alert rule + /// + [JsonProperty(PropertyName = "properties.entityMappings")] + public IList EntityMappings { get; set; } + + /// + /// Gets or sets the alert details override settings + /// + [JsonProperty(PropertyName = "properties.alertDetailsOverride")] + public AlertDetailsOverride AlertDetailsOverride { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DisplayName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DisplayName"); + } + if (IncidentConfiguration != null) + { + IncidentConfiguration.Validate(); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/NrtAlertRuleTemplate.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/NrtAlertRuleTemplate.cs new file mode 100644 index 0000000000000..0342a00dbbf29 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/NrtAlertRuleTemplate.cs @@ -0,0 +1,224 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents NRT alert rule template. + /// + [Newtonsoft.Json.JsonObject("NRT")] + [Rest.Serialization.JsonTransformation] + public partial class NrtAlertRuleTemplate : AlertRuleTemplate + { + /// + /// Initializes a new instance of the NrtAlertRuleTemplate class. + /// + public NrtAlertRuleTemplate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NrtAlertRuleTemplate class. + /// + /// the number of alert + /// rules that were created by this template + /// The description of the alert rule + /// template. + /// The display name for alert rule + /// template. + /// The alert rule template status. Possible + /// values include: 'Installed', 'Available', 'NotAvailable' + /// The query that creates alerts for this + /// rule. + /// The severity for alerts created by this + /// alert rule. Possible values include: 'High', 'Medium', 'Low', + /// 'Informational' + /// The version of this template - in format + /// <a.b.c>, where all are numbers. For example + /// <1.0.2>. + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// The last time that this alert rule + /// template has been updated. + /// The time that this alert rule template + /// has been added. + /// The required data sources for + /// this template + /// The tactics of the alert rule + /// Dictionary of string key-value pairs of + /// columns to be attached to the alert + /// Array of the entity mappings of the + /// alert rule + /// The alert details override + /// settings + public NrtAlertRuleTemplate(int alertRulesCreatedByTemplateCount, string description, string displayName, string status, string query, string severity, string version, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), System.DateTime? lastUpdatedDateUTC = default(System.DateTime?), System.DateTime? createdDateUTC = default(System.DateTime?), IList requiredDataConnectors = default(IList), IList tactics = default(IList), IDictionary customDetails = default(IDictionary), IList entityMappings = default(IList), AlertDetailsOverride alertDetailsOverride = default(AlertDetailsOverride)) + : base(id, name, type, systemData) + { + AlertRulesCreatedByTemplateCount = alertRulesCreatedByTemplateCount; + LastUpdatedDateUTC = lastUpdatedDateUTC; + CreatedDateUTC = createdDateUTC; + Description = description; + DisplayName = displayName; + RequiredDataConnectors = requiredDataConnectors; + Status = status; + Query = query; + Severity = severity; + Tactics = tactics; + Version = version; + CustomDetails = customDetails; + EntityMappings = entityMappings; + AlertDetailsOverride = alertDetailsOverride; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the number of alert rules that were created by this + /// template + /// + [JsonProperty(PropertyName = "properties.alertRulesCreatedByTemplateCount")] + public int AlertRulesCreatedByTemplateCount { get; set; } + + /// + /// Gets the last time that this alert rule template has been updated. + /// + [JsonProperty(PropertyName = "properties.lastUpdatedDateUTC")] + public System.DateTime? LastUpdatedDateUTC { get; private set; } + + /// + /// Gets the time that this alert rule template has been added. + /// + [JsonProperty(PropertyName = "properties.createdDateUTC")] + public System.DateTime? CreatedDateUTC { get; private set; } + + /// + /// Gets or sets the description of the alert rule template. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the display name for alert rule template. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets the required data sources for this template + /// + [JsonProperty(PropertyName = "properties.requiredDataConnectors")] + public IList RequiredDataConnectors { get; set; } + + /// + /// Gets or sets the alert rule template status. Possible values + /// include: 'Installed', 'Available', 'NotAvailable' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; set; } + + /// + /// Gets or sets the query that creates alerts for this rule. + /// + [JsonProperty(PropertyName = "properties.query")] + public string Query { get; set; } + + /// + /// Gets or sets the severity for alerts created by this alert rule. + /// Possible values include: 'High', 'Medium', 'Low', 'Informational' + /// + [JsonProperty(PropertyName = "properties.severity")] + public string Severity { get; set; } + + /// + /// Gets or sets the tactics of the alert rule + /// + [JsonProperty(PropertyName = "properties.tactics")] + public IList Tactics { get; set; } + + /// + /// Gets or sets the version of this template - in format + /// &lt;a.b.c&gt;, where all are numbers. For example + /// &lt;1.0.2&gt;. + /// + [JsonProperty(PropertyName = "properties.version")] + public string Version { get; set; } + + /// + /// Gets or sets dictionary of string key-value pairs of columns to be + /// attached to the alert + /// + [JsonProperty(PropertyName = "properties.customDetails")] + public IDictionary CustomDetails { get; set; } + + /// + /// Gets or sets array of the entity mappings of the alert rule + /// + [JsonProperty(PropertyName = "properties.entityMappings")] + public IList EntityMappings { get; set; } + + /// + /// Gets or sets the alert details override settings + /// + [JsonProperty(PropertyName = "properties.alertDetailsOverride")] + public AlertDetailsOverride AlertDetailsOverride { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Description == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Description"); + } + if (DisplayName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DisplayName"); + } + if (Status == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Status"); + } + if (Query == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Query"); + } + if (Severity == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Severity"); + } + if (Version == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Version"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OSFamily.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OSFamily.cs new file mode 100644 index 0000000000000..3bf17ab77d582 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OSFamily.cs @@ -0,0 +1,93 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for OSFamily. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum OSFamily + { + /// + /// Host with Linux operating system. + /// + [EnumMember(Value = "Linux")] + Linux, + /// + /// Host with Windows operating system. + /// + [EnumMember(Value = "Windows")] + Windows, + /// + /// Host with Android operating system. + /// + [EnumMember(Value = "Android")] + Android, + /// + /// Host with IOS operating system. + /// + [EnumMember(Value = "IOS")] + IOS, + /// + /// Host with Unknown operating system. + /// + [EnumMember(Value = "Unknown")] + Unknown + } + internal static class OSFamilyEnumExtension + { + internal static string ToSerializedValue(this OSFamily? value) + { + return value == null ? null : ((OSFamily)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this OSFamily value) + { + switch( value ) + { + case OSFamily.Linux: + return "Linux"; + case OSFamily.Windows: + return "Windows"; + case OSFamily.Android: + return "Android"; + case OSFamily.IOS: + return "IOS"; + case OSFamily.Unknown: + return "Unknown"; + } + return null; + } + + internal static OSFamily? ParseOSFamily(this string value) + { + switch( value ) + { + case "Linux": + return OSFamily.Linux; + case "Windows": + return OSFamily.Windows; + case "Android": + return OSFamily.Android; + case "IOS": + return OSFamily.IOS; + case "Unknown": + return OSFamily.Unknown; + } + return null; + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeATPCheckRequirements.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeATPCheckRequirements.cs new file mode 100644 index 0000000000000..f502082fd5e92 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeATPCheckRequirements.cs @@ -0,0 +1,70 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents OfficeATP (Office 365 Advanced Threat Protection) + /// requirements check request. + /// + [Newtonsoft.Json.JsonObject("OfficeATP")] + [Rest.Serialization.JsonTransformation] + public partial class OfficeATPCheckRequirements : DataConnectorsCheckRequirements + { + /// + /// Initializes a new instance of the OfficeATPCheckRequirements class. + /// + public OfficeATPCheckRequirements() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OfficeATPCheckRequirements class. + /// + /// The tenant id to connect to, and get the + /// data from. + public OfficeATPCheckRequirements(string tenantId) + { + TenantId = tenantId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the tenant id to connect to, and get the data from. + /// + [JsonProperty(PropertyName = "properties.tenantId")] + public string TenantId { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (TenantId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TenantId"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeATPDataConnector.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeATPDataConnector.cs new file mode 100644 index 0000000000000..ff69a4d45d122 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeATPDataConnector.cs @@ -0,0 +1,93 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents OfficeATP (Office 365 Advanced Threat Protection) data + /// connector. + /// + [Newtonsoft.Json.JsonObject("OfficeATP")] + [Rest.Serialization.JsonTransformation] + public partial class OfficeATPDataConnector : DataConnector + { + /// + /// Initializes a new instance of the OfficeATPDataConnector class. + /// + public OfficeATPDataConnector() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OfficeATPDataConnector class. + /// + /// The tenant id to connect to, and get the + /// data from. + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Etag of the azure resource + /// The available data types for the + /// connector. + public OfficeATPDataConnector(string tenantId, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string), AlertsDataTypeOfDataConnector dataTypes = default(AlertsDataTypeOfDataConnector)) + : base(id, name, type, systemData, etag) + { + TenantId = tenantId; + DataTypes = dataTypes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the tenant id to connect to, and get the data from. + /// + [JsonProperty(PropertyName = "properties.tenantId")] + public string TenantId { get; set; } + + /// + /// Gets or sets the available data types for the connector. + /// + [JsonProperty(PropertyName = "properties.dataTypes")] + public AlertsDataTypeOfDataConnector DataTypes { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (TenantId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TenantId"); + } + if (DataTypes != null) + { + DataTypes.Validate(); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeConsent.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeConsent.cs index d07012d86d16c..89877d0c88ffe 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeConsent.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeConsent.cs @@ -32,18 +32,23 @@ public OfficeConsent() /// /// Initializes a new instance of the OfficeConsent class. /// - /// Azure resource Id - /// Azure resource name - /// Azure resource type + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. /// The tenantId of the Office365 with the /// consent. - /// The tenant name of the Office365 with the - /// consent. - public OfficeConsent(string id = default(string), string name = default(string), string type = default(string), string tenantId = default(string), string tenantName = default(string)) - : base(id, name, type) + /// Help to easily cascade among the data + /// layers. + public OfficeConsent(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string tenantId = default(string), string consentId = default(string)) + : base(id, name, type, systemData) { TenantId = tenantId; - TenantName = tenantName; + ConsentId = consentId; CustomInit(); } @@ -59,10 +64,10 @@ public OfficeConsent() public string TenantId { get; set; } /// - /// Gets the tenant name of the Office365 with the consent. + /// Gets or sets help to easily cascade among the data layers. /// - [JsonProperty(PropertyName = "properties.tenantName")] - public string TenantName { get; private set; } + [JsonProperty(PropertyName = "properties.consentId")] + public string ConsentId { get; set; } } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnector.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnector.cs index 425a8b2bf0a33..a72f69fe2ed71 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnector.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnector.cs @@ -33,16 +33,21 @@ public OfficeDataConnector() /// /// Initializes a new instance of the OfficeDataConnector class. /// - /// Azure resource Id - /// Azure resource name - /// Azure resource type - /// Etag of the azure resource /// The tenant id to connect to, and get the /// data from. /// The available data types for the /// connector. - public OfficeDataConnector(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), string tenantId = default(string), OfficeDataConnectorDataTypes dataTypes = default(OfficeDataConnectorDataTypes)) - : base(id, name, type, etag) + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Etag of the azure resource + public OfficeDataConnector(string tenantId, OfficeDataConnectorDataTypes dataTypes, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string)) + : base(id, name, type, systemData, etag) { TenantId = tenantId; DataTypes = dataTypes; @@ -66,5 +71,26 @@ public OfficeDataConnector() [JsonProperty(PropertyName = "properties.dataTypes")] public OfficeDataConnectorDataTypes DataTypes { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (TenantId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TenantId"); + } + if (DataTypes == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DataTypes"); + } + if (DataTypes != null) + { + DataTypes.Validate(); + } + } } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnectorDataTypes.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnectorDataTypes.cs index 278bc09539aac..ef946ee56bfa5 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnectorDataTypes.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnectorDataTypes.cs @@ -10,6 +10,7 @@ namespace Microsoft.Azure.Management.SecurityInsights.Models { + using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -34,7 +35,7 @@ public OfficeDataConnectorDataTypes() /// Exchange data type connection. /// SharePoint data type connection. /// Teams data type connection. - public OfficeDataConnectorDataTypes(OfficeDataConnectorDataTypesExchange exchange = default(OfficeDataConnectorDataTypesExchange), OfficeDataConnectorDataTypesSharePoint sharePoint = default(OfficeDataConnectorDataTypesSharePoint), OfficeDataConnectorDataTypesTeams teams = default(OfficeDataConnectorDataTypesTeams)) + public OfficeDataConnectorDataTypes(OfficeDataConnectorDataTypesExchange exchange, OfficeDataConnectorDataTypesSharePoint sharePoint, OfficeDataConnectorDataTypesTeams teams) { Exchange = exchange; SharePoint = sharePoint; @@ -65,5 +66,38 @@ public OfficeDataConnectorDataTypes() [JsonProperty(PropertyName = "teams")] public OfficeDataConnectorDataTypesTeams Teams { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Exchange == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Exchange"); + } + if (SharePoint == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SharePoint"); + } + if (Teams == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Teams"); + } + if (Exchange != null) + { + Exchange.Validate(); + } + if (SharePoint != null) + { + SharePoint.Validate(); + } + if (Teams != null) + { + Teams.Validate(); + } + } } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnectorDataTypesExchange.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnectorDataTypesExchange.cs index b06d0c806844d..c1ab6f6760053 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnectorDataTypesExchange.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnectorDataTypesExchange.cs @@ -33,7 +33,7 @@ public OfficeDataConnectorDataTypesExchange() /// Describe whether this data type connection is /// enabled or not. Possible values include: 'Enabled', /// 'Disabled' - public OfficeDataConnectorDataTypesExchange(string state = default(string)) + public OfficeDataConnectorDataTypesExchange(string state) : base(state) { CustomInit(); @@ -44,5 +44,15 @@ public OfficeDataConnectorDataTypesExchange() /// partial void CustomInit(); + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnectorDataTypesSharePoint.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnectorDataTypesSharePoint.cs index ffe852f246520..1245549e0981a 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnectorDataTypesSharePoint.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnectorDataTypesSharePoint.cs @@ -33,7 +33,7 @@ public OfficeDataConnectorDataTypesSharePoint() /// Describe whether this data type connection is /// enabled or not. Possible values include: 'Enabled', /// 'Disabled' - public OfficeDataConnectorDataTypesSharePoint(string state = default(string)) + public OfficeDataConnectorDataTypesSharePoint(string state) : base(state) { CustomInit(); @@ -44,5 +44,15 @@ public OfficeDataConnectorDataTypesSharePoint() /// partial void CustomInit(); + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnectorDataTypesTeams.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnectorDataTypesTeams.cs index 583503a8e8e4c..b64270bb0cccb 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnectorDataTypesTeams.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnectorDataTypesTeams.cs @@ -33,7 +33,7 @@ public OfficeDataConnectorDataTypesTeams() /// Describe whether this data type connection is /// enabled or not. Possible values include: 'Enabled', /// 'Disabled' - public OfficeDataConnectorDataTypesTeams(string state = default(string)) + public OfficeDataConnectorDataTypesTeams(string state) : base(state) { CustomInit(); @@ -44,5 +44,15 @@ public OfficeDataConnectorDataTypesTeams() /// partial void CustomInit(); + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeIRMCheckRequirements.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeIRMCheckRequirements.cs new file mode 100644 index 0000000000000..ed07e1ce2e7f0 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeIRMCheckRequirements.cs @@ -0,0 +1,70 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents OfficeIRM (Microsoft Insider Risk Management) requirements + /// check request. + /// + [Newtonsoft.Json.JsonObject("OfficeIRM")] + [Rest.Serialization.JsonTransformation] + public partial class OfficeIRMCheckRequirements : DataConnectorsCheckRequirements + { + /// + /// Initializes a new instance of the OfficeIRMCheckRequirements class. + /// + public OfficeIRMCheckRequirements() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OfficeIRMCheckRequirements class. + /// + /// The tenant id to connect to, and get the + /// data from. + public OfficeIRMCheckRequirements(string tenantId) + { + TenantId = tenantId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the tenant id to connect to, and get the data from. + /// + [JsonProperty(PropertyName = "properties.tenantId")] + public string TenantId { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (TenantId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TenantId"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeIRMDataConnector.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeIRMDataConnector.cs new file mode 100644 index 0000000000000..1ab1000ca0cef --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeIRMDataConnector.cs @@ -0,0 +1,93 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents OfficeIRM (Microsoft Insider Risk Management) data + /// connector. + /// + [Newtonsoft.Json.JsonObject("OfficeIRM")] + [Rest.Serialization.JsonTransformation] + public partial class OfficeIRMDataConnector : DataConnector + { + /// + /// Initializes a new instance of the OfficeIRMDataConnector class. + /// + public OfficeIRMDataConnector() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OfficeIRMDataConnector class. + /// + /// The tenant id to connect to, and get the + /// data from. + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Etag of the azure resource + /// The available data types for the + /// connector. + public OfficeIRMDataConnector(string tenantId, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string), AlertsDataTypeOfDataConnector dataTypes = default(AlertsDataTypeOfDataConnector)) + : base(id, name, type, systemData, etag) + { + TenantId = tenantId; + DataTypes = dataTypes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the tenant id to connect to, and get the data from. + /// + [JsonProperty(PropertyName = "properties.tenantId")] + public string TenantId { get; set; } + + /// + /// Gets or sets the available data types for the connector. + /// + [JsonProperty(PropertyName = "properties.dataTypes")] + public AlertsDataTypeOfDataConnector DataTypes { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (TenantId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TenantId"); + } + if (DataTypes != null) + { + DataTypes.Validate(); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Operation.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Operation.cs index c5d3af3929eb8..ab1fe5e7014ff 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Operation.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Operation.cs @@ -31,10 +31,15 @@ public Operation() /// /// Properties of the operation /// Name of the operation - public Operation(OperationDisplay display = default(OperationDisplay), string name = default(string)) + /// The origin of the operation + /// Indicates whether the operation is a + /// data action + public Operation(OperationDisplay display = default(OperationDisplay), string name = default(string), string origin = default(string), bool? isDataAction = default(bool?)) { Display = display; Name = name; + Origin = origin; + IsDataAction = isDataAction; CustomInit(); } @@ -55,5 +60,17 @@ public Operation() [JsonProperty(PropertyName = "name")] public string Name { get; set; } + /// + /// Gets or sets the origin of the operation + /// + [JsonProperty(PropertyName = "origin")] + public string Origin { get; set; } + + /// + /// Gets or sets indicates whether the operation is a data action + /// + [JsonProperty(PropertyName = "isDataAction")] + public bool? IsDataAction { get; set; } + } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OperatorModel.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OperatorModel.cs new file mode 100644 index 0000000000000..141d60ebf8373 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OperatorModel.cs @@ -0,0 +1,22 @@ +// +// 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.Models +{ + + /// + /// Defines values for OperatorModel. + /// + public static class OperatorModel + { + public const string AND = "AND"; + public const string OR = "OR"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OutputType.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OutputType.cs new file mode 100644 index 0000000000000..e628c22c53b24 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OutputType.cs @@ -0,0 +1,24 @@ +// +// 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.Models +{ + + /// + /// Defines values for OutputType. + /// + public static class OutputType + { + public const string Number = "Number"; + public const string String = "String"; + public const string Date = "Date"; + public const string Entity = "Entity"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OwnerType.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OwnerType.cs new file mode 100644 index 0000000000000..6ee411a86504d --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OwnerType.cs @@ -0,0 +1,32 @@ +// +// 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.Models +{ + + /// + /// Defines values for OwnerType. + /// + public static class OwnerType + { + /// + /// The incident owner type is unknown + /// + public const string Unknown = "Unknown"; + /// + /// The incident owner type is an AAD user + /// + public const string User = "User"; + /// + /// The incident owner type is an AAD group + /// + public const string Group = "Group"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/PermissionProviderScope.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/PermissionProviderScope.cs new file mode 100644 index 0000000000000..636281a580f02 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/PermissionProviderScope.cs @@ -0,0 +1,23 @@ +// +// 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.Models +{ + + /// + /// Defines values for PermissionProviderScope. + /// + public static class PermissionProviderScope + { + public const string ResourceGroup = "ResourceGroup"; + public const string Subscription = "Subscription"; + public const string Workspace = "Workspace"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Permissions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Permissions.cs new file mode 100644 index 0000000000000..fcd18ba1cac46 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Permissions.cs @@ -0,0 +1,64 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Permissions required for the connector + /// + public partial class Permissions + { + /// + /// Initializes a new instance of the Permissions class. + /// + public Permissions() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Permissions class. + /// + /// Resource provider permissions + /// required for the connector + /// Customs permissions required for the + /// connector + public Permissions(IList resourceProvider = default(IList), IList customs = default(IList)) + { + ResourceProvider = resourceProvider; + Customs = customs; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource provider permissions required for the + /// connector + /// + [JsonProperty(PropertyName = "resourceProvider")] + public IList ResourceProvider { get; set; } + + /// + /// Gets or sets customs permissions required for the connector + /// + [JsonProperty(PropertyName = "customs")] + public IList Customs { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/PermissionsCustomsItem.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/PermissionsCustomsItem.cs new file mode 100644 index 0000000000000..ce66c3377ab90 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/PermissionsCustomsItem.cs @@ -0,0 +1,42 @@ +// +// 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.Models +{ + using System.Linq; + + public partial class PermissionsCustomsItem : Customs + { + /// + /// Initializes a new instance of the PermissionsCustomsItem class. + /// + public PermissionsCustomsItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PermissionsCustomsItem class. + /// + /// Customs permissions name + /// Customs permissions description + public PermissionsCustomsItem(string name = default(string), string description = default(string)) + : base(name, description) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/PermissionsResourceProviderItem.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/PermissionsResourceProviderItem.cs new file mode 100644 index 0000000000000..c61dfdb410fbf --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/PermissionsResourceProviderItem.cs @@ -0,0 +1,57 @@ +// +// 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.Models +{ + using System.Linq; + + public partial class PermissionsResourceProviderItem : ResourceProvider + { + /// + /// Initializes a new instance of the PermissionsResourceProviderItem + /// class. + /// + public PermissionsResourceProviderItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PermissionsResourceProviderItem + /// class. + /// + /// Provider name. Possible values include: + /// 'Microsoft.OperationalInsights/solutions', + /// 'Microsoft.OperationalInsights/workspaces', + /// 'Microsoft.OperationalInsights/workspaces/datasources', + /// 'microsoft.aadiam/diagnosticSettings', + /// 'Microsoft.OperationalInsights/workspaces/sharedKeys', + /// 'Microsoft.Authorization/policyAssignments' + /// Permission description + /// text + /// Permission provider display + /// name + /// Permission provider scope. Possible values + /// include: 'ResourceGroup', 'Subscription', 'Workspace' + /// Required permissions for the + /// connector + public PermissionsResourceProviderItem(string provider = default(string), string permissionsDisplayText = default(string), string providerDisplayName = default(string), string scope = default(string), RequiredPermissions requiredPermissions = default(RequiredPermissions)) + : base(provider, permissionsDisplayText, providerDisplayName, scope, requiredPermissions) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/PollingFrequency.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/PollingFrequency.cs new file mode 100644 index 0000000000000..0f73095405004 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/PollingFrequency.cs @@ -0,0 +1,32 @@ +// +// 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.Models +{ + + /// + /// Defines values for PollingFrequency. + /// + public static class PollingFrequency + { + /// + /// Once a minute + /// + public const string OnceAMinute = "OnceAMinute"; + /// + /// Once an hour + /// + public const string OnceAnHour = "OnceAnHour"; + /// + /// Once a day + /// + public const string OnceADay = "OnceADay"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ProcessEntity.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ProcessEntity.cs new file mode 100644 index 0000000000000..02f6eb64a9dd3 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ProcessEntity.cs @@ -0,0 +1,161 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents a process entity. + /// + [Newtonsoft.Json.JsonObject("Process")] + [Rest.Serialization.JsonTransformation] + public partial class ProcessEntity : Entity + { + /// + /// Initializes a new instance of the ProcessEntity class. + /// + public ProcessEntity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProcessEntity class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// A bag of custom fields that should be + /// part of the entity and will be presented to the user. + /// The graph item display name which is a + /// short humanly readable description of the graph item instance. This + /// property is optional and might be system generated. + /// The account entity id running the + /// processes. + /// The command line used to create the + /// process + /// The time when the process started to + /// run + /// The elevation token associated with + /// the process. Possible values include: 'Default', 'Full', + /// 'Limited' + /// The host entity id on which the process + /// was running + /// The session entity id in + /// which the process was running + /// Image file entity id + /// The parent process entity + /// id. + /// The process ID + public ProcessEntity(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary additionalData = default(IDictionary), string friendlyName = default(string), string accountEntityId = default(string), string commandLine = default(string), System.DateTime? creationTimeUtc = default(System.DateTime?), ElevationToken? elevationToken = default(ElevationToken?), string hostEntityId = default(string), string hostLogonSessionEntityId = default(string), string imageFileEntityId = default(string), string parentProcessEntityId = default(string), string processId = default(string)) + : base(id, name, type, systemData) + { + AdditionalData = additionalData; + FriendlyName = friendlyName; + AccountEntityId = accountEntityId; + CommandLine = commandLine; + CreationTimeUtc = creationTimeUtc; + ElevationToken = elevationToken; + HostEntityId = hostEntityId; + HostLogonSessionEntityId = hostLogonSessionEntityId; + ImageFileEntityId = imageFileEntityId; + ParentProcessEntityId = parentProcessEntityId; + ProcessId = processId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a bag of custom fields that should be part of the entity and + /// will be presented to the user. + /// + [JsonProperty(PropertyName = "properties.additionalData")] + public IDictionary AdditionalData { get; private set; } + + /// + /// Gets the graph item display name which is a short humanly readable + /// description of the graph item instance. This property is optional + /// and might be system generated. + /// + [JsonProperty(PropertyName = "properties.friendlyName")] + public string FriendlyName { get; private set; } + + /// + /// Gets the account entity id running the processes. + /// + [JsonProperty(PropertyName = "properties.accountEntityId")] + public string AccountEntityId { get; private set; } + + /// + /// Gets the command line used to create the process + /// + [JsonProperty(PropertyName = "properties.commandLine")] + public string CommandLine { get; private set; } + + /// + /// Gets the time when the process started to run + /// + [JsonProperty(PropertyName = "properties.creationTimeUtc")] + public System.DateTime? CreationTimeUtc { get; private set; } + + /// + /// Gets or sets the elevation token associated with the process. + /// Possible values include: 'Default', 'Full', 'Limited' + /// + [JsonProperty(PropertyName = "properties.elevationToken")] + public ElevationToken? ElevationToken { get; set; } + + /// + /// Gets the host entity id on which the process was running + /// + [JsonProperty(PropertyName = "properties.hostEntityId")] + public string HostEntityId { get; private set; } + + /// + /// Gets the session entity id in which the process was running + /// + [JsonProperty(PropertyName = "properties.hostLogonSessionEntityId")] + public string HostLogonSessionEntityId { get; private set; } + + /// + /// Gets image file entity id + /// + [JsonProperty(PropertyName = "properties.imageFileEntityId")] + public string ImageFileEntityId { get; private set; } + + /// + /// Gets the parent process entity id. + /// + [JsonProperty(PropertyName = "properties.parentProcessEntityId")] + public string ParentProcessEntityId { get; private set; } + + /// + /// Gets the process ID + /// + [JsonProperty(PropertyName = "properties.processId")] + public string ProcessId { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ProviderName.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ProviderName.cs new file mode 100644 index 0000000000000..8827ea3f71290 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ProviderName.cs @@ -0,0 +1,26 @@ +// +// 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.Models +{ + + /// + /// Defines values for ProviderName. + /// + public static class ProviderName + { + public const string MicrosoftOperationalInsightsSolutions = "Microsoft.OperationalInsights/solutions"; + public const string MicrosoftOperationalInsightsWorkspaces = "Microsoft.OperationalInsights/workspaces"; + public const string MicrosoftOperationalInsightsWorkspacesDatasources = "Microsoft.OperationalInsights/workspaces/datasources"; + public const string MicrosoftaadiamDiagnosticSettings = "microsoft.aadiam/diagnosticSettings"; + public const string MicrosoftOperationalInsightsWorkspacesSharedKeys = "Microsoft.OperationalInsights/workspaces/sharedKeys"; + public const string MicrosoftAuthorizationPolicyAssignments = "Microsoft.Authorization/policyAssignments"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ProxyResource.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ProxyResource.cs new file mode 100644 index 0000000000000..26002268bddab --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ProxyResource.cs @@ -0,0 +1,55 @@ +// +// 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.Models +{ + using System.Linq; + + /// + /// Proxy Resource + /// + /// + /// The resource model definition for a Azure Resource Manager proxy + /// resource. It will not have tags and a location + /// + public partial class ProxyResource : Resource + { + /// + /// Initializes a new instance of the ProxyResource class. + /// + public ProxyResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProxyResource class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + public ProxyResource(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData)) + : base(id, name, type, systemData) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/QueryBasedAlertRuleProperties.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/QueryBasedAlertRuleProperties.cs new file mode 100644 index 0000000000000..6f2009efbb73f --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/QueryBasedAlertRuleProperties.cs @@ -0,0 +1,212 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Query based alert rule base property bag. + /// + public partial class QueryBasedAlertRuleProperties + { + /// + /// Initializes a new instance of the QueryBasedAlertRuleProperties + /// class. + /// + public QueryBasedAlertRuleProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the QueryBasedAlertRuleProperties + /// class. + /// + /// The display name for alerts created by + /// this alert rule. + /// Determines whether this alert rule is enabled + /// or disabled. + /// The suppression (in ISO 8601 + /// duration format) to wait since last time this alert rule been + /// triggered. + /// Determines whether the suppression + /// for this alert rule is enabled or disabled. + /// The Name of the alert rule + /// template used to create this rule. + /// The version of the alert rule + /// template used to create this rule - in format <a.b.c>, where + /// all are numbers, for example 0 <1.0.2> + /// The description of the alert + /// rule. + /// The query that creates alerts for this + /// rule. + /// The last time that this alert rule + /// has been modified. + /// The severity for alerts created by this + /// alert rule. Possible values include: 'High', 'Medium', 'Low', + /// 'Informational' + /// The tactics of the alert rule + /// The settings of the incidents + /// that created from alerts triggered by this analytics rule + /// Dictionary of string key-value pairs of + /// columns to be attached to the alert + /// Array of the entity mappings of the + /// alert rule + /// The alert details override + /// settings + public QueryBasedAlertRuleProperties(string displayName, bool enabled, System.TimeSpan suppressionDuration, bool suppressionEnabled, string alertRuleTemplateName = default(string), string templateVersion = default(string), string description = default(string), string query = default(string), System.DateTime? lastModifiedUtc = default(System.DateTime?), string severity = default(string), IList tactics = default(IList), IncidentConfiguration incidentConfiguration = default(IncidentConfiguration), IDictionary customDetails = default(IDictionary), IList entityMappings = default(IList), AlertDetailsOverride alertDetailsOverride = default(AlertDetailsOverride)) + { + AlertRuleTemplateName = alertRuleTemplateName; + TemplateVersion = templateVersion; + Description = description; + Query = query; + DisplayName = displayName; + Enabled = enabled; + LastModifiedUtc = lastModifiedUtc; + SuppressionDuration = suppressionDuration; + SuppressionEnabled = suppressionEnabled; + Severity = severity; + Tactics = tactics; + IncidentConfiguration = incidentConfiguration; + CustomDetails = customDetails; + EntityMappings = entityMappings; + AlertDetailsOverride = alertDetailsOverride; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Name of the alert rule template used to create + /// this rule. + /// + [JsonProperty(PropertyName = "alertRuleTemplateName")] + public string AlertRuleTemplateName { get; set; } + + /// + /// Gets or sets the version of the alert rule template used to create + /// this rule - in format &lt;a.b.c&gt;, where all are numbers, + /// for example 0 &lt;1.0.2&gt; + /// + [JsonProperty(PropertyName = "templateVersion")] + public string TemplateVersion { get; set; } + + /// + /// Gets or sets the description of the alert rule. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets the query that creates alerts for this rule. + /// + [JsonProperty(PropertyName = "query")] + public string Query { get; set; } + + /// + /// Gets or sets the display name for alerts created by this alert + /// rule. + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets determines whether this alert rule is enabled or + /// disabled. + /// + [JsonProperty(PropertyName = "enabled")] + public bool Enabled { get; set; } + + /// + /// Gets the last time that this alert rule has been modified. + /// + [JsonProperty(PropertyName = "lastModifiedUtc")] + public System.DateTime? LastModifiedUtc { get; private set; } + + /// + /// Gets or sets the suppression (in ISO 8601 duration format) to wait + /// since last time this alert rule been triggered. + /// + [JsonProperty(PropertyName = "suppressionDuration")] + public System.TimeSpan SuppressionDuration { get; set; } + + /// + /// Gets or sets determines whether the suppression for this alert rule + /// is enabled or disabled. + /// + [JsonProperty(PropertyName = "suppressionEnabled")] + public bool SuppressionEnabled { get; set; } + + /// + /// Gets or sets the severity for alerts created by this alert rule. + /// Possible values include: 'High', 'Medium', 'Low', 'Informational' + /// + [JsonProperty(PropertyName = "severity")] + public string Severity { get; set; } + + /// + /// Gets or sets the tactics of the alert rule + /// + [JsonProperty(PropertyName = "tactics")] + public IList Tactics { get; set; } + + /// + /// Gets or sets the settings of the incidents that created from alerts + /// triggered by this analytics rule + /// + [JsonProperty(PropertyName = "incidentConfiguration")] + public IncidentConfiguration IncidentConfiguration { get; set; } + + /// + /// Gets or sets dictionary of string key-value pairs of columns to be + /// attached to the alert + /// + [JsonProperty(PropertyName = "customDetails")] + public IDictionary CustomDetails { get; set; } + + /// + /// Gets or sets array of the entity mappings of the alert rule + /// + [JsonProperty(PropertyName = "entityMappings")] + public IList EntityMappings { get; set; } + + /// + /// Gets or sets the alert details override settings + /// + [JsonProperty(PropertyName = "alertDetailsOverride")] + public AlertDetailsOverride AlertDetailsOverride { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DisplayName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DisplayName"); + } + if (IncidentConfiguration != null) + { + IncidentConfiguration.Validate(); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/QueryBasedAlertRuleTemplateProperties.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/QueryBasedAlertRuleTemplateProperties.cs new file mode 100644 index 0000000000000..49894eafac852 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/QueryBasedAlertRuleTemplateProperties.cs @@ -0,0 +1,115 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Query based alert rule template base property bag. + /// + public partial class QueryBasedAlertRuleTemplateProperties + { + /// + /// Initializes a new instance of the + /// QueryBasedAlertRuleTemplateProperties class. + /// + public QueryBasedAlertRuleTemplateProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// QueryBasedAlertRuleTemplateProperties class. + /// + /// The query that creates alerts for this + /// rule. + /// The severity for alerts created by this + /// alert rule. Possible values include: 'High', 'Medium', 'Low', + /// 'Informational' + /// The tactics of the alert rule + /// The version of this template - in format + /// <a.b.c>, where all are numbers. For example + /// <1.0.2>. + /// Dictionary of string key-value pairs of + /// columns to be attached to the alert + /// Array of the entity mappings of the + /// alert rule + /// The alert details override + /// settings + public QueryBasedAlertRuleTemplateProperties(string query = default(string), string severity = default(string), IList tactics = default(IList), string version = default(string), IDictionary customDetails = default(IDictionary), IList entityMappings = default(IList), AlertDetailsOverride alertDetailsOverride = default(AlertDetailsOverride)) + { + Query = query; + Severity = severity; + Tactics = tactics; + Version = version; + CustomDetails = customDetails; + EntityMappings = entityMappings; + AlertDetailsOverride = alertDetailsOverride; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the query that creates alerts for this rule. + /// + [JsonProperty(PropertyName = "query")] + public string Query { get; set; } + + /// + /// Gets or sets the severity for alerts created by this alert rule. + /// Possible values include: 'High', 'Medium', 'Low', 'Informational' + /// + [JsonProperty(PropertyName = "severity")] + public string Severity { get; set; } + + /// + /// Gets or sets the tactics of the alert rule + /// + [JsonProperty(PropertyName = "tactics")] + public IList Tactics { get; set; } + + /// + /// Gets or sets the version of this template - in format + /// &lt;a.b.c&gt;, where all are numbers. For example + /// &lt;1.0.2&gt;. + /// + [JsonProperty(PropertyName = "version")] + public string Version { get; set; } + + /// + /// Gets or sets dictionary of string key-value pairs of columns to be + /// attached to the alert + /// + [JsonProperty(PropertyName = "customDetails")] + public IDictionary CustomDetails { get; set; } + + /// + /// Gets or sets array of the entity mappings of the alert rule + /// + [JsonProperty(PropertyName = "entityMappings")] + public IList EntityMappings { get; set; } + + /// + /// Gets or sets the alert details override settings + /// + [JsonProperty(PropertyName = "alertDetailsOverride")] + public AlertDetailsOverride AlertDetailsOverride { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RegistryHive.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RegistryHive.cs new file mode 100644 index 0000000000000..0860ca0264f82 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RegistryHive.cs @@ -0,0 +1,60 @@ +// +// 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.Models +{ + + /// + /// Defines values for RegistryHive. + /// + public static class RegistryHive + { + /// + /// HKEY_LOCAL_MACHINE + /// + public const string HKEYLOCALMACHINE = "HKEY_LOCAL_MACHINE"; + /// + /// HKEY_CLASSES_ROOT + /// + public const string HKEYCLASSESROOT = "HKEY_CLASSES_ROOT"; + /// + /// HKEY_CURRENT_CONFIG + /// + public const string HKEYCURRENTCONFIG = "HKEY_CURRENT_CONFIG"; + /// + /// HKEY_USERS + /// + public const string HKEYUSERS = "HKEY_USERS"; + /// + /// HKEY_CURRENT_USER_LOCAL_SETTINGS + /// + public const string HKEYCURRENTUSERLOCALSETTINGS = "HKEY_CURRENT_USER_LOCAL_SETTINGS"; + /// + /// HKEY_PERFORMANCE_DATA + /// + public const string HKEYPERFORMANCEDATA = "HKEY_PERFORMANCE_DATA"; + /// + /// HKEY_PERFORMANCE_NLSTEXT + /// + public const string HKEYPERFORMANCENLSTEXT = "HKEY_PERFORMANCE_NLSTEXT"; + /// + /// HKEY_PERFORMANCE_TEXT + /// + public const string HKEYPERFORMANCETEXT = "HKEY_PERFORMANCE_TEXT"; + /// + /// HKEY_A + /// + public const string HKEYA = "HKEY_A"; + /// + /// HKEY_CURRENT_USER + /// + public const string HKEYCURRENTUSER = "HKEY_CURRENT_USER"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RegistryKeyEntity.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RegistryKeyEntity.cs new file mode 100644 index 0000000000000..3663e6f019789 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RegistryKeyEntity.cs @@ -0,0 +1,105 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents a registry key entity. + /// + [Newtonsoft.Json.JsonObject("RegistryKey")] + [Rest.Serialization.JsonTransformation] + public partial class RegistryKeyEntity : Entity + { + /// + /// Initializes a new instance of the RegistryKeyEntity class. + /// + public RegistryKeyEntity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RegistryKeyEntity class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// A bag of custom fields that should be + /// part of the entity and will be presented to the user. + /// The graph item display name which is a + /// short humanly readable description of the graph item instance. This + /// property is optional and might be system generated. + /// the hive that holds the registry key. Possible + /// values include: 'HKEY_LOCAL_MACHINE', 'HKEY_CLASSES_ROOT', + /// 'HKEY_CURRENT_CONFIG', 'HKEY_USERS', + /// 'HKEY_CURRENT_USER_LOCAL_SETTINGS', 'HKEY_PERFORMANCE_DATA', + /// 'HKEY_PERFORMANCE_NLSTEXT', 'HKEY_PERFORMANCE_TEXT', 'HKEY_A', + /// 'HKEY_CURRENT_USER' + /// The registry key path. + public RegistryKeyEntity(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary additionalData = default(IDictionary), string friendlyName = default(string), string hive = default(string), string key = default(string)) + : base(id, name, type, systemData) + { + AdditionalData = additionalData; + FriendlyName = friendlyName; + Hive = hive; + Key = key; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a bag of custom fields that should be part of the entity and + /// will be presented to the user. + /// + [JsonProperty(PropertyName = "properties.additionalData")] + public IDictionary AdditionalData { get; private set; } + + /// + /// Gets the graph item display name which is a short humanly readable + /// description of the graph item instance. This property is optional + /// and might be system generated. + /// + [JsonProperty(PropertyName = "properties.friendlyName")] + public string FriendlyName { get; private set; } + + /// + /// Gets the hive that holds the registry key. Possible values include: + /// 'HKEY_LOCAL_MACHINE', 'HKEY_CLASSES_ROOT', 'HKEY_CURRENT_CONFIG', + /// 'HKEY_USERS', 'HKEY_CURRENT_USER_LOCAL_SETTINGS', + /// 'HKEY_PERFORMANCE_DATA', 'HKEY_PERFORMANCE_NLSTEXT', + /// 'HKEY_PERFORMANCE_TEXT', 'HKEY_A', 'HKEY_CURRENT_USER' + /// + [JsonProperty(PropertyName = "properties.hive")] + public string Hive { get; private set; } + + /// + /// Gets the registry key path. + /// + [JsonProperty(PropertyName = "properties.key")] + public string Key { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RegistryValueEntity.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RegistryValueEntity.cs new file mode 100644 index 0000000000000..6ffb7d0590cb1 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RegistryValueEntity.cs @@ -0,0 +1,120 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents a registry value entity. + /// + [Newtonsoft.Json.JsonObject("RegistryValue")] + [Rest.Serialization.JsonTransformation] + public partial class RegistryValueEntity : Entity + { + /// + /// Initializes a new instance of the RegistryValueEntity class. + /// + public RegistryValueEntity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RegistryValueEntity class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// A bag of custom fields that should be + /// part of the entity and will be presented to the user. + /// The graph item display name which is a + /// short humanly readable description of the graph item instance. This + /// property is optional and might be system generated. + /// The registry key entity id. + /// String formatted representation of the + /// value data. + /// The registry value name. + /// Specifies the data types to use when + /// storing values in the registry, or identifies the data type of a + /// value in the registry. Possible values include: 'None', 'Unknown', + /// 'String', 'ExpandString', 'Binary', 'DWord', 'MultiString', + /// 'QWord' + public RegistryValueEntity(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary additionalData = default(IDictionary), string friendlyName = default(string), string keyEntityId = default(string), string valueData = default(string), string valueName = default(string), string valueType = default(string)) + : base(id, name, type, systemData) + { + AdditionalData = additionalData; + FriendlyName = friendlyName; + KeyEntityId = keyEntityId; + ValueData = valueData; + ValueName = valueName; + ValueType = valueType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a bag of custom fields that should be part of the entity and + /// will be presented to the user. + /// + [JsonProperty(PropertyName = "properties.additionalData")] + public IDictionary AdditionalData { get; private set; } + + /// + /// Gets the graph item display name which is a short humanly readable + /// description of the graph item instance. This property is optional + /// and might be system generated. + /// + [JsonProperty(PropertyName = "properties.friendlyName")] + public string FriendlyName { get; private set; } + + /// + /// Gets the registry key entity id. + /// + [JsonProperty(PropertyName = "properties.keyEntityId")] + public string KeyEntityId { get; private set; } + + /// + /// Gets string formatted representation of the value data. + /// + [JsonProperty(PropertyName = "properties.valueData")] + public string ValueData { get; private set; } + + /// + /// Gets the registry value name. + /// + [JsonProperty(PropertyName = "properties.valueName")] + public string ValueName { get; private set; } + + /// + /// Gets specifies the data types to use when storing values in the + /// registry, or identifies the data type of a value in the registry. + /// Possible values include: 'None', 'Unknown', 'String', + /// 'ExpandString', 'Binary', 'DWord', 'MultiString', 'QWord' + /// + [JsonProperty(PropertyName = "properties.valueType")] + public string ValueType { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RegistryValueKind.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RegistryValueKind.cs new file mode 100644 index 0000000000000..76710dc818473 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RegistryValueKind.cs @@ -0,0 +1,52 @@ +// +// 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.Models +{ + + /// + /// Defines values for RegistryValueKind. + /// + public static class RegistryValueKind + { + /// + /// None + /// + public const string None = "None"; + /// + /// Unknown value type + /// + public const string Unknown = "Unknown"; + /// + /// String value type + /// + public const string String = "String"; + /// + /// ExpandString value type + /// + public const string ExpandString = "ExpandString"; + /// + /// Binary value type + /// + public const string Binary = "Binary"; + /// + /// DWord value type + /// + public const string DWord = "DWord"; + /// + /// MultiString value type + /// + public const string MultiString = "MultiString"; + /// + /// QWord value type + /// + public const string QWord = "QWord"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Relation.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Relation.cs new file mode 100644 index 0000000000000..ece75207014c3 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Relation.cs @@ -0,0 +1,105 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents a relation between two resources + /// + [Rest.Serialization.JsonTransformation] + public partial class Relation : ResourceWithEtag + { + /// + /// Initializes a new instance of the Relation class. + /// + public Relation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Relation class. + /// + /// The resource ID of the related + /// resource + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Etag of the azure resource + /// The name of the related + /// resource + /// The resource type of the related + /// resource + /// The resource kind of the related + /// resource + public Relation(string relatedResourceId, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string), string relatedResourceName = default(string), string relatedResourceType = default(string), string relatedResourceKind = default(string)) + : base(id, name, type, systemData, etag) + { + RelatedResourceId = relatedResourceId; + RelatedResourceName = relatedResourceName; + RelatedResourceType = relatedResourceType; + RelatedResourceKind = relatedResourceKind; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the resource ID of the related resource + /// + [JsonProperty(PropertyName = "properties.relatedResourceId")] + public string RelatedResourceId { get; set; } + + /// + /// Gets the name of the related resource + /// + [JsonProperty(PropertyName = "properties.relatedResourceName")] + public string RelatedResourceName { get; private set; } + + /// + /// Gets the resource type of the related resource + /// + [JsonProperty(PropertyName = "properties.relatedResourceType")] + public string RelatedResourceType { get; private set; } + + /// + /// Gets the resource kind of the related resource + /// + [JsonProperty(PropertyName = "properties.relatedResourceKind")] + public string RelatedResourceKind { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (RelatedResourceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "RelatedResourceId"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Repo.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Repo.cs new file mode 100644 index 0000000000000..bb4e6ae21c906 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Repo.cs @@ -0,0 +1,69 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents a repository. + /// + public partial class Repo + { + /// + /// Initializes a new instance of the Repo class. + /// + public Repo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Repo class. + /// + /// The url to access the repository. + /// The name of the repository. + /// Array of branches. + public Repo(string url = default(string), string fullName = default(string), IList branches = default(IList)) + { + Url = url; + FullName = fullName; + Branches = branches; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the url to access the repository. + /// + [JsonProperty(PropertyName = "url")] + public string Url { get; set; } + + /// + /// Gets or sets the name of the repository. + /// + [JsonProperty(PropertyName = "fullName")] + public string FullName { get; set; } + + /// + /// Gets or sets array of branches. + /// + [JsonProperty(PropertyName = "branches")] + public IList Branches { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RepoType.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RepoType.cs new file mode 100644 index 0000000000000..f1000048317f5 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RepoType.cs @@ -0,0 +1,22 @@ +// +// 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.Models +{ + + /// + /// Defines values for RepoType. + /// + public static class RepoType + { + public const string Github = "Github"; + public const string DevOps = "DevOps"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Repository.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Repository.cs new file mode 100644 index 0000000000000..1fb4a78bab6f5 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Repository.cs @@ -0,0 +1,88 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// metadata of a repository. + /// + public partial class Repository + { + /// + /// Initializes a new instance of the Repository class. + /// + public Repository() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Repository class. + /// + /// Url of repository. + /// Branch name of repository. + /// Display url of repository. + /// Url to access repository action + /// logs. + /// Dictionary of source control content type + /// and path mapping. + public Repository(string url = default(string), string branch = default(string), string displayUrl = default(string), string deploymentLogsUrl = default(string), IList pathMapping = default(IList)) + { + Url = url; + Branch = branch; + DisplayUrl = displayUrl; + DeploymentLogsUrl = deploymentLogsUrl; + PathMapping = pathMapping; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets url of repository. + /// + [JsonProperty(PropertyName = "url")] + public string Url { get; set; } + + /// + /// Gets or sets branch name of repository. + /// + [JsonProperty(PropertyName = "branch")] + public string Branch { get; set; } + + /// + /// Gets or sets display url of repository. + /// + [JsonProperty(PropertyName = "displayUrl")] + public string DisplayUrl { get; set; } + + /// + /// Gets or sets url to access repository action logs. + /// + [JsonProperty(PropertyName = "deploymentLogsUrl")] + public string DeploymentLogsUrl { get; set; } + + /// + /// Gets or sets dictionary of source control content type and path + /// mapping. + /// + [JsonProperty(PropertyName = "pathMapping")] + public IList PathMapping { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RequiredPermissions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RequiredPermissions.cs new file mode 100644 index 0000000000000..91d9347cfa250 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/RequiredPermissions.cs @@ -0,0 +1,75 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Required permissions for the connector + /// + public partial class RequiredPermissions + { + /// + /// Initializes a new instance of the RequiredPermissions class. + /// + public RequiredPermissions() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RequiredPermissions class. + /// + /// action permission + /// write permission + /// read permission + /// delete permission + public RequiredPermissions(bool? action = default(bool?), bool? write = default(bool?), bool? read = default(bool?), bool? delete = default(bool?)) + { + Action = action; + Write = write; + Read = read; + Delete = delete; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets action permission + /// + [JsonProperty(PropertyName = "action")] + public bool? Action { get; set; } + + /// + /// Gets or sets write permission + /// + [JsonProperty(PropertyName = "write")] + public bool? Write { get; set; } + + /// + /// Gets or sets read permission + /// + [JsonProperty(PropertyName = "read")] + public bool? Read { get; set; } + + /// + /// Gets or sets delete permission + /// + [JsonProperty(PropertyName = "delete")] + public bool? Delete { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Resource.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Resource.cs index d200b48f9b425..650557babf57e 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Resource.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Resource.cs @@ -16,8 +16,12 @@ namespace Microsoft.Azure.Management.SecurityInsights.Models using System.Linq; /// - /// An azure resource object + /// Resource /// + /// + /// Common fields that are returned in the response for all Azure Resource + /// Manager resources + /// public partial class Resource : IResource { /// @@ -31,14 +35,20 @@ public Resource() /// /// Initializes a new instance of the Resource class. /// - /// Azure resource Id - /// Azure resource name - /// Azure resource type - public Resource(string id = default(string), string name = default(string), string type = default(string)) + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + public Resource(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData)) { Id = id; Name = name; Type = type; + SystemData = systemData; CustomInit(); } @@ -48,22 +58,32 @@ public Resource() partial void CustomInit(); /// - /// Gets azure resource Id + /// Gets fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} /// [JsonProperty(PropertyName = "id")] public string Id { get; private set; } /// - /// Gets azure resource name + /// Gets the name of the resource /// [JsonProperty(PropertyName = "name")] public string Name { get; private set; } /// - /// Gets azure resource type + /// Gets the type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" /// [JsonProperty(PropertyName = "type")] public string Type { get; private set; } + /// + /// Gets azure Resource Manager metadata containing createdBy and + /// modifiedBy information. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ResourceProvider.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ResourceProvider.cs new file mode 100644 index 0000000000000..2cc1bce54ecdf --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ResourceProvider.cs @@ -0,0 +1,100 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Resource provider permissions required for the connector + /// + public partial class ResourceProvider + { + /// + /// Initializes a new instance of the ResourceProvider class. + /// + public ResourceProvider() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceProvider class. + /// + /// Provider name. Possible values include: + /// 'Microsoft.OperationalInsights/solutions', + /// 'Microsoft.OperationalInsights/workspaces', + /// 'Microsoft.OperationalInsights/workspaces/datasources', + /// 'microsoft.aadiam/diagnosticSettings', + /// 'Microsoft.OperationalInsights/workspaces/sharedKeys', + /// 'Microsoft.Authorization/policyAssignments' + /// Permission description + /// text + /// Permission provider display + /// name + /// Permission provider scope. Possible values + /// include: 'ResourceGroup', 'Subscription', 'Workspace' + /// Required permissions for the + /// connector + public ResourceProvider(string provider = default(string), string permissionsDisplayText = default(string), string providerDisplayName = default(string), string scope = default(string), RequiredPermissions requiredPermissions = default(RequiredPermissions)) + { + Provider = provider; + PermissionsDisplayText = permissionsDisplayText; + ProviderDisplayName = providerDisplayName; + Scope = scope; + RequiredPermissions = requiredPermissions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets provider name. Possible values include: + /// 'Microsoft.OperationalInsights/solutions', + /// 'Microsoft.OperationalInsights/workspaces', + /// 'Microsoft.OperationalInsights/workspaces/datasources', + /// 'microsoft.aadiam/diagnosticSettings', + /// 'Microsoft.OperationalInsights/workspaces/sharedKeys', + /// 'Microsoft.Authorization/policyAssignments' + /// + [JsonProperty(PropertyName = "provider")] + public string Provider { get; set; } + + /// + /// Gets or sets permission description text + /// + [JsonProperty(PropertyName = "permissionsDisplayText")] + public string PermissionsDisplayText { get; set; } + + /// + /// Gets or sets permission provider display name + /// + [JsonProperty(PropertyName = "providerDisplayName")] + public string ProviderDisplayName { get; set; } + + /// + /// Gets or sets permission provider scope. Possible values include: + /// 'ResourceGroup', 'Subscription', 'Workspace' + /// + [JsonProperty(PropertyName = "scope")] + public string Scope { get; set; } + + /// + /// Gets or sets required permissions for the connector + /// + [JsonProperty(PropertyName = "requiredPermissions")] + public RequiredPermissions RequiredPermissions { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ResourceWithEtag.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ResourceWithEtag.cs index 16b8a40cb14bc..06227e57b6b53 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ResourceWithEtag.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ResourceWithEtag.cs @@ -10,15 +10,13 @@ namespace Microsoft.Azure.Management.SecurityInsights.Models { - using Microsoft.Rest; - using Microsoft.Rest.Azure; using Newtonsoft.Json; using System.Linq; /// /// An azure resource object with an Etag property /// - public partial class ResourceWithEtag : IResource + public partial class ResourceWithEtag : Resource { /// /// Initializes a new instance of the ResourceWithEtag class. @@ -31,15 +29,18 @@ public ResourceWithEtag() /// /// Initializes a new instance of the ResourceWithEtag class. /// - /// Azure resource Id - /// Azure resource name - /// Azure resource type + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. /// Etag of the azure resource - public ResourceWithEtag(string id = default(string), string name = default(string), string type = default(string), string etag = default(string)) + public ResourceWithEtag(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string)) + : base(id, name, type, systemData) { - Id = id; - Name = name; - Type = type; Etag = etag; CustomInit(); } @@ -49,24 +50,6 @@ public ResourceWithEtag() /// partial void CustomInit(); - /// - /// Gets azure resource Id - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } - - /// - /// Gets azure resource name - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } - - /// - /// Gets azure resource type - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } - /// /// Gets or sets etag of the azure resource /// diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SampleQueries.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SampleQueries.cs new file mode 100644 index 0000000000000..aa70cec53c767 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SampleQueries.cs @@ -0,0 +1,59 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The sample queries for the connector + /// + public partial class SampleQueries + { + /// + /// Initializes a new instance of the SampleQueries class. + /// + public SampleQueries() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SampleQueries class. + /// + /// The sample query description + /// the sample query + public SampleQueries(string description = default(string), string query = default(string)) + { + Description = description; + Query = query; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the sample query description + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets the sample query + /// + [JsonProperty(PropertyName = "query")] + public string Query { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ScheduledAlertRule.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ScheduledAlertRule.cs index cc53fa1d1090a..1f01349a721e8 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ScheduledAlertRule.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ScheduledAlertRule.cs @@ -35,6 +35,17 @@ public ScheduledAlertRule() /// /// Initializes a new instance of the ScheduledAlertRule class. /// + /// The frequency (in ISO 8601 duration + /// format) for this alert rule to run. + /// The period (in ISO 8601 duration format) + /// that this alert rule looks at. + /// The operation against the threshold + /// that triggers alert rule. Possible values include: 'GreaterThan', + /// 'LessThan', 'Equal', 'NotEqual' + /// The threshold triggers this alert + /// rule. + /// The query that creates alerts for this + /// rule. /// The display name for alerts created by /// this alert rule. /// Determines whether this alert rule is enabled @@ -44,48 +55,61 @@ public ScheduledAlertRule() /// triggered. /// Determines whether the suppression /// for this alert rule is enabled or disabled. - /// Azure resource Id - /// Azure resource name - /// Azure resource type - /// Etag of the azure resource - /// The query that creates alerts for this - /// rule. - /// The frequency (in ISO 8601 duration - /// format) for this alert rule to run. - /// The period (in ISO 8601 duration format) - /// that this alert rule looks at. /// The severity for alerts created by this /// alert rule. Possible values include: 'High', 'Medium', 'Low', /// 'Informational' - /// The operation against the threshold - /// that triggers alert rule. Possible values include: 'GreaterThan', - /// 'LessThan', 'Equal', 'NotEqual' - /// The threshold triggers this alert - /// rule. + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Etag of the azure resource + /// The event grouping + /// settings. /// The Name of the alert rule /// template used to create this rule. + /// The version of the alert rule + /// template used to create this rule - in format <a.b.c>, where + /// all are numbers, for example 0 <1.0.2> /// The description of the alert /// rule. /// The last time that this alert rule /// has been modified. /// The tactics of the alert rule - public ScheduledAlertRule(string displayName, bool enabled, System.TimeSpan suppressionDuration, bool suppressionEnabled, string id = default(string), string name = default(string), string type = default(string), string etag = default(string), string query = default(string), System.TimeSpan? queryFrequency = default(System.TimeSpan?), System.TimeSpan? queryPeriod = default(System.TimeSpan?), string severity = default(string), TriggerOperator? triggerOperator = default(TriggerOperator?), int? triggerThreshold = default(int?), string alertRuleTemplateName = default(string), string description = default(string), System.DateTime? lastModifiedUtc = default(System.DateTime?), IList tactics = default(IList)) - : base(id, name, type, etag) + /// The settings of the incidents + /// that created from alerts triggered by this analytics rule + /// Dictionary of string key-value pairs of + /// columns to be attached to the alert + /// Array of the entity mappings of the + /// alert rule + /// The alert details override + /// settings + public ScheduledAlertRule(System.TimeSpan queryFrequency, System.TimeSpan queryPeriod, TriggerOperator triggerOperator, int triggerThreshold, string query, string displayName, bool enabled, System.TimeSpan suppressionDuration, bool suppressionEnabled, string severity, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string), EventGroupingSettings eventGroupingSettings = default(EventGroupingSettings), string alertRuleTemplateName = default(string), string templateVersion = default(string), string description = default(string), System.DateTime? lastModifiedUtc = default(System.DateTime?), IList tactics = default(IList), IncidentConfiguration incidentConfiguration = default(IncidentConfiguration), IDictionary customDetails = default(IDictionary), IList entityMappings = default(IList), AlertDetailsOverride alertDetailsOverride = default(AlertDetailsOverride)) + : base(id, name, type, systemData, etag) { - Query = query; QueryFrequency = queryFrequency; QueryPeriod = queryPeriod; - Severity = severity; TriggerOperator = triggerOperator; TriggerThreshold = triggerThreshold; + EventGroupingSettings = eventGroupingSettings; AlertRuleTemplateName = alertRuleTemplateName; + TemplateVersion = templateVersion; Description = description; + Query = query; DisplayName = displayName; Enabled = enabled; LastModifiedUtc = lastModifiedUtc; SuppressionDuration = suppressionDuration; SuppressionEnabled = suppressionEnabled; + Severity = severity; Tactics = tactics; + IncidentConfiguration = incidentConfiguration; + CustomDetails = customDetails; + EntityMappings = entityMappings; + AlertDetailsOverride = alertDetailsOverride; CustomInit(); } @@ -94,32 +118,19 @@ public ScheduledAlertRule() /// partial void CustomInit(); - /// - /// Gets or sets the query that creates alerts for this rule. - /// - [JsonProperty(PropertyName = "properties.query")] - public string Query { get; set; } - /// /// Gets or sets the frequency (in ISO 8601 duration format) for this /// alert rule to run. /// [JsonProperty(PropertyName = "properties.queryFrequency")] - public System.TimeSpan? QueryFrequency { get; set; } + public System.TimeSpan QueryFrequency { get; set; } /// /// Gets or sets the period (in ISO 8601 duration format) that this /// alert rule looks at. /// [JsonProperty(PropertyName = "properties.queryPeriod")] - public System.TimeSpan? QueryPeriod { get; set; } - - /// - /// Gets or sets the severity for alerts created by this alert rule. - /// Possible values include: 'High', 'Medium', 'Low', 'Informational' - /// - [JsonProperty(PropertyName = "properties.severity")] - public string Severity { get; set; } + public System.TimeSpan QueryPeriod { get; set; } /// /// Gets or sets the operation against the threshold that triggers @@ -127,13 +138,19 @@ public ScheduledAlertRule() /// 'Equal', 'NotEqual' /// [JsonProperty(PropertyName = "properties.triggerOperator")] - public TriggerOperator? TriggerOperator { get; set; } + public TriggerOperator TriggerOperator { get; set; } /// /// Gets or sets the threshold triggers this alert rule. /// [JsonProperty(PropertyName = "properties.triggerThreshold")] - public int? TriggerThreshold { get; set; } + public int TriggerThreshold { get; set; } + + /// + /// Gets or sets the event grouping settings. + /// + [JsonProperty(PropertyName = "properties.eventGroupingSettings")] + public EventGroupingSettings EventGroupingSettings { get; set; } /// /// Gets or sets the Name of the alert rule template used to create @@ -142,12 +159,26 @@ public ScheduledAlertRule() [JsonProperty(PropertyName = "properties.alertRuleTemplateName")] public string AlertRuleTemplateName { get; set; } + /// + /// Gets or sets the version of the alert rule template used to create + /// this rule - in format &lt;a.b.c&gt;, where all are numbers, + /// for example 0 &lt;1.0.2&gt; + /// + [JsonProperty(PropertyName = "properties.templateVersion")] + public string TemplateVersion { get; set; } + /// /// Gets or sets the description of the alert rule. /// [JsonProperty(PropertyName = "properties.description")] public string Description { get; set; } + /// + /// Gets or sets the query that creates alerts for this rule. + /// + [JsonProperty(PropertyName = "properties.query")] + public string Query { get; set; } + /// /// Gets or sets the display name for alerts created by this alert /// rule. @@ -182,12 +213,45 @@ public ScheduledAlertRule() [JsonProperty(PropertyName = "properties.suppressionEnabled")] public bool SuppressionEnabled { get; set; } + /// + /// Gets or sets the severity for alerts created by this alert rule. + /// Possible values include: 'High', 'Medium', 'Low', 'Informational' + /// + [JsonProperty(PropertyName = "properties.severity")] + public string Severity { get; set; } + /// /// Gets or sets the tactics of the alert rule /// [JsonProperty(PropertyName = "properties.tactics")] public IList Tactics { get; set; } + /// + /// Gets or sets the settings of the incidents that created from alerts + /// triggered by this analytics rule + /// + [JsonProperty(PropertyName = "properties.incidentConfiguration")] + public IncidentConfiguration IncidentConfiguration { get; set; } + + /// + /// Gets or sets dictionary of string key-value pairs of columns to be + /// attached to the alert + /// + [JsonProperty(PropertyName = "properties.customDetails")] + public IDictionary CustomDetails { get; set; } + + /// + /// Gets or sets array of the entity mappings of the alert rule + /// + [JsonProperty(PropertyName = "properties.entityMappings")] + public IList EntityMappings { get; set; } + + /// + /// Gets or sets the alert details override settings + /// + [JsonProperty(PropertyName = "properties.alertDetailsOverride")] + public AlertDetailsOverride AlertDetailsOverride { get; set; } + /// /// Validate the object. /// @@ -196,10 +260,22 @@ public ScheduledAlertRule() /// public virtual void Validate() { + if (Query == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Query"); + } if (DisplayName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "DisplayName"); } + if (Severity == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Severity"); + } + if (IncidentConfiguration != null) + { + IncidentConfiguration.Validate(); + } } } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ScheduledAlertRuleCommonProperties.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ScheduledAlertRuleCommonProperties.cs index 028dfc8a8eac0..321288f6cb519 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ScheduledAlertRuleCommonProperties.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ScheduledAlertRuleCommonProperties.cs @@ -14,7 +14,7 @@ namespace Microsoft.Azure.Management.SecurityInsights.Models using System.Linq; /// - /// Schedule alert rule template property bag. + /// Scheduled alert rule template property bag. /// public partial class ScheduledAlertRuleCommonProperties { @@ -31,28 +31,24 @@ public ScheduledAlertRuleCommonProperties() /// Initializes a new instance of the /// ScheduledAlertRuleCommonProperties class. /// - /// The query that creates alerts for this - /// rule. /// The frequency (in ISO 8601 duration /// format) for this alert rule to run. /// The period (in ISO 8601 duration format) /// that this alert rule looks at. - /// The severity for alerts created by this - /// alert rule. Possible values include: 'High', 'Medium', 'Low', - /// 'Informational' /// The operation against the threshold /// that triggers alert rule. Possible values include: 'GreaterThan', /// 'LessThan', 'Equal', 'NotEqual' /// The threshold triggers this alert /// rule. - public ScheduledAlertRuleCommonProperties(string query = default(string), System.TimeSpan? queryFrequency = default(System.TimeSpan?), System.TimeSpan? queryPeriod = default(System.TimeSpan?), string severity = default(string), TriggerOperator? triggerOperator = default(TriggerOperator?), int? triggerThreshold = default(int?)) + /// The event grouping + /// settings. + public ScheduledAlertRuleCommonProperties(System.TimeSpan? queryFrequency = default(System.TimeSpan?), System.TimeSpan? queryPeriod = default(System.TimeSpan?), TriggerOperator? triggerOperator = default(TriggerOperator?), int? triggerThreshold = default(int?), EventGroupingSettings eventGroupingSettings = default(EventGroupingSettings)) { - Query = query; QueryFrequency = queryFrequency; QueryPeriod = queryPeriod; - Severity = severity; TriggerOperator = triggerOperator; TriggerThreshold = triggerThreshold; + EventGroupingSettings = eventGroupingSettings; CustomInit(); } @@ -61,12 +57,6 @@ public ScheduledAlertRuleCommonProperties() /// partial void CustomInit(); - /// - /// Gets or sets the query that creates alerts for this rule. - /// - [JsonProperty(PropertyName = "query")] - public string Query { get; set; } - /// /// Gets or sets the frequency (in ISO 8601 duration format) for this /// alert rule to run. @@ -81,13 +71,6 @@ public ScheduledAlertRuleCommonProperties() [JsonProperty(PropertyName = "queryPeriod")] public System.TimeSpan? QueryPeriod { get; set; } - /// - /// Gets or sets the severity for alerts created by this alert rule. - /// Possible values include: 'High', 'Medium', 'Low', 'Informational' - /// - [JsonProperty(PropertyName = "severity")] - public string Severity { get; set; } - /// /// Gets or sets the operation against the threshold that triggers /// alert rule. Possible values include: 'GreaterThan', 'LessThan', @@ -102,5 +85,11 @@ public ScheduledAlertRuleCommonProperties() [JsonProperty(PropertyName = "triggerThreshold")] public int? TriggerThreshold { get; set; } + /// + /// Gets or sets the event grouping settings. + /// + [JsonProperty(PropertyName = "eventGroupingSettings")] + public EventGroupingSettings EventGroupingSettings { get; set; } + } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ScheduledAlertRuleTemplate.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ScheduledAlertRuleTemplate.cs index 5308116350d2d..5f92ec9eb2d1f 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ScheduledAlertRuleTemplate.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ScheduledAlertRuleTemplate.cs @@ -35,53 +35,76 @@ public ScheduledAlertRuleTemplate() /// /// Initializes a new instance of the ScheduledAlertRuleTemplate class. /// - /// Azure resource Id - /// Azure resource name - /// Azure resource type /// the number of alert /// rules that were created by this template - /// The time that this alert rule template - /// has been added. /// The description of the alert rule /// template. /// The display name for alert rule /// template. - /// The required data connectors - /// for this template /// The alert rule template status. Possible /// values include: 'Installed', 'Available', 'NotAvailable' /// The query that creates alerts for this /// rule. + /// The severity for alerts created by this + /// alert rule. Possible values include: 'High', 'Medium', 'Low', + /// 'Informational' + /// The version of this template - in format + /// <a.b.c>, where all are numbers. For example + /// <1.0.2>. /// The frequency (in ISO 8601 duration /// format) for this alert rule to run. /// The period (in ISO 8601 duration format) /// that this alert rule looks at. - /// The severity for alerts created by this - /// alert rule. Possible values include: 'High', 'Medium', 'Low', - /// 'Informational' /// The operation against the threshold /// that triggers alert rule. Possible values include: 'GreaterThan', /// 'LessThan', 'Equal', 'NotEqual' /// The threshold triggers this alert /// rule. - /// The tactics of the alert rule - /// template - public ScheduledAlertRuleTemplate(string id = default(string), string name = default(string), string type = default(string), int? alertRulesCreatedByTemplateCount = default(int?), System.DateTime? createdDateUTC = default(System.DateTime?), string description = default(string), string displayName = default(string), IList requiredDataConnectors = default(IList), string status = default(string), string query = default(string), System.TimeSpan? queryFrequency = default(System.TimeSpan?), System.TimeSpan? queryPeriod = default(System.TimeSpan?), string severity = default(string), TriggerOperator? triggerOperator = default(TriggerOperator?), int? triggerThreshold = default(int?), IList tactics = default(IList)) - : base(id, name, type) + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// The last time that this alert rule + /// template has been updated. + /// The time that this alert rule template + /// has been added. + /// The required data sources for + /// this template + /// The tactics of the alert rule + /// Dictionary of string key-value pairs of + /// columns to be attached to the alert + /// Array of the entity mappings of the + /// alert rule + /// The alert details override + /// settings + /// The event grouping + /// settings. + public ScheduledAlertRuleTemplate(int alertRulesCreatedByTemplateCount, string description, string displayName, string status, string query, string severity, string version, System.TimeSpan queryFrequency, System.TimeSpan queryPeriod, TriggerOperator triggerOperator, int triggerThreshold, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), System.DateTime? lastUpdatedDateUTC = default(System.DateTime?), System.DateTime? createdDateUTC = default(System.DateTime?), IList requiredDataConnectors = default(IList), IList tactics = default(IList), IDictionary customDetails = default(IDictionary), IList entityMappings = default(IList), AlertDetailsOverride alertDetailsOverride = default(AlertDetailsOverride), EventGroupingSettings eventGroupingSettings = default(EventGroupingSettings)) + : base(id, name, type, systemData) { AlertRulesCreatedByTemplateCount = alertRulesCreatedByTemplateCount; + LastUpdatedDateUTC = lastUpdatedDateUTC; CreatedDateUTC = createdDateUTC; Description = description; DisplayName = displayName; RequiredDataConnectors = requiredDataConnectors; Status = status; Query = query; + Severity = severity; + Tactics = tactics; + Version = version; + CustomDetails = customDetails; + EntityMappings = entityMappings; + AlertDetailsOverride = alertDetailsOverride; QueryFrequency = queryFrequency; QueryPeriod = queryPeriod; - Severity = severity; TriggerOperator = triggerOperator; TriggerThreshold = triggerThreshold; - Tactics = tactics; + EventGroupingSettings = eventGroupingSettings; CustomInit(); } @@ -95,7 +118,13 @@ public ScheduledAlertRuleTemplate() /// template /// [JsonProperty(PropertyName = "properties.alertRulesCreatedByTemplateCount")] - public int? AlertRulesCreatedByTemplateCount { get; set; } + public int AlertRulesCreatedByTemplateCount { get; set; } + + /// + /// Gets the last time that this alert rule template has been updated. + /// + [JsonProperty(PropertyName = "properties.lastUpdatedDateUTC")] + public System.DateTime? LastUpdatedDateUTC { get; private set; } /// /// Gets the time that this alert rule template has been added. @@ -116,7 +145,7 @@ public ScheduledAlertRuleTemplate() public string DisplayName { get; set; } /// - /// Gets or sets the required data connectors for this template + /// Gets or sets the required data sources for this template /// [JsonProperty(PropertyName = "properties.requiredDataConnectors")] public IList RequiredDataConnectors { get; set; } @@ -134,26 +163,59 @@ public ScheduledAlertRuleTemplate() [JsonProperty(PropertyName = "properties.query")] public string Query { get; set; } + /// + /// Gets or sets the severity for alerts created by this alert rule. + /// Possible values include: 'High', 'Medium', 'Low', 'Informational' + /// + [JsonProperty(PropertyName = "properties.severity")] + public string Severity { get; set; } + + /// + /// Gets or sets the tactics of the alert rule + /// + [JsonProperty(PropertyName = "properties.tactics")] + public IList Tactics { get; set; } + + /// + /// Gets or sets the version of this template - in format + /// &lt;a.b.c&gt;, where all are numbers. For example + /// &lt;1.0.2&gt;. + /// + [JsonProperty(PropertyName = "properties.version")] + public string Version { get; set; } + + /// + /// Gets or sets dictionary of string key-value pairs of columns to be + /// attached to the alert + /// + [JsonProperty(PropertyName = "properties.customDetails")] + public IDictionary CustomDetails { get; set; } + + /// + /// Gets or sets array of the entity mappings of the alert rule + /// + [JsonProperty(PropertyName = "properties.entityMappings")] + public IList EntityMappings { get; set; } + + /// + /// Gets or sets the alert details override settings + /// + [JsonProperty(PropertyName = "properties.alertDetailsOverride")] + public AlertDetailsOverride AlertDetailsOverride { get; set; } + /// /// Gets or sets the frequency (in ISO 8601 duration format) for this /// alert rule to run. /// [JsonProperty(PropertyName = "properties.queryFrequency")] - public System.TimeSpan? QueryFrequency { get; set; } + public System.TimeSpan QueryFrequency { get; set; } /// /// Gets or sets the period (in ISO 8601 duration format) that this /// alert rule looks at. /// [JsonProperty(PropertyName = "properties.queryPeriod")] - public System.TimeSpan? QueryPeriod { get; set; } - - /// - /// Gets or sets the severity for alerts created by this alert rule. - /// Possible values include: 'High', 'Medium', 'Low', 'Informational' - /// - [JsonProperty(PropertyName = "properties.severity")] - public string Severity { get; set; } + public System.TimeSpan QueryPeriod { get; set; } /// /// Gets or sets the operation against the threshold that triggers @@ -161,19 +223,52 @@ public ScheduledAlertRuleTemplate() /// 'Equal', 'NotEqual' /// [JsonProperty(PropertyName = "properties.triggerOperator")] - public TriggerOperator? TriggerOperator { get; set; } + public TriggerOperator TriggerOperator { get; set; } /// /// Gets or sets the threshold triggers this alert rule. /// [JsonProperty(PropertyName = "properties.triggerThreshold")] - public int? TriggerThreshold { get; set; } + public int TriggerThreshold { get; set; } /// - /// Gets or sets the tactics of the alert rule template + /// Gets or sets the event grouping settings. /// - [JsonProperty(PropertyName = "properties.tactics")] - public IList Tactics { get; set; } + [JsonProperty(PropertyName = "properties.eventGroupingSettings")] + public EventGroupingSettings EventGroupingSettings { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Description == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Description"); + } + if (DisplayName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DisplayName"); + } + if (Status == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Status"); + } + if (Query == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Query"); + } + if (Severity == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Severity"); + } + if (Version == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Version"); + } + } } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SecurityAlert.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SecurityAlert.cs new file mode 100644 index 0000000000000..b739518403f8a --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SecurityAlert.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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents a security alert entity. + /// + [Rest.Serialization.JsonTransformation] + public partial class SecurityAlert : Entity + { + /// + /// Initializes a new instance of the SecurityAlert class. + /// + public SecurityAlert() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SecurityAlert class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// A bag of custom fields that should be + /// part of the entity and will be presented to the user. + /// The graph item display name which is a + /// short humanly readable description of the graph item instance. This + /// property is optional and might be system generated. + /// The display name of the + /// alert. + /// The type name of the alert. + /// Display name of the main entity + /// being reported on. + /// The confidence level of this alert. + /// Possible values include: 'Unknown', 'Low', 'High' + /// The confidence reasons + /// The confidence score of the + /// alert. + /// The confidence score + /// calculation status, i.e. indicating if score calculation is pending + /// for this alert, not applicable or final. Possible values include: + /// 'NotApplicable', 'InProcess', 'NotFinal', 'Final' + /// Alert description. + /// The impact end time of the alert (the time + /// of the last event contributing to the alert). + /// Holds the alert intent stage(s) mapping for + /// this alert. Possible values include: 'Unknown', 'Probing', + /// 'Exploitation', 'Persistence', 'PrivilegeEscalation', + /// 'DefenseEvasion', 'CredentialAccess', 'Discovery', + /// 'LateralMovement', 'Execution', 'Collection', 'Exfiltration', + /// 'CommandAndControl', 'Impact' + /// The identifier of the alert inside + /// the product which generated the alert. + /// The time the alert was made + /// available for consumption. + /// The name of a component inside + /// the product which generated the alert. + /// The name of the product which published + /// this alert. + /// The version of the product generating + /// the alert. + /// Manual action items to take to + /// remediate the alert. + /// The severity of the alert. Possible values + /// include: 'High', 'Medium', 'Low', 'Informational' + /// The impact start time of the alert (the + /// time of the first event contributing to the alert). + /// The lifecycle status of the alert. Possible + /// values include: 'Unknown', 'New', 'Resolved', 'Dismissed', + /// 'InProgress' + /// Holds the product identifier of the + /// alert for the product. + /// The tactics of the alert + /// The time the alert was + /// generated. + /// The name of the vendor that raise the + /// alert. + /// The uri link of the alert. + /// The list of resource identifiers + /// of the alert. + public SecurityAlert(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary additionalData = default(IDictionary), string friendlyName = default(string), string alertDisplayName = default(string), string alertType = default(string), string compromisedEntity = default(string), string confidenceLevel = default(string), IList confidenceReasons = default(IList), double? confidenceScore = default(double?), string confidenceScoreStatus = default(string), string description = default(string), System.DateTime? endTimeUtc = default(System.DateTime?), string intent = default(string), string providerAlertId = default(string), System.DateTime? processingEndTime = default(System.DateTime?), string productComponentName = default(string), string productName = default(string), string productVersion = default(string), IList remediationSteps = default(IList), string severity = default(string), System.DateTime? startTimeUtc = default(System.DateTime?), string status = default(string), string systemAlertId = default(string), IList tactics = default(IList), System.DateTime? timeGenerated = default(System.DateTime?), string vendorName = default(string), string alertLink = default(string), IList resourceIdentifiers = default(IList)) + : base(id, name, type, systemData) + { + AdditionalData = additionalData; + FriendlyName = friendlyName; + AlertDisplayName = alertDisplayName; + AlertType = alertType; + CompromisedEntity = compromisedEntity; + ConfidenceLevel = confidenceLevel; + ConfidenceReasons = confidenceReasons; + ConfidenceScore = confidenceScore; + ConfidenceScoreStatus = confidenceScoreStatus; + Description = description; + EndTimeUtc = endTimeUtc; + Intent = intent; + ProviderAlertId = providerAlertId; + ProcessingEndTime = processingEndTime; + ProductComponentName = productComponentName; + ProductName = productName; + ProductVersion = productVersion; + RemediationSteps = remediationSteps; + Severity = severity; + StartTimeUtc = startTimeUtc; + Status = status; + SystemAlertId = systemAlertId; + Tactics = tactics; + TimeGenerated = timeGenerated; + VendorName = vendorName; + AlertLink = alertLink; + ResourceIdentifiers = resourceIdentifiers; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a bag of custom fields that should be part of the entity and + /// will be presented to the user. + /// + [JsonProperty(PropertyName = "properties.additionalData")] + public IDictionary AdditionalData { get; private set; } + + /// + /// Gets the graph item display name which is a short humanly readable + /// description of the graph item instance. This property is optional + /// and might be system generated. + /// + [JsonProperty(PropertyName = "properties.friendlyName")] + public string FriendlyName { get; private set; } + + /// + /// Gets the display name of the alert. + /// + [JsonProperty(PropertyName = "properties.alertDisplayName")] + public string AlertDisplayName { get; private set; } + + /// + /// Gets the type name of the alert. + /// + [JsonProperty(PropertyName = "properties.alertType")] + public string AlertType { get; private set; } + + /// + /// Gets display name of the main entity being reported on. + /// + [JsonProperty(PropertyName = "properties.compromisedEntity")] + public string CompromisedEntity { get; private set; } + + /// + /// Gets the confidence level of this alert. Possible values include: + /// 'Unknown', 'Low', 'High' + /// + [JsonProperty(PropertyName = "properties.confidenceLevel")] + public string ConfidenceLevel { get; private set; } + + /// + /// Gets the confidence reasons + /// + [JsonProperty(PropertyName = "properties.confidenceReasons")] + public IList ConfidenceReasons { get; private set; } + + /// + /// Gets the confidence score of the alert. + /// + [JsonProperty(PropertyName = "properties.confidenceScore")] + public double? ConfidenceScore { get; private set; } + + /// + /// Gets the confidence score calculation status, i.e. indicating if + /// score calculation is pending for this alert, not applicable or + /// final. Possible values include: 'NotApplicable', 'InProcess', + /// 'NotFinal', 'Final' + /// + [JsonProperty(PropertyName = "properties.confidenceScoreStatus")] + public string ConfidenceScoreStatus { get; private set; } + + /// + /// Gets alert description. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; private set; } + + /// + /// Gets the impact end time of the alert (the time of the last event + /// contributing to the alert). + /// + [JsonProperty(PropertyName = "properties.endTimeUtc")] + public System.DateTime? EndTimeUtc { get; private set; } + + /// + /// Gets holds the alert intent stage(s) mapping for this alert. + /// Possible values include: 'Unknown', 'Probing', 'Exploitation', + /// 'Persistence', 'PrivilegeEscalation', 'DefenseEvasion', + /// 'CredentialAccess', 'Discovery', 'LateralMovement', 'Execution', + /// 'Collection', 'Exfiltration', 'CommandAndControl', 'Impact' + /// + [JsonProperty(PropertyName = "properties.intent")] + public string Intent { get; private set; } + + /// + /// Gets the identifier of the alert inside the product which generated + /// the alert. + /// + [JsonProperty(PropertyName = "properties.providerAlertId")] + public string ProviderAlertId { get; private set; } + + /// + /// Gets the time the alert was made available for consumption. + /// + [JsonProperty(PropertyName = "properties.processingEndTime")] + public System.DateTime? ProcessingEndTime { get; private set; } + + /// + /// Gets the name of a component inside the product which generated the + /// alert. + /// + [JsonProperty(PropertyName = "properties.productComponentName")] + public string ProductComponentName { get; private set; } + + /// + /// Gets the name of the product which published this alert. + /// + [JsonProperty(PropertyName = "properties.productName")] + public string ProductName { get; private set; } + + /// + /// Gets the version of the product generating the alert. + /// + [JsonProperty(PropertyName = "properties.productVersion")] + public string ProductVersion { get; private set; } + + /// + /// Gets manual action items to take to remediate the alert. + /// + [JsonProperty(PropertyName = "properties.remediationSteps")] + public IList RemediationSteps { get; private set; } + + /// + /// Gets or sets the severity of the alert. Possible values include: + /// 'High', 'Medium', 'Low', 'Informational' + /// + [JsonProperty(PropertyName = "properties.severity")] + public string Severity { get; set; } + + /// + /// Gets the impact start time of the alert (the time of the first + /// event contributing to the alert). + /// + [JsonProperty(PropertyName = "properties.startTimeUtc")] + public System.DateTime? StartTimeUtc { get; private set; } + + /// + /// Gets the lifecycle status of the alert. Possible values include: + /// 'Unknown', 'New', 'Resolved', 'Dismissed', 'InProgress' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; private set; } + + /// + /// Gets holds the product identifier of the alert for the product. + /// + [JsonProperty(PropertyName = "properties.systemAlertId")] + public string SystemAlertId { get; private set; } + + /// + /// Gets the tactics of the alert + /// + [JsonProperty(PropertyName = "properties.tactics")] + public IList Tactics { get; private set; } + + /// + /// Gets the time the alert was generated. + /// + [JsonProperty(PropertyName = "properties.timeGenerated")] + public System.DateTime? TimeGenerated { get; private set; } + + /// + /// Gets the name of the vendor that raise the alert. + /// + [JsonProperty(PropertyName = "properties.vendorName")] + public string VendorName { get; private set; } + + /// + /// Gets the uri link of the alert. + /// + [JsonProperty(PropertyName = "properties.alertLink")] + public string AlertLink { get; private set; } + + /// + /// Gets the list of resource identifiers of the alert. + /// + [JsonProperty(PropertyName = "properties.resourceIdentifiers")] + public IList ResourceIdentifiers { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SecurityAlertPropertiesConfidenceReasonsItem.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SecurityAlertPropertiesConfidenceReasonsItem.cs new file mode 100644 index 0000000000000..8abc0caf73252 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SecurityAlertPropertiesConfidenceReasonsItem.cs @@ -0,0 +1,61 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// confidence reason item + /// + public partial class SecurityAlertPropertiesConfidenceReasonsItem + { + /// + /// Initializes a new instance of the + /// SecurityAlertPropertiesConfidenceReasonsItem class. + /// + public SecurityAlertPropertiesConfidenceReasonsItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// SecurityAlertPropertiesConfidenceReasonsItem class. + /// + /// The reason's description + /// The type (category) of the reason + public SecurityAlertPropertiesConfidenceReasonsItem(string reason = default(string), string reasonType = default(string)) + { + Reason = reason; + ReasonType = reasonType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the reason's description + /// + [JsonProperty(PropertyName = "reason")] + public string Reason { get; private set; } + + /// + /// Gets the type (category) of the reason + /// + [JsonProperty(PropertyName = "reasonType")] + public string ReasonType { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SecurityAlertTimelineItem.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SecurityAlertTimelineItem.cs new file mode 100644 index 0000000000000..76eecbbfbd76a --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SecurityAlertTimelineItem.cs @@ -0,0 +1,144 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents security alert timeline item. + /// + [Newtonsoft.Json.JsonObject("SecurityAlert")] + public partial class SecurityAlertTimelineItem : EntityTimelineItem + { + /// + /// Initializes a new instance of the SecurityAlertTimelineItem class. + /// + public SecurityAlertTimelineItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SecurityAlertTimelineItem class. + /// + /// The alert azure resource id. + /// The alert name. + /// The alert severity. Possible values include: + /// 'High', 'Medium', 'Low', 'Informational' + /// The alert end time. + /// The alert start time. + /// The alert generated time. + /// The name of the alert type. + /// The alert product name. + /// The alert description. + public SecurityAlertTimelineItem(string azureResourceId, string displayName, string severity, System.DateTime endTimeUtc, System.DateTime startTimeUtc, System.DateTime timeGenerated, string alertType, string productName = default(string), string description = default(string)) + { + AzureResourceId = azureResourceId; + ProductName = productName; + Description = description; + DisplayName = displayName; + Severity = severity; + EndTimeUtc = endTimeUtc; + StartTimeUtc = startTimeUtc; + TimeGenerated = timeGenerated; + AlertType = alertType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the alert azure resource id. + /// + [JsonProperty(PropertyName = "azureResourceId")] + public string AzureResourceId { get; set; } + + /// + /// Gets or sets the alert product name. + /// + [JsonProperty(PropertyName = "productName")] + public string ProductName { get; set; } + + /// + /// Gets or sets the alert description. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets the alert name. + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets the alert severity. Possible values include: 'High', + /// 'Medium', 'Low', 'Informational' + /// + [JsonProperty(PropertyName = "severity")] + public string Severity { get; set; } + + /// + /// Gets or sets the alert end time. + /// + [JsonProperty(PropertyName = "endTimeUtc")] + public System.DateTime EndTimeUtc { get; set; } + + /// + /// Gets or sets the alert start time. + /// + [JsonProperty(PropertyName = "startTimeUtc")] + public System.DateTime StartTimeUtc { get; set; } + + /// + /// Gets or sets the alert generated time. + /// + [JsonProperty(PropertyName = "timeGenerated")] + public System.DateTime TimeGenerated { get; set; } + + /// + /// Gets or sets the name of the alert type. + /// + [JsonProperty(PropertyName = "alertType")] + public string AlertType { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (AzureResourceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AzureResourceId"); + } + if (DisplayName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DisplayName"); + } + if (Severity == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Severity"); + } + if (AlertType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AlertType"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SecurityGroupEntity.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SecurityGroupEntity.cs new file mode 100644 index 0000000000000..3bf63df902af4 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SecurityGroupEntity.cs @@ -0,0 +1,110 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents a security group entity. + /// + [Newtonsoft.Json.JsonObject("SecurityGroup")] + [Rest.Serialization.JsonTransformation] + public partial class SecurityGroupEntity : Entity + { + /// + /// Initializes a new instance of the SecurityGroupEntity class. + /// + public SecurityGroupEntity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SecurityGroupEntity class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// A bag of custom fields that should be + /// part of the entity and will be presented to the user. + /// The graph item display name which is a + /// short humanly readable description of the graph item instance. This + /// property is optional and might be system generated. + /// The group distinguished + /// name + /// A single-value attribute that is the + /// unique identifier for the object, assigned by active + /// directory. + /// The SID attribute is a single-value attribute + /// that specifies the security identifier (SID) of the group + public SecurityGroupEntity(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary additionalData = default(IDictionary), string friendlyName = default(string), string distinguishedName = default(string), System.Guid? objectGuid = default(System.Guid?), string sid = default(string)) + : base(id, name, type, systemData) + { + AdditionalData = additionalData; + FriendlyName = friendlyName; + DistinguishedName = distinguishedName; + ObjectGuid = objectGuid; + Sid = sid; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a bag of custom fields that should be part of the entity and + /// will be presented to the user. + /// + [JsonProperty(PropertyName = "properties.additionalData")] + public IDictionary AdditionalData { get; private set; } + + /// + /// Gets the graph item display name which is a short humanly readable + /// description of the graph item instance. This property is optional + /// and might be system generated. + /// + [JsonProperty(PropertyName = "properties.friendlyName")] + public string FriendlyName { get; private set; } + + /// + /// Gets the group distinguished name + /// + [JsonProperty(PropertyName = "properties.distinguishedName")] + public string DistinguishedName { get; private set; } + + /// + /// Gets a single-value attribute that is the unique identifier for the + /// object, assigned by active directory. + /// + [JsonProperty(PropertyName = "properties.objectGuid")] + public System.Guid? ObjectGuid { get; private set; } + + /// + /// Gets the SID attribute is a single-value attribute that specifies + /// the security identifier (SID) of the group + /// + [JsonProperty(PropertyName = "properties.sid")] + public string Sid { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SentinelOnboardingState.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SentinelOnboardingState.cs new file mode 100644 index 0000000000000..fb38115ef69d0 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SentinelOnboardingState.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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Sentinel onboarding state + /// + [Rest.Serialization.JsonTransformation] + public partial class SentinelOnboardingState : ResourceWithEtag + { + /// + /// Initializes a new instance of the SentinelOnboardingState class. + /// + public SentinelOnboardingState() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SentinelOnboardingState class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Etag of the azure resource + /// Flag that indicates the status of + /// the CMK setting + public SentinelOnboardingState(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string), bool? customerManagedKey = default(bool?)) + : base(id, name, type, systemData, etag) + { + CustomerManagedKey = customerManagedKey; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets flag that indicates the status of the CMK setting + /// + [JsonProperty(PropertyName = "properties.customerManagedKey")] + public bool? CustomerManagedKey { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SentinelOnboardingStatesList.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SentinelOnboardingStatesList.cs new file mode 100644 index 0000000000000..57a9e733d13c7 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SentinelOnboardingStatesList.cs @@ -0,0 +1,69 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// List of the Sentinel onboarding states + /// + public partial class SentinelOnboardingStatesList + { + /// + /// Initializes a new instance of the SentinelOnboardingStatesList + /// class. + /// + public SentinelOnboardingStatesList() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SentinelOnboardingStatesList + /// class. + /// + /// Array of Sentinel onboarding states + public SentinelOnboardingStatesList(IList value) + { + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets array of Sentinel onboarding states + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Value == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Value"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SettingList.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SettingList.cs new file mode 100644 index 0000000000000..4823ae5fbfa8f --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SettingList.cs @@ -0,0 +1,67 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// List of all the settings. + /// + public partial class SettingList + { + /// + /// Initializes a new instance of the SettingList class. + /// + public SettingList() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SettingList class. + /// + /// Array of settings. + public SettingList(IList value) + { + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets array of settings. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Value == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Value"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SettingType.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SettingType.cs new file mode 100644 index 0000000000000..c9a26f01175fb --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SettingType.cs @@ -0,0 +1,23 @@ +// +// 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.Models +{ + + /// + /// Defines values for SettingType. + /// + public static class SettingType + { + public const string CopyableLabel = "CopyableLabel"; + public const string InstructionStepsGroup = "InstructionStepsGroup"; + public const string InfoMessage = "InfoMessage"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Settings.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Settings.cs index 8c278ec9b2f50..f7ec6d075a19c 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Settings.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Settings.cs @@ -13,7 +13,7 @@ namespace Microsoft.Azure.Management.SecurityInsights.Models using System.Linq; /// - /// The Settings. + /// The Setting. /// public partial class Settings : ResourceWithEtag { @@ -28,12 +28,17 @@ public Settings() /// /// Initializes a new instance of the Settings class. /// - /// Azure resource Id - /// Azure resource name - /// Azure resource type + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. /// Etag of the azure resource - public Settings(string id = default(string), string name = default(string), string type = default(string), string etag = default(string)) - : base(id, name, type, etag) + public Settings(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string)) + : base(id, name, type, systemData, etag) { CustomInit(); } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Sku.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Sku.cs new file mode 100644 index 0000000000000..9a17eef0feacc --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Sku.cs @@ -0,0 +1,62 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The pricing tier of the solution + /// + public partial class Sku + { + /// + /// Initializes a new instance of the Sku class. + /// + public Sku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Sku class. + /// + /// The kind of the tier. Possible values include: + /// 'PerGB', 'CapacityReservation' + /// The amount of reservation + /// level + public Sku(string name = default(string), int? capacityReservationLevel = default(int?)) + { + Name = name; + CapacityReservationLevel = capacityReservationLevel; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the kind of the tier. Possible values include: + /// 'PerGB', 'CapacityReservation' + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the amount of reservation level + /// + [JsonProperty(PropertyName = "capacityReservationLevel")] + public int? CapacityReservationLevel { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SkuKind.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SkuKind.cs new file mode 100644 index 0000000000000..bba13758ad265 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SkuKind.cs @@ -0,0 +1,22 @@ +// +// 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.Models +{ + + /// + /// Defines values for SkuKind. + /// + public static class SkuKind + { + public const string PerGB = "PerGB"; + public const string CapacityReservation = "CapacityReservation"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Source.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Source.cs new file mode 100644 index 0000000000000..12261c5c8fa68 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Source.cs @@ -0,0 +1,22 @@ +// +// 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.Models +{ + + /// + /// Defines values for Source. + /// + public static class Source + { + public const string Localfile = "Local file"; + public const string Remotestorage = "Remote storage"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SourceControl.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SourceControl.cs new file mode 100644 index 0000000000000..cff123c279113 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SourceControl.cs @@ -0,0 +1,137 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents a SourceControl in Azure Security Insights. + /// + [Rest.Serialization.JsonTransformation] + public partial class SourceControl : ResourceWithEtag + { + /// + /// Initializes a new instance of the SourceControl class. + /// + public SourceControl() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SourceControl class. + /// + /// The display name of the source + /// control + /// The repository type of the source control. + /// Possible values include: 'Github', 'DevOps' + /// Array of source control content + /// types. + /// Repository metadata. + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Etag of the azure resource + /// The id (a Guid) of the source + /// control + /// A description of the source + /// control + public SourceControl(string displayName, string repoType, IList contentTypes, Repository repository, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string), string sourceControlId = default(string), string description = default(string)) + : base(id, name, type, systemData, etag) + { + SourceControlId = sourceControlId; + DisplayName = displayName; + Description = description; + RepoType = repoType; + ContentTypes = contentTypes; + Repository = repository; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the id (a Guid) of the source control + /// + [JsonProperty(PropertyName = "properties.id")] + public string SourceControlId { get; set; } + + /// + /// Gets or sets the display name of the source control + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets a description of the source control + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the repository type of the source control. Possible + /// values include: 'Github', 'DevOps' + /// + [JsonProperty(PropertyName = "properties.repoType")] + public string RepoType { get; set; } + + /// + /// Gets or sets array of source control content types. + /// + [JsonProperty(PropertyName = "properties.contentTypes")] + public IList ContentTypes { get; set; } + + /// + /// Gets or sets repository metadata. + /// + [JsonProperty(PropertyName = "properties.repository")] + public Repository Repository { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DisplayName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DisplayName"); + } + if (RepoType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "RepoType"); + } + if (ContentTypes == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ContentTypes"); + } + if (Repository == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Repository"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SourceKind.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SourceKind.cs new file mode 100644 index 0000000000000..17f8665ec8b06 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SourceKind.cs @@ -0,0 +1,24 @@ +// +// 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.Models +{ + + /// + /// Defines values for SourceKind. + /// + public static class SourceKind + { + public const string LocalWorkspace = "LocalWorkspace"; + public const string Community = "Community"; + public const string Solution = "Solution"; + public const string SourceRepository = "SourceRepository"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SubmissionMailEntity.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SubmissionMailEntity.cs new file mode 100644 index 0000000000000..429d1745cb61f --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SubmissionMailEntity.cs @@ -0,0 +1,164 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents a submission mail entity. + /// + [Newtonsoft.Json.JsonObject("SubmissionMail")] + [Rest.Serialization.JsonTransformation] + public partial class SubmissionMailEntity : Entity + { + /// + /// Initializes a new instance of the SubmissionMailEntity class. + /// + public SubmissionMailEntity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SubmissionMailEntity class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// A bag of custom fields that should be + /// part of the entity and will be presented to the user. + /// The graph item display name which is a + /// short humanly readable description of the graph item instance. This + /// property is optional and might be system generated. + /// The network message id of email to + /// which submission belongs + /// The submission id + /// The submitter + /// The submission date + /// The Time stamp when the message is received + /// (Mail) + /// The recipient of the mail + /// The sender of the mail + /// The sender's IP + /// The subject of submission mail + /// The submission type for the given + /// instance. This maps to Junk, Phish, Malware or NotJunk. + public SubmissionMailEntity(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary additionalData = default(IDictionary), string friendlyName = default(string), System.Guid? networkMessageId = default(System.Guid?), System.Guid? submissionId = default(System.Guid?), string submitter = default(string), System.DateTime? submissionDate = default(System.DateTime?), System.DateTime? timestamp = default(System.DateTime?), string recipient = default(string), string sender = default(string), string senderIp = default(string), string subject = default(string), string reportType = default(string)) + : base(id, name, type, systemData) + { + AdditionalData = additionalData; + FriendlyName = friendlyName; + NetworkMessageId = networkMessageId; + SubmissionId = submissionId; + Submitter = submitter; + SubmissionDate = submissionDate; + Timestamp = timestamp; + Recipient = recipient; + Sender = sender; + SenderIp = senderIp; + Subject = subject; + ReportType = reportType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a bag of custom fields that should be part of the entity and + /// will be presented to the user. + /// + [JsonProperty(PropertyName = "properties.additionalData")] + public IDictionary AdditionalData { get; private set; } + + /// + /// Gets the graph item display name which is a short humanly readable + /// description of the graph item instance. This property is optional + /// and might be system generated. + /// + [JsonProperty(PropertyName = "properties.friendlyName")] + public string FriendlyName { get; private set; } + + /// + /// Gets the network message id of email to which submission belongs + /// + [JsonProperty(PropertyName = "properties.networkMessageId")] + public System.Guid? NetworkMessageId { get; private set; } + + /// + /// Gets the submission id + /// + [JsonProperty(PropertyName = "properties.submissionId")] + public System.Guid? SubmissionId { get; private set; } + + /// + /// Gets the submitter + /// + [JsonProperty(PropertyName = "properties.submitter")] + public string Submitter { get; private set; } + + /// + /// Gets the submission date + /// + [JsonProperty(PropertyName = "properties.submissionDate")] + public System.DateTime? SubmissionDate { get; private set; } + + /// + /// Gets the Time stamp when the message is received (Mail) + /// + [JsonProperty(PropertyName = "properties.timestamp")] + public System.DateTime? Timestamp { get; private set; } + + /// + /// Gets the recipient of the mail + /// + [JsonProperty(PropertyName = "properties.recipient")] + public string Recipient { get; private set; } + + /// + /// Gets the sender of the mail + /// + [JsonProperty(PropertyName = "properties.sender")] + public string Sender { get; private set; } + + /// + /// Gets the sender's IP + /// + [JsonProperty(PropertyName = "properties.senderIp")] + public string SenderIp { get; private set; } + + /// + /// Gets the subject of submission mail + /// + [JsonProperty(PropertyName = "properties.subject")] + public string Subject { get; private set; } + + /// + /// Gets the submission type for the given instance. This maps to Junk, + /// Phish, Malware or NotJunk. + /// + [JsonProperty(PropertyName = "properties.reportType")] + public string ReportType { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SupportTier.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SupportTier.cs new file mode 100644 index 0000000000000..4bdf9668124f7 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SupportTier.cs @@ -0,0 +1,23 @@ +// +// 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.Models +{ + + /// + /// Defines values for SupportTier. + /// + public static class SupportTier + { + public const string Microsoft = "Microsoft"; + public const string Partner = "Partner"; + public const string Community = "Community"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SystemData.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SystemData.cs new file mode 100644 index 0000000000000..fc614c190b311 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SystemData.cs @@ -0,0 +1,103 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Metadata pertaining to creation and last modification of the resource. + /// + public partial class SystemData + { + /// + /// Initializes a new instance of the SystemData class. + /// + public SystemData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SystemData class. + /// + /// The identity that created the + /// resource. + /// The type of identity that created the + /// resource. Possible values include: 'User', 'Application', + /// 'ManagedIdentity', 'Key' + /// The timestamp of resource creation + /// (UTC). + /// The identity that last modified the + /// resource. + /// The type of identity that last + /// modified the resource. Possible values include: 'User', + /// 'Application', 'ManagedIdentity', 'Key' + /// The timestamp of resource last + /// modification (UTC) + public SystemData(string createdBy = default(string), string createdByType = default(string), System.DateTime? createdAt = default(System.DateTime?), string lastModifiedBy = default(string), string lastModifiedByType = default(string), System.DateTime? lastModifiedAt = default(System.DateTime?)) + { + CreatedBy = createdBy; + CreatedByType = createdByType; + CreatedAt = createdAt; + LastModifiedBy = lastModifiedBy; + LastModifiedByType = lastModifiedByType; + LastModifiedAt = lastModifiedAt; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the identity that created the resource. + /// + [JsonProperty(PropertyName = "createdBy")] + public string CreatedBy { get; set; } + + /// + /// Gets or sets the type of identity that created the resource. + /// Possible values include: 'User', 'Application', 'ManagedIdentity', + /// 'Key' + /// + [JsonProperty(PropertyName = "createdByType")] + public string CreatedByType { get; set; } + + /// + /// Gets or sets the timestamp of resource creation (UTC). + /// + [JsonProperty(PropertyName = "createdAt")] + public System.DateTime? CreatedAt { get; set; } + + /// + /// Gets or sets the identity that last modified the resource. + /// + [JsonProperty(PropertyName = "lastModifiedBy")] + public string LastModifiedBy { get; set; } + + /// + /// Gets or sets the type of identity that last modified the resource. + /// Possible values include: 'User', 'Application', 'ManagedIdentity', + /// 'Key' + /// + [JsonProperty(PropertyName = "lastModifiedByType")] + public string LastModifiedByType { get; set; } + + /// + /// Gets or sets the timestamp of resource last modification (UTC) + /// + [JsonProperty(PropertyName = "lastModifiedAt")] + public System.DateTime? LastModifiedAt { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TICheckRequirements.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TICheckRequirements.cs new file mode 100644 index 0000000000000..1c791f26a4549 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TICheckRequirements.cs @@ -0,0 +1,69 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Threat Intelligence Platforms data connector check requirements + /// + [Newtonsoft.Json.JsonObject("ThreatIntelligence")] + [Rest.Serialization.JsonTransformation] + public partial class TICheckRequirements : DataConnectorsCheckRequirements + { + /// + /// Initializes a new instance of the TICheckRequirements class. + /// + public TICheckRequirements() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TICheckRequirements class. + /// + /// The tenant id to connect to, and get the + /// data from. + public TICheckRequirements(string tenantId) + { + TenantId = tenantId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the tenant id to connect to, and get the data from. + /// + [JsonProperty(PropertyName = "properties.tenantId")] + public string TenantId { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (TenantId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TenantId"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TIDataConnector.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TIDataConnector.cs index caa1fc0f80a62..57be1bbe19a90 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TIDataConnector.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TIDataConnector.cs @@ -33,18 +33,23 @@ public TIDataConnector() /// /// Initializes a new instance of the TIDataConnector class. /// - /// Azure resource Id - /// Azure resource name - /// Azure resource type - /// Etag of the azure resource /// The tenant id to connect to, and get the /// data from. - /// The lookback period for the feed to - /// be imported. /// The available data types for the /// connector. - public TIDataConnector(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), string tenantId = default(string), System.DateTime? tipLookbackPeriod = default(System.DateTime?), TIDataConnectorDataTypes dataTypes = default(TIDataConnectorDataTypes)) - : base(id, name, type, etag) + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Etag of the azure resource + /// The lookback period for the feed to + /// be imported. + public TIDataConnector(string tenantId, TIDataConnectorDataTypes dataTypes, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string), System.DateTime? tipLookbackPeriod = default(System.DateTime?)) + : base(id, name, type, systemData, etag) { TenantId = tenantId; TipLookbackPeriod = tipLookbackPeriod; @@ -75,5 +80,26 @@ public TIDataConnector() [JsonProperty(PropertyName = "properties.dataTypes")] public TIDataConnectorDataTypes DataTypes { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (TenantId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TenantId"); + } + if (DataTypes == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DataTypes"); + } + if (DataTypes != null) + { + DataTypes.Validate(); + } + } } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TIDataConnectorDataTypes.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TIDataConnectorDataTypes.cs index 92fdaf0c1d617..84fd0a33bd05b 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TIDataConnectorDataTypes.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TIDataConnectorDataTypes.cs @@ -10,6 +10,7 @@ namespace Microsoft.Azure.Management.SecurityInsights.Models { + using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -31,7 +32,7 @@ public TIDataConnectorDataTypes() /// /// Data type for indicators /// connection. - public TIDataConnectorDataTypes(TIDataConnectorDataTypesIndicators indicators = default(TIDataConnectorDataTypesIndicators)) + public TIDataConnectorDataTypes(TIDataConnectorDataTypesIndicators indicators) { Indicators = indicators; CustomInit(); @@ -48,5 +49,22 @@ public TIDataConnectorDataTypes() [JsonProperty(PropertyName = "indicators")] public TIDataConnectorDataTypesIndicators Indicators { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Indicators == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Indicators"); + } + if (Indicators != null) + { + Indicators.Validate(); + } + } } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TIDataConnectorDataTypesIndicators.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TIDataConnectorDataTypesIndicators.cs index 75d4809736719..6fb216152973b 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TIDataConnectorDataTypesIndicators.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TIDataConnectorDataTypesIndicators.cs @@ -33,7 +33,7 @@ public TIDataConnectorDataTypesIndicators() /// Describe whether this data type connection is /// enabled or not. Possible values include: 'Enabled', /// 'Disabled' - public TIDataConnectorDataTypesIndicators(string state = default(string)) + public TIDataConnectorDataTypesIndicators(string state) : base(state) { CustomInit(); @@ -44,5 +44,15 @@ public TIDataConnectorDataTypesIndicators() /// partial void CustomInit(); + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TeamInformation.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TeamInformation.cs new file mode 100644 index 0000000000000..bbe85604b9f59 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TeamInformation.cs @@ -0,0 +1,85 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes team information + /// + public partial class TeamInformation + { + /// + /// Initializes a new instance of the TeamInformation class. + /// + public TeamInformation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TeamInformation class. + /// + /// Team ID + /// The primary channel URL of the + /// team + /// The time the team was + /// created + /// The name of the team + /// The description of the team + public TeamInformation(string teamId = default(string), string primaryChannelUrl = default(string), System.DateTime? teamCreationTimeUtc = default(System.DateTime?), string name = default(string), string description = default(string)) + { + TeamId = teamId; + PrimaryChannelUrl = primaryChannelUrl; + TeamCreationTimeUtc = teamCreationTimeUtc; + Name = name; + Description = description; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets team ID + /// + [JsonProperty(PropertyName = "teamId")] + public string TeamId { get; private set; } + + /// + /// Gets the primary channel URL of the team + /// + [JsonProperty(PropertyName = "primaryChannelUrl")] + public string PrimaryChannelUrl { get; private set; } + + /// + /// Gets the time the team was created + /// + [JsonProperty(PropertyName = "teamCreationTimeUtc")] + public System.DateTime? TeamCreationTimeUtc { get; private set; } + + /// + /// Gets the name of the team + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the description of the team + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TeamProperties.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TeamProperties.cs new file mode 100644 index 0000000000000..1aa427d3cde29 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TeamProperties.cs @@ -0,0 +1,93 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes team properties + /// + public partial class TeamProperties + { + /// + /// Initializes a new instance of the TeamProperties class. + /// + public TeamProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TeamProperties class. + /// + /// The name of the team + /// The description of the team + /// List of member IDs to add to the + /// team + /// List of group IDs to add their members to + /// the team + public TeamProperties(string teamName, string teamDescription = default(string), IList memberIds = default(IList), IList groupIds = default(IList)) + { + TeamName = teamName; + TeamDescription = teamDescription; + MemberIds = memberIds; + GroupIds = groupIds; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the team + /// + [JsonProperty(PropertyName = "teamName")] + public string TeamName { get; set; } + + /// + /// Gets or sets the description of the team + /// + [JsonProperty(PropertyName = "teamDescription")] + public string TeamDescription { get; set; } + + /// + /// Gets or sets list of member IDs to add to the team + /// + [JsonProperty(PropertyName = "memberIds")] + public IList MemberIds { get; set; } + + /// + /// Gets or sets list of group IDs to add their members to the team + /// + [JsonProperty(PropertyName = "groupIds")] + public IList GroupIds { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (TeamName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TeamName"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceAlertRule.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceAlertRule.cs new file mode 100644 index 0000000000000..c78df85390b62 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceAlertRule.cs @@ -0,0 +1,140 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents Threat Intelligence alert rule. + /// + [Newtonsoft.Json.JsonObject("ThreatIntelligence")] + [Rest.Serialization.JsonTransformation] + public partial class ThreatIntelligenceAlertRule : AlertRule + { + /// + /// Initializes a new instance of the ThreatIntelligenceAlertRule + /// class. + /// + public ThreatIntelligenceAlertRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ThreatIntelligenceAlertRule + /// class. + /// + /// The Name of the alert rule + /// template used to create this rule. + /// Determines whether this alert rule is enabled + /// or disabled. + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Etag of the azure resource + /// The description of the alert + /// rule. + /// The display name for alerts created by + /// this alert rule. + /// The last time that this alert has + /// been modified. + /// The severity for alerts created by this + /// alert rule. Possible values include: 'High', 'Medium', 'Low', + /// 'Informational' + /// The tactics of the alert rule + public ThreatIntelligenceAlertRule(string alertRuleTemplateName, bool enabled, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string), string description = default(string), string displayName = default(string), System.DateTime? lastModifiedUtc = default(System.DateTime?), string severity = default(string), IList tactics = default(IList)) + : base(id, name, type, systemData, etag) + { + AlertRuleTemplateName = alertRuleTemplateName; + Description = description; + DisplayName = displayName; + Enabled = enabled; + LastModifiedUtc = lastModifiedUtc; + Severity = severity; + Tactics = tactics; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the Name of the alert rule template used to create + /// this rule. + /// + [JsonProperty(PropertyName = "properties.alertRuleTemplateName")] + public string AlertRuleTemplateName { get; set; } + + /// + /// Gets the description of the alert rule. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; private set; } + + /// + /// Gets the display name for alerts created by this alert rule. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; private set; } + + /// + /// Gets or sets determines whether this alert rule is enabled or + /// disabled. + /// + [JsonProperty(PropertyName = "properties.enabled")] + public bool Enabled { get; set; } + + /// + /// Gets the last time that this alert has been modified. + /// + [JsonProperty(PropertyName = "properties.lastModifiedUtc")] + public System.DateTime? LastModifiedUtc { get; private set; } + + /// + /// Gets the severity for alerts created by this alert rule. Possible + /// values include: 'High', 'Medium', 'Low', 'Informational' + /// + [JsonProperty(PropertyName = "properties.severity")] + public string Severity { get; private set; } + + /// + /// Gets the tactics of the alert rule + /// + [JsonProperty(PropertyName = "properties.tactics")] + public IList Tactics { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (AlertRuleTemplateName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AlertRuleTemplateName"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceAlertRuleTemplate.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceAlertRuleTemplate.cs new file mode 100644 index 0000000000000..1f12d65eec38b --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceAlertRuleTemplate.cs @@ -0,0 +1,158 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents Threat Intelligence alert rule template. + /// + [Newtonsoft.Json.JsonObject("ThreatIntelligence")] + [Rest.Serialization.JsonTransformation] + public partial class ThreatIntelligenceAlertRuleTemplate : AlertRuleTemplate + { + /// + /// Initializes a new instance of the + /// ThreatIntelligenceAlertRuleTemplate class. + /// + public ThreatIntelligenceAlertRuleTemplate() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ThreatIntelligenceAlertRuleTemplate class. + /// + /// The severity for alerts created by this + /// alert rule. Possible values include: 'High', 'Medium', 'Low', + /// 'Informational' + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// the number of alert + /// rules that were created by this template + /// The last time that this alert rule + /// template has been updated. + /// The time that this alert rule template + /// has been added. + /// The description of the alert rule + /// template. + /// The display name for alert rule + /// template. + /// The required data sources for + /// this template + /// The alert rule template status. Possible + /// values include: 'Installed', 'Available', 'NotAvailable' + /// The tactics of the alert rule + /// template + public ThreatIntelligenceAlertRuleTemplate(string severity, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), int? alertRulesCreatedByTemplateCount = default(int?), System.DateTime? lastUpdatedDateUTC = default(System.DateTime?), System.DateTime? createdDateUTC = default(System.DateTime?), string description = default(string), string displayName = default(string), IList requiredDataConnectors = default(IList), string status = default(string), IList tactics = default(IList)) + : base(id, name, type, systemData) + { + AlertRulesCreatedByTemplateCount = alertRulesCreatedByTemplateCount; + LastUpdatedDateUTC = lastUpdatedDateUTC; + CreatedDateUTC = createdDateUTC; + Description = description; + DisplayName = displayName; + RequiredDataConnectors = requiredDataConnectors; + Status = status; + Severity = severity; + Tactics = tactics; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the number of alert rules that were created by this + /// template + /// + [JsonProperty(PropertyName = "properties.alertRulesCreatedByTemplateCount")] + public int? AlertRulesCreatedByTemplateCount { get; set; } + + /// + /// Gets the last time that this alert rule template has been updated. + /// + [JsonProperty(PropertyName = "properties.lastUpdatedDateUTC")] + public System.DateTime? LastUpdatedDateUTC { get; private set; } + + /// + /// Gets the time that this alert rule template has been added. + /// + [JsonProperty(PropertyName = "properties.createdDateUTC")] + public System.DateTime? CreatedDateUTC { get; private set; } + + /// + /// Gets or sets the description of the alert rule template. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the display name for alert rule template. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets the required data sources for this template + /// + [JsonProperty(PropertyName = "properties.requiredDataConnectors")] + public IList RequiredDataConnectors { get; set; } + + /// + /// Gets or sets the alert rule template status. Possible values + /// include: 'Installed', 'Available', 'NotAvailable' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; set; } + + /// + /// Gets or sets the severity for alerts created by this alert rule. + /// Possible values include: 'High', 'Medium', 'Low', 'Informational' + /// + [JsonProperty(PropertyName = "properties.severity")] + public string Severity { get; set; } + + /// + /// Gets or sets the tactics of the alert rule template + /// + [JsonProperty(PropertyName = "properties.tactics")] + public IList Tactics { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Severity == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Severity"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceAppendTags.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceAppendTags.cs new file mode 100644 index 0000000000000..2b45b4e8ac260 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceAppendTags.cs @@ -0,0 +1,56 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Array of tags to be appended to the threat intelligence indicator. + /// + public partial class ThreatIntelligenceAppendTags + { + /// + /// Initializes a new instance of the ThreatIntelligenceAppendTags + /// class. + /// + public ThreatIntelligenceAppendTags() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ThreatIntelligenceAppendTags + /// class. + /// + /// List of tags to be + /// appended. + public ThreatIntelligenceAppendTags(IList threatIntelligenceTags = default(IList)) + { + ThreatIntelligenceTags = threatIntelligenceTags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of tags to be appended. + /// + [JsonProperty(PropertyName = "threatIntelligenceTags")] + public IList ThreatIntelligenceTags { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceExternalReference.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceExternalReference.cs new file mode 100644 index 0000000000000..e1386be79a9b8 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceExternalReference.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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes external reference + /// + public partial class ThreatIntelligenceExternalReference + { + /// + /// Initializes a new instance of the + /// ThreatIntelligenceExternalReference class. + /// + public ThreatIntelligenceExternalReference() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ThreatIntelligenceExternalReference class. + /// + /// External reference description + /// External reference ID + /// External reference source name + /// External reference URL + /// External reference hashes + public ThreatIntelligenceExternalReference(string description = default(string), string externalId = default(string), string sourceName = default(string), string url = default(string), IDictionary hashes = default(IDictionary)) + { + Description = description; + ExternalId = externalId; + SourceName = sourceName; + Url = url; + Hashes = hashes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets external reference description + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets external reference ID + /// + [JsonProperty(PropertyName = "externalId")] + public string ExternalId { get; set; } + + /// + /// Gets or sets external reference source name + /// + [JsonProperty(PropertyName = "sourceName")] + public string SourceName { get; set; } + + /// + /// Gets or sets external reference URL + /// + [JsonProperty(PropertyName = "url")] + public string Url { get; set; } + + /// + /// Gets or sets external reference hashes + /// + [JsonProperty(PropertyName = "hashes")] + public IDictionary Hashes { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceFilteringCriteria.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceFilteringCriteria.cs new file mode 100644 index 0000000000000..9bf5d277fd86d --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceFilteringCriteria.cs @@ -0,0 +1,156 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Filtering criteria for querying threat intelligence indicators. + /// + public partial class ThreatIntelligenceFilteringCriteria + { + /// + /// Initializes a new instance of the + /// ThreatIntelligenceFilteringCriteria class. + /// + public ThreatIntelligenceFilteringCriteria() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ThreatIntelligenceFilteringCriteria class. + /// + /// Page size + /// Minimum confidence. + /// Maximum confidence. + /// Start time for ValidUntil + /// filter. + /// End time for ValidUntil filter. + /// Parameter to include/exclude disabled + /// indicators. + /// Columns to sort by and sorting order + /// Sources of threat intelligence + /// indicators + /// Pattern types + /// Threat types of threat intelligence + /// indicators + /// Ids of threat intelligence indicators + /// Keywords for searching threat intelligence + /// indicators + /// Skip token. + public ThreatIntelligenceFilteringCriteria(int? pageSize = default(int?), int? minConfidence = default(int?), int? maxConfidence = default(int?), string minValidUntil = default(string), string maxValidUntil = default(string), bool? includeDisabled = default(bool?), IList sortBy = default(IList), IList sources = default(IList), IList patternTypes = default(IList), IList threatTypes = default(IList), IList ids = default(IList), IList keywords = default(IList), string skipToken = default(string)) + { + PageSize = pageSize; + MinConfidence = minConfidence; + MaxConfidence = maxConfidence; + MinValidUntil = minValidUntil; + MaxValidUntil = maxValidUntil; + IncludeDisabled = includeDisabled; + SortBy = sortBy; + Sources = sources; + PatternTypes = patternTypes; + ThreatTypes = threatTypes; + Ids = ids; + Keywords = keywords; + SkipToken = skipToken; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets page size + /// + [JsonProperty(PropertyName = "pageSize")] + public int? PageSize { get; set; } + + /// + /// Gets or sets minimum confidence. + /// + [JsonProperty(PropertyName = "minConfidence")] + public int? MinConfidence { get; set; } + + /// + /// Gets or sets maximum confidence. + /// + [JsonProperty(PropertyName = "maxConfidence")] + public int? MaxConfidence { get; set; } + + /// + /// Gets or sets start time for ValidUntil filter. + /// + [JsonProperty(PropertyName = "minValidUntil")] + public string MinValidUntil { get; set; } + + /// + /// Gets or sets end time for ValidUntil filter. + /// + [JsonProperty(PropertyName = "maxValidUntil")] + public string MaxValidUntil { get; set; } + + /// + /// Gets or sets parameter to include/exclude disabled indicators. + /// + [JsonProperty(PropertyName = "includeDisabled")] + public bool? IncludeDisabled { get; set; } + + /// + /// Gets or sets columns to sort by and sorting order + /// + [JsonProperty(PropertyName = "sortBy")] + public IList SortBy { get; set; } + + /// + /// Gets or sets sources of threat intelligence indicators + /// + [JsonProperty(PropertyName = "sources")] + public IList Sources { get; set; } + + /// + /// Gets or sets pattern types + /// + [JsonProperty(PropertyName = "patternTypes")] + public IList PatternTypes { get; set; } + + /// + /// Gets or sets threat types of threat intelligence indicators + /// + [JsonProperty(PropertyName = "threatTypes")] + public IList ThreatTypes { get; set; } + + /// + /// Gets or sets ids of threat intelligence indicators + /// + [JsonProperty(PropertyName = "ids")] + public IList Ids { get; set; } + + /// + /// Gets or sets keywords for searching threat intelligence indicators + /// + [JsonProperty(PropertyName = "keywords")] + public IList Keywords { get; set; } + + /// + /// Gets or sets skip token. + /// + [JsonProperty(PropertyName = "skipToken")] + public string SkipToken { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceGranularMarkingModel.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceGranularMarkingModel.cs new file mode 100644 index 0000000000000..2d3c96bf489ed --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceGranularMarkingModel.cs @@ -0,0 +1,72 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes threat granular marking model entity + /// + public partial class ThreatIntelligenceGranularMarkingModel + { + /// + /// Initializes a new instance of the + /// ThreatIntelligenceGranularMarkingModel class. + /// + public ThreatIntelligenceGranularMarkingModel() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ThreatIntelligenceGranularMarkingModel class. + /// + /// Language granular marking model + /// marking reference granular marking + /// model + /// granular marking model selectors + public ThreatIntelligenceGranularMarkingModel(string language = default(string), int? markingRef = default(int?), IList selectors = default(IList)) + { + Language = language; + MarkingRef = markingRef; + Selectors = selectors; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets language granular marking model + /// + [JsonProperty(PropertyName = "language")] + public string Language { get; set; } + + /// + /// Gets or sets marking reference granular marking model + /// + [JsonProperty(PropertyName = "markingRef")] + public int? MarkingRef { get; set; } + + /// + /// Gets or sets granular marking model selectors + /// + [JsonProperty(PropertyName = "selectors")] + public IList Selectors { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceIndicatorModel.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceIndicatorModel.cs new file mode 100644 index 0000000000000..7e1bd7ed71817 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceIndicatorModel.cs @@ -0,0 +1,312 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Threat intelligence indicator entity. + /// + [Newtonsoft.Json.JsonObject("indicator")] + [Rest.Serialization.JsonTransformation] + public partial class ThreatIntelligenceIndicatorModel : ThreatIntelligenceInformation + { + /// + /// Initializes a new instance of the ThreatIntelligenceIndicatorModel + /// class. + /// + public ThreatIntelligenceIndicatorModel() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ThreatIntelligenceIndicatorModel + /// class. + /// + /// Etag of the azure resource + /// A bag of custom fields that should be + /// part of the entity and will be presented to the user. + /// The graph item display name which is a + /// short humanly readable description of the graph item instance. This + /// property is optional and might be system generated. + /// List of tags + /// Last updated time in UTC + /// Source of a threat intelligence entity + /// Display name of a threat intelligence + /// entity + /// Description of a threat intelligence + /// entity + /// Indicator types of threat intelligence + /// entities + /// Pattern of a threat intelligence + /// entity + /// Pattern type of a threat intelligence + /// entity + /// Pattern version of a threat + /// intelligence entity + /// Kill chain phases + /// Parsed patterns + /// External ID of threat intelligence + /// entity + /// Created by reference of threat + /// intelligence entity + /// Is threat intelligence entity + /// defanged + /// External last updated time + /// in UTC + /// External References + /// Granular Markings + /// Labels of threat intelligence entity + /// Is threat intelligence entity revoked + /// Confidence of threat intelligence + /// entity + /// Threat intelligence entity object + /// marking references + /// Language of threat intelligence + /// entity + /// Threat types + /// Valid from + /// Valid until + /// Created by + /// Modified by + /// Extensions map + public ThreatIntelligenceIndicatorModel(string etag = default(string), IDictionary additionalData = default(IDictionary), string friendlyName = default(string), IList threatIntelligenceTags = default(IList), string lastUpdatedTimeUtc = default(string), string source = default(string), string displayName = default(string), string description = default(string), IList indicatorTypes = default(IList), string pattern = default(string), string patternType = default(string), string patternVersion = default(string), IList killChainPhases = default(IList), IList parsedPattern = default(IList), string externalId = default(string), string createdByRef = default(string), bool? defanged = default(bool?), string externalLastUpdatedTimeUtc = default(string), IList externalReferences = default(IList), IList granularMarkings = default(IList), IList labels = default(IList), bool? revoked = default(bool?), int? confidence = default(int?), IList objectMarkingRefs = default(IList), string language = default(string), IList threatTypes = default(IList), string validFrom = default(string), string validUntil = default(string), string created = default(string), string modified = default(string), IDictionary extensions = default(IDictionary)) + : base(etag) + { + AdditionalData = additionalData; + FriendlyName = friendlyName; + ThreatIntelligenceTags = threatIntelligenceTags; + LastUpdatedTimeUtc = lastUpdatedTimeUtc; + Source = source; + DisplayName = displayName; + Description = description; + IndicatorTypes = indicatorTypes; + Pattern = pattern; + PatternType = patternType; + PatternVersion = patternVersion; + KillChainPhases = killChainPhases; + ParsedPattern = parsedPattern; + ExternalId = externalId; + CreatedByRef = createdByRef; + Defanged = defanged; + ExternalLastUpdatedTimeUtc = externalLastUpdatedTimeUtc; + ExternalReferences = externalReferences; + GranularMarkings = granularMarkings; + Labels = labels; + Revoked = revoked; + Confidence = confidence; + ObjectMarkingRefs = objectMarkingRefs; + Language = language; + ThreatTypes = threatTypes; + ValidFrom = validFrom; + ValidUntil = validUntil; + Created = created; + Modified = modified; + Extensions = extensions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a bag of custom fields that should be part of the entity and + /// will be presented to the user. + /// + [JsonProperty(PropertyName = "properties.additionalData")] + public IDictionary AdditionalData { get; private set; } + + /// + /// Gets the graph item display name which is a short humanly readable + /// description of the graph item instance. This property is optional + /// and might be system generated. + /// + [JsonProperty(PropertyName = "properties.friendlyName")] + public string FriendlyName { get; private set; } + + /// + /// Gets or sets list of tags + /// + [JsonProperty(PropertyName = "properties.threatIntelligenceTags")] + public IList ThreatIntelligenceTags { get; set; } + + /// + /// Gets or sets last updated time in UTC + /// + [JsonProperty(PropertyName = "properties.lastUpdatedTimeUtc")] + public string LastUpdatedTimeUtc { get; set; } + + /// + /// Gets or sets source of a threat intelligence entity + /// + [JsonProperty(PropertyName = "properties.source")] + public string Source { get; set; } + + /// + /// Gets or sets display name of a threat intelligence entity + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets description of a threat intelligence entity + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets indicator types of threat intelligence entities + /// + [JsonProperty(PropertyName = "properties.indicatorTypes")] + public IList IndicatorTypes { get; set; } + + /// + /// Gets or sets pattern of a threat intelligence entity + /// + [JsonProperty(PropertyName = "properties.pattern")] + public string Pattern { get; set; } + + /// + /// Gets or sets pattern type of a threat intelligence entity + /// + [JsonProperty(PropertyName = "properties.patternType")] + public string PatternType { get; set; } + + /// + /// Gets or sets pattern version of a threat intelligence entity + /// + [JsonProperty(PropertyName = "properties.patternVersion")] + public string PatternVersion { get; set; } + + /// + /// Gets or sets kill chain phases + /// + [JsonProperty(PropertyName = "properties.killChainPhases")] + public IList KillChainPhases { get; set; } + + /// + /// Gets or sets parsed patterns + /// + [JsonProperty(PropertyName = "properties.parsedPattern")] + public IList ParsedPattern { get; set; } + + /// + /// Gets or sets external ID of threat intelligence entity + /// + [JsonProperty(PropertyName = "properties.externalId")] + public string ExternalId { get; set; } + + /// + /// Gets or sets created by reference of threat intelligence entity + /// + [JsonProperty(PropertyName = "properties.createdByRef")] + public string CreatedByRef { get; set; } + + /// + /// Gets or sets is threat intelligence entity defanged + /// + [JsonProperty(PropertyName = "properties.defanged")] + public bool? Defanged { get; set; } + + /// + /// Gets or sets external last updated time in UTC + /// + [JsonProperty(PropertyName = "properties.externalLastUpdatedTimeUtc")] + public string ExternalLastUpdatedTimeUtc { get; set; } + + /// + /// Gets or sets external References + /// + [JsonProperty(PropertyName = "properties.externalReferences")] + public IList ExternalReferences { get; set; } + + /// + /// Gets or sets granular Markings + /// + [JsonProperty(PropertyName = "properties.granularMarkings")] + public IList GranularMarkings { get; set; } + + /// + /// Gets or sets labels of threat intelligence entity + /// + [JsonProperty(PropertyName = "properties.labels")] + public IList Labels { get; set; } + + /// + /// Gets or sets is threat intelligence entity revoked + /// + [JsonProperty(PropertyName = "properties.revoked")] + public bool? Revoked { get; set; } + + /// + /// Gets or sets confidence of threat intelligence entity + /// + [JsonProperty(PropertyName = "properties.confidence")] + public int? Confidence { get; set; } + + /// + /// Gets or sets threat intelligence entity object marking references + /// + [JsonProperty(PropertyName = "properties.objectMarkingRefs")] + public IList ObjectMarkingRefs { get; set; } + + /// + /// Gets or sets language of threat intelligence entity + /// + [JsonProperty(PropertyName = "properties.language")] + public string Language { get; set; } + + /// + /// Gets or sets threat types + /// + [JsonProperty(PropertyName = "properties.threatTypes")] + public IList ThreatTypes { get; set; } + + /// + /// Gets or sets valid from + /// + [JsonProperty(PropertyName = "properties.validFrom")] + public string ValidFrom { get; set; } + + /// + /// Gets or sets valid until + /// + [JsonProperty(PropertyName = "properties.validUntil")] + public string ValidUntil { get; set; } + + /// + /// Gets or sets created by + /// + [JsonProperty(PropertyName = "properties.created")] + public string Created { get; set; } + + /// + /// Gets or sets modified by + /// + [JsonProperty(PropertyName = "properties.modified")] + public string Modified { get; set; } + + /// + /// Gets or sets extensions map + /// + [JsonProperty(PropertyName = "properties.extensions")] + public IDictionary Extensions { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceIndicatorModelForRequestBody.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceIndicatorModelForRequestBody.cs new file mode 100644 index 0000000000000..6fd52f049272c --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceIndicatorModelForRequestBody.cs @@ -0,0 +1,317 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Threat intelligence indicator entity used in request body. + /// + [Rest.Serialization.JsonTransformation] + public partial class ThreatIntelligenceIndicatorModelForRequestBody : ThreatIntelligenceResourceKind + { + /// + /// Initializes a new instance of the + /// ThreatIntelligenceIndicatorModelForRequestBody class. + /// + public ThreatIntelligenceIndicatorModelForRequestBody() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ThreatIntelligenceIndicatorModelForRequestBody class. + /// + /// Etag of the azure resource + /// A bag of custom fields that should be + /// part of the entity and will be presented to the user. + /// The graph item display name which is a + /// short humanly readable description of the graph item instance. This + /// property is optional and might be system generated. + /// List of tags + /// Last updated time in UTC + /// Source of a threat intelligence entity + /// Display name of a threat intelligence + /// entity + /// Description of a threat intelligence + /// entity + /// Indicator types of threat intelligence + /// entities + /// Pattern of a threat intelligence + /// entity + /// Pattern type of a threat intelligence + /// entity + /// Pattern version of a threat + /// intelligence entity + /// Kill chain phases + /// Parsed patterns + /// External ID of threat intelligence + /// entity + /// Created by reference of threat + /// intelligence entity + /// Is threat intelligence entity + /// defanged + /// External last updated time + /// in UTC + /// External References + /// Granular Markings + /// Labels of threat intelligence entity + /// Is threat intelligence entity revoked + /// Confidence of threat intelligence + /// entity + /// Threat intelligence entity object + /// marking references + /// Language of threat intelligence + /// entity + /// Threat types + /// Valid from + /// Valid until + /// Created by + /// Modified by + /// Extensions map + public ThreatIntelligenceIndicatorModelForRequestBody(string etag = default(string), IDictionary additionalData = default(IDictionary), string friendlyName = default(string), IList threatIntelligenceTags = default(IList), string lastUpdatedTimeUtc = default(string), string source = default(string), string displayName = default(string), string description = default(string), IList indicatorTypes = default(IList), string pattern = default(string), string patternType = default(string), string patternVersion = default(string), IList killChainPhases = default(IList), IList parsedPattern = default(IList), string externalId = default(string), string createdByRef = default(string), bool? defanged = default(bool?), string externalLastUpdatedTimeUtc = default(string), IList externalReferences = default(IList), IList granularMarkings = default(IList), IList labels = default(IList), bool? revoked = default(bool?), int? confidence = default(int?), IList objectMarkingRefs = default(IList), string language = default(string), IList threatTypes = default(IList), string validFrom = default(string), string validUntil = default(string), string created = default(string), string modified = default(string), IDictionary extensions = default(IDictionary)) + { + Etag = etag; + AdditionalData = additionalData; + FriendlyName = friendlyName; + ThreatIntelligenceTags = threatIntelligenceTags; + LastUpdatedTimeUtc = lastUpdatedTimeUtc; + Source = source; + DisplayName = displayName; + Description = description; + IndicatorTypes = indicatorTypes; + Pattern = pattern; + PatternType = patternType; + PatternVersion = patternVersion; + KillChainPhases = killChainPhases; + ParsedPattern = parsedPattern; + ExternalId = externalId; + CreatedByRef = createdByRef; + Defanged = defanged; + ExternalLastUpdatedTimeUtc = externalLastUpdatedTimeUtc; + ExternalReferences = externalReferences; + GranularMarkings = granularMarkings; + Labels = labels; + Revoked = revoked; + Confidence = confidence; + ObjectMarkingRefs = objectMarkingRefs; + Language = language; + ThreatTypes = threatTypes; + ValidFrom = validFrom; + ValidUntil = validUntil; + Created = created; + Modified = modified; + Extensions = extensions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets etag of the azure resource + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; set; } + + /// + /// Gets a bag of custom fields that should be part of the entity and + /// will be presented to the user. + /// + [JsonProperty(PropertyName = "properties.additionalData")] + public IDictionary AdditionalData { get; private set; } + + /// + /// Gets the graph item display name which is a short humanly readable + /// description of the graph item instance. This property is optional + /// and might be system generated. + /// + [JsonProperty(PropertyName = "properties.friendlyName")] + public string FriendlyName { get; private set; } + + /// + /// Gets or sets list of tags + /// + [JsonProperty(PropertyName = "properties.threatIntelligenceTags")] + public IList ThreatIntelligenceTags { get; set; } + + /// + /// Gets or sets last updated time in UTC + /// + [JsonProperty(PropertyName = "properties.lastUpdatedTimeUtc")] + public string LastUpdatedTimeUtc { get; set; } + + /// + /// Gets or sets source of a threat intelligence entity + /// + [JsonProperty(PropertyName = "properties.source")] + public string Source { get; set; } + + /// + /// Gets or sets display name of a threat intelligence entity + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets description of a threat intelligence entity + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets indicator types of threat intelligence entities + /// + [JsonProperty(PropertyName = "properties.indicatorTypes")] + public IList IndicatorTypes { get; set; } + + /// + /// Gets or sets pattern of a threat intelligence entity + /// + [JsonProperty(PropertyName = "properties.pattern")] + public string Pattern { get; set; } + + /// + /// Gets or sets pattern type of a threat intelligence entity + /// + [JsonProperty(PropertyName = "properties.patternType")] + public string PatternType { get; set; } + + /// + /// Gets or sets pattern version of a threat intelligence entity + /// + [JsonProperty(PropertyName = "properties.patternVersion")] + public string PatternVersion { get; set; } + + /// + /// Gets or sets kill chain phases + /// + [JsonProperty(PropertyName = "properties.killChainPhases")] + public IList KillChainPhases { get; set; } + + /// + /// Gets or sets parsed patterns + /// + [JsonProperty(PropertyName = "properties.parsedPattern")] + public IList ParsedPattern { get; set; } + + /// + /// Gets or sets external ID of threat intelligence entity + /// + [JsonProperty(PropertyName = "properties.externalId")] + public string ExternalId { get; set; } + + /// + /// Gets or sets created by reference of threat intelligence entity + /// + [JsonProperty(PropertyName = "properties.createdByRef")] + public string CreatedByRef { get; set; } + + /// + /// Gets or sets is threat intelligence entity defanged + /// + [JsonProperty(PropertyName = "properties.defanged")] + public bool? Defanged { get; set; } + + /// + /// Gets or sets external last updated time in UTC + /// + [JsonProperty(PropertyName = "properties.externalLastUpdatedTimeUtc")] + public string ExternalLastUpdatedTimeUtc { get; set; } + + /// + /// Gets or sets external References + /// + [JsonProperty(PropertyName = "properties.externalReferences")] + public IList ExternalReferences { get; set; } + + /// + /// Gets or sets granular Markings + /// + [JsonProperty(PropertyName = "properties.granularMarkings")] + public IList GranularMarkings { get; set; } + + /// + /// Gets or sets labels of threat intelligence entity + /// + [JsonProperty(PropertyName = "properties.labels")] + public IList Labels { get; set; } + + /// + /// Gets or sets is threat intelligence entity revoked + /// + [JsonProperty(PropertyName = "properties.revoked")] + public bool? Revoked { get; set; } + + /// + /// Gets or sets confidence of threat intelligence entity + /// + [JsonProperty(PropertyName = "properties.confidence")] + public int? Confidence { get; set; } + + /// + /// Gets or sets threat intelligence entity object marking references + /// + [JsonProperty(PropertyName = "properties.objectMarkingRefs")] + public IList ObjectMarkingRefs { get; set; } + + /// + /// Gets or sets language of threat intelligence entity + /// + [JsonProperty(PropertyName = "properties.language")] + public string Language { get; set; } + + /// + /// Gets or sets threat types + /// + [JsonProperty(PropertyName = "properties.threatTypes")] + public IList ThreatTypes { get; set; } + + /// + /// Gets or sets valid from + /// + [JsonProperty(PropertyName = "properties.validFrom")] + public string ValidFrom { get; set; } + + /// + /// Gets or sets valid until + /// + [JsonProperty(PropertyName = "properties.validUntil")] + public string ValidUntil { get; set; } + + /// + /// Gets or sets created by + /// + [JsonProperty(PropertyName = "properties.created")] + public string Created { get; set; } + + /// + /// Gets or sets modified by + /// + [JsonProperty(PropertyName = "properties.modified")] + public string Modified { get; set; } + + /// + /// Gets or sets extensions map + /// + [JsonProperty(PropertyName = "properties.extensions")] + public IDictionary Extensions { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceInformation.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceInformation.cs new file mode 100644 index 0000000000000..078ef8bffc0d0 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceInformation.cs @@ -0,0 +1,53 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Threat intelligence information object. + /// + public partial class ThreatIntelligenceInformation + { + /// + /// Initializes a new instance of the ThreatIntelligenceInformation + /// class. + /// + public ThreatIntelligenceInformation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ThreatIntelligenceInformation + /// class. + /// + /// Etag of the azure resource + public ThreatIntelligenceInformation(string etag = default(string)) + { + Etag = etag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets etag of the azure resource + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceKillChainPhase.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceKillChainPhase.cs new file mode 100644 index 0000000000000..d2d5131576deb --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceKillChainPhase.cs @@ -0,0 +1,61 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes threat kill chain phase entity + /// + public partial class ThreatIntelligenceKillChainPhase + { + /// + /// Initializes a new instance of the ThreatIntelligenceKillChainPhase + /// class. + /// + public ThreatIntelligenceKillChainPhase() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ThreatIntelligenceKillChainPhase + /// class. + /// + /// Kill chainName name + /// Phase name + public ThreatIntelligenceKillChainPhase(string killChainName = default(string), string phaseName = default(string)) + { + KillChainName = killChainName; + PhaseName = phaseName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets kill chainName name + /// + [JsonProperty(PropertyName = "killChainName")] + public string KillChainName { get; set; } + + /// + /// Gets or sets phase name + /// + [JsonProperty(PropertyName = "phaseName")] + public string PhaseName { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceMetric.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceMetric.cs new file mode 100644 index 0000000000000..761fe5260d4a7 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceMetric.cs @@ -0,0 +1,78 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes threat intelligence metric + /// + public partial class ThreatIntelligenceMetric + { + /// + /// Initializes a new instance of the ThreatIntelligenceMetric class. + /// + public ThreatIntelligenceMetric() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ThreatIntelligenceMetric class. + /// + /// Last updated indicator + /// metric + /// Threat type metrics + /// Pattern type metrics + /// Source metrics + public ThreatIntelligenceMetric(string lastUpdatedTimeUtc = default(string), IList threatTypeMetrics = default(IList), IList patternTypeMetrics = default(IList), IList sourceMetrics = default(IList)) + { + LastUpdatedTimeUtc = lastUpdatedTimeUtc; + ThreatTypeMetrics = threatTypeMetrics; + PatternTypeMetrics = patternTypeMetrics; + SourceMetrics = sourceMetrics; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets last updated indicator metric + /// + [JsonProperty(PropertyName = "lastUpdatedTimeUtc")] + public string LastUpdatedTimeUtc { get; set; } + + /// + /// Gets or sets threat type metrics + /// + [JsonProperty(PropertyName = "threatTypeMetrics")] + public IList ThreatTypeMetrics { get; set; } + + /// + /// Gets or sets pattern type metrics + /// + [JsonProperty(PropertyName = "patternTypeMetrics")] + public IList PatternTypeMetrics { get; set; } + + /// + /// Gets or sets source metrics + /// + [JsonProperty(PropertyName = "sourceMetrics")] + public IList SourceMetrics { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceMetricEntity.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceMetricEntity.cs new file mode 100644 index 0000000000000..d5a5fe883fca1 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceMetricEntity.cs @@ -0,0 +1,61 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes threat intelligence metric entity + /// + public partial class ThreatIntelligenceMetricEntity + { + /// + /// Initializes a new instance of the ThreatIntelligenceMetricEntity + /// class. + /// + public ThreatIntelligenceMetricEntity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ThreatIntelligenceMetricEntity + /// class. + /// + /// Metric name + /// Metric value + public ThreatIntelligenceMetricEntity(string metricName = default(string), int? metricValue = default(int?)) + { + MetricName = metricName; + MetricValue = metricValue; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets metric name + /// + [JsonProperty(PropertyName = "metricName")] + public string MetricName { get; set; } + + /// + /// Gets or sets metric value + /// + [JsonProperty(PropertyName = "metricValue")] + public int? MetricValue { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceMetrics.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceMetrics.cs new file mode 100644 index 0000000000000..dc805c507c02c --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceMetrics.cs @@ -0,0 +1,51 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Threat intelligence metrics. + /// + public partial class ThreatIntelligenceMetrics + { + /// + /// Initializes a new instance of the ThreatIntelligenceMetrics class. + /// + public ThreatIntelligenceMetrics() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ThreatIntelligenceMetrics class. + /// + /// Threat intelligence metrics. + public ThreatIntelligenceMetrics(ThreatIntelligenceMetric properties = default(ThreatIntelligenceMetric)) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets threat intelligence metrics. + /// + [JsonProperty(PropertyName = "properties")] + public ThreatIntelligenceMetric Properties { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceMetricsList.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceMetricsList.cs new file mode 100644 index 0000000000000..b192e78e34a71 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceMetricsList.cs @@ -0,0 +1,72 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// List of all the threat intelligence metric fields (type/threat + /// type/source). + /// + public partial class ThreatIntelligenceMetricsList + { + /// + /// Initializes a new instance of the ThreatIntelligenceMetricsList + /// class. + /// + public ThreatIntelligenceMetricsList() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ThreatIntelligenceMetricsList + /// class. + /// + /// Array of threat intelligence metric fields + /// (type/threat type/source). + public ThreatIntelligenceMetricsList(IList value) + { + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets array of threat intelligence metric fields + /// (type/threat type/source). + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Value == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Value"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceParsedPattern.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceParsedPattern.cs new file mode 100644 index 0000000000000..29c4b859325f8 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceParsedPattern.cs @@ -0,0 +1,63 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes parsed pattern entity + /// + public partial class ThreatIntelligenceParsedPattern + { + /// + /// Initializes a new instance of the ThreatIntelligenceParsedPattern + /// class. + /// + public ThreatIntelligenceParsedPattern() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ThreatIntelligenceParsedPattern + /// class. + /// + /// Pattern type key + /// Pattern type keys + public ThreatIntelligenceParsedPattern(string patternTypeKey = default(string), IList patternTypeValues = default(IList)) + { + PatternTypeKey = patternTypeKey; + PatternTypeValues = patternTypeValues; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets pattern type key + /// + [JsonProperty(PropertyName = "patternTypeKey")] + public string PatternTypeKey { get; set; } + + /// + /// Gets or sets pattern type keys + /// + [JsonProperty(PropertyName = "patternTypeValues")] + public IList PatternTypeValues { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceParsedPatternTypeValue.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceParsedPatternTypeValue.cs new file mode 100644 index 0000000000000..c0e546cef959d --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceParsedPatternTypeValue.cs @@ -0,0 +1,61 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes threat kill chain phase entity + /// + public partial class ThreatIntelligenceParsedPatternTypeValue + { + /// + /// Initializes a new instance of the + /// ThreatIntelligenceParsedPatternTypeValue class. + /// + public ThreatIntelligenceParsedPatternTypeValue() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ThreatIntelligenceParsedPatternTypeValue class. + /// + /// Type of the value + /// Value of parsed pattern + public ThreatIntelligenceParsedPatternTypeValue(string valueType = default(string), string value = default(string)) + { + ValueType = valueType; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets type of the value + /// + [JsonProperty(PropertyName = "valueType")] + public string ValueType { get; set; } + + /// + /// Gets or sets value of parsed pattern + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceResourceKind.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceResourceKind.cs new file mode 100644 index 0000000000000..8481324af1b1d --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceResourceKind.cs @@ -0,0 +1,50 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes an entity with kind. + /// + public partial class ThreatIntelligenceResourceKind + { + /// + /// Initializes a new instance of the ThreatIntelligenceResourceKind + /// class. + /// + public ThreatIntelligenceResourceKind() + { + CustomInit(); + } + + /// + /// Static constructor for ThreatIntelligenceResourceKind class. + /// + static ThreatIntelligenceResourceKind() + { + Kind = "indicator"; + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// The kind of the entity. + /// + [JsonProperty(PropertyName = "kind")] + public static string Kind { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceResourceKindEnum.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceResourceKindEnum.cs new file mode 100644 index 0000000000000..5e33e6324aa8a --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceResourceKindEnum.cs @@ -0,0 +1,24 @@ +// +// 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.Models +{ + + /// + /// Defines values for ThreatIntelligenceResourceKindEnum. + /// + public static class ThreatIntelligenceResourceKindEnum + { + /// + /// Entity represents threat intelligence indicator in the system. + /// + public const string Indicator = "indicator"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceSortingCriteria.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceSortingCriteria.cs new file mode 100644 index 0000000000000..cd40277bfd503 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceSortingCriteria.cs @@ -0,0 +1,64 @@ +// +// 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.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// List of available columns for sorting + /// + public partial class ThreatIntelligenceSortingCriteria + { + /// + /// Initializes a new instance of the ThreatIntelligenceSortingCriteria + /// class. + /// + public ThreatIntelligenceSortingCriteria() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ThreatIntelligenceSortingCriteria + /// class. + /// + /// Column name + /// Sorting order + /// (ascending/descending/unsorted). Possible values include: + /// 'unsorted', 'ascending', 'descending' + public ThreatIntelligenceSortingCriteria(string itemKey = default(string), string sortOrder = default(string)) + { + ItemKey = itemKey; + SortOrder = sortOrder; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets column name + /// + [JsonProperty(PropertyName = "itemKey")] + public string ItemKey { get; set; } + + /// + /// Gets or sets sorting order (ascending/descending/unsorted). + /// Possible values include: 'unsorted', 'ascending', 'descending' + /// + [JsonProperty(PropertyName = "sortOrder")] + public string SortOrder { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceSortingCriteriaEnum.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceSortingCriteriaEnum.cs new file mode 100644 index 0000000000000..4214c90980630 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceSortingCriteriaEnum.cs @@ -0,0 +1,23 @@ +// +// 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.Models +{ + + /// + /// Defines values for ThreatIntelligenceSortingCriteriaEnum. + /// + public static class ThreatIntelligenceSortingCriteriaEnum + { + public const string Unsorted = "unsorted"; + public const string Ascending = "ascending"; + public const string Descending = "descending"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TiTaxiiCheckRequirements.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TiTaxiiCheckRequirements.cs new file mode 100644 index 0000000000000..cc53c42a46f09 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TiTaxiiCheckRequirements.cs @@ -0,0 +1,69 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Threat Intelligence TAXII data connector check requirements + /// + [Newtonsoft.Json.JsonObject("ThreatIntelligenceTaxii")] + [Rest.Serialization.JsonTransformation] + public partial class TiTaxiiCheckRequirements : DataConnectorsCheckRequirements + { + /// + /// Initializes a new instance of the TiTaxiiCheckRequirements class. + /// + public TiTaxiiCheckRequirements() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TiTaxiiCheckRequirements class. + /// + /// The tenant id to connect to, and get the + /// data from. + public TiTaxiiCheckRequirements(string tenantId) + { + TenantId = tenantId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the tenant id to connect to, and get the data from. + /// + [JsonProperty(PropertyName = "properties.tenantId")] + public string TenantId { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (TenantId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TenantId"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TiTaxiiDataConnector.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TiTaxiiDataConnector.cs new file mode 100644 index 0000000000000..a36b22bb3c71f --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TiTaxiiDataConnector.cs @@ -0,0 +1,173 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Data connector to pull Threat intelligence data from TAXII 2.0/2.1 + /// server + /// + [Newtonsoft.Json.JsonObject("ThreatIntelligenceTaxii")] + [Rest.Serialization.JsonTransformation] + public partial class TiTaxiiDataConnector : DataConnector + { + /// + /// Initializes a new instance of the TiTaxiiDataConnector class. + /// + public TiTaxiiDataConnector() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TiTaxiiDataConnector class. + /// + /// The tenant id to connect to, and get the + /// data from. + /// The polling frequency for the TAXII + /// server. Possible values include: 'OnceAMinute', 'OnceAnHour', + /// 'OnceADay' + /// The available data types for Threat + /// Intelligence TAXII data connector. + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Etag of the azure resource + /// The workspace id. + /// The friendly name for the TAXII + /// server. + /// The API root for the TAXII + /// server. + /// The collection id of the TAXII + /// server. + /// The userName for the TAXII server. + /// The password for the TAXII server. + /// The lookback period for the TAXII + /// server. + public TiTaxiiDataConnector(string tenantId, string pollingFrequency, TiTaxiiDataConnectorDataTypes dataTypes, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string), string workspaceId = default(string), string friendlyName = default(string), string taxiiServer = default(string), string collectionId = default(string), string userName = default(string), string password = default(string), System.DateTime? taxiiLookbackPeriod = default(System.DateTime?)) + : base(id, name, type, systemData, etag) + { + TenantId = tenantId; + WorkspaceId = workspaceId; + FriendlyName = friendlyName; + TaxiiServer = taxiiServer; + CollectionId = collectionId; + UserName = userName; + Password = password; + TaxiiLookbackPeriod = taxiiLookbackPeriod; + PollingFrequency = pollingFrequency; + DataTypes = dataTypes; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the tenant id to connect to, and get the data from. + /// + [JsonProperty(PropertyName = "properties.tenantId")] + public string TenantId { get; set; } + + /// + /// Gets or sets the workspace id. + /// + [JsonProperty(PropertyName = "properties.workspaceId")] + public string WorkspaceId { get; set; } + + /// + /// Gets or sets the friendly name for the TAXII server. + /// + [JsonProperty(PropertyName = "properties.friendlyName")] + public string FriendlyName { get; set; } + + /// + /// Gets or sets the API root for the TAXII server. + /// + [JsonProperty(PropertyName = "properties.taxiiServer")] + public string TaxiiServer { get; set; } + + /// + /// Gets or sets the collection id of the TAXII server. + /// + [JsonProperty(PropertyName = "properties.collectionId")] + public string CollectionId { get; set; } + + /// + /// Gets or sets the userName for the TAXII server. + /// + [JsonProperty(PropertyName = "properties.userName")] + public string UserName { get; set; } + + /// + /// Gets or sets the password for the TAXII server. + /// + [JsonProperty(PropertyName = "properties.password")] + public string Password { get; set; } + + /// + /// Gets or sets the lookback period for the TAXII server. + /// + [JsonProperty(PropertyName = "properties.taxiiLookbackPeriod")] + public System.DateTime? TaxiiLookbackPeriod { get; set; } + + /// + /// Gets or sets the polling frequency for the TAXII server. Possible + /// values include: 'OnceAMinute', 'OnceAnHour', 'OnceADay' + /// + [JsonProperty(PropertyName = "properties.pollingFrequency")] + public string PollingFrequency { get; set; } + + /// + /// Gets or sets the available data types for Threat Intelligence TAXII + /// data connector. + /// + [JsonProperty(PropertyName = "properties.dataTypes")] + public TiTaxiiDataConnectorDataTypes DataTypes { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (TenantId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TenantId"); + } + if (PollingFrequency == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "PollingFrequency"); + } + if (DataTypes == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DataTypes"); + } + if (DataTypes != null) + { + DataTypes.Validate(); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TiTaxiiDataConnectorDataTypes.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TiTaxiiDataConnectorDataTypes.cs new file mode 100644 index 0000000000000..6de51c2d0ca22 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TiTaxiiDataConnectorDataTypes.cs @@ -0,0 +1,71 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The available data types for Threat Intelligence TAXII data connector. + /// + public partial class TiTaxiiDataConnectorDataTypes + { + /// + /// Initializes a new instance of the TiTaxiiDataConnectorDataTypes + /// class. + /// + public TiTaxiiDataConnectorDataTypes() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TiTaxiiDataConnectorDataTypes + /// class. + /// + /// Data type for TAXII connector. + public TiTaxiiDataConnectorDataTypes(TiTaxiiDataConnectorDataTypesTaxiiClient taxiiClient) + { + TaxiiClient = taxiiClient; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets data type for TAXII connector. + /// + [JsonProperty(PropertyName = "taxiiClient")] + public TiTaxiiDataConnectorDataTypesTaxiiClient TaxiiClient { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (TaxiiClient == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TaxiiClient"); + } + if (TaxiiClient != null) + { + TaxiiClient.Validate(); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TiTaxiiDataConnectorDataTypesTaxiiClient.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TiTaxiiDataConnectorDataTypesTaxiiClient.cs new file mode 100644 index 0000000000000..196767877045d --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TiTaxiiDataConnectorDataTypesTaxiiClient.cs @@ -0,0 +1,58 @@ +// +// 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.Models +{ + using System.Linq; + + /// + /// Data type for TAXII connector. + /// + public partial class TiTaxiiDataConnectorDataTypesTaxiiClient : DataConnectorDataTypeCommon + { + /// + /// Initializes a new instance of the + /// TiTaxiiDataConnectorDataTypesTaxiiClient class. + /// + public TiTaxiiDataConnectorDataTypesTaxiiClient() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// TiTaxiiDataConnectorDataTypesTaxiiClient class. + /// + /// Describe whether this data type connection is + /// enabled or not. Possible values include: 'Enabled', + /// 'Disabled' + public TiTaxiiDataConnectorDataTypesTaxiiClient(string state) + : base(state) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TimelineAggregation.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TimelineAggregation.cs new file mode 100644 index 0000000000000..79b0193c3ad00 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TimelineAggregation.cs @@ -0,0 +1,75 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// timeline aggregation information per kind + /// + public partial class TimelineAggregation + { + /// + /// Initializes a new instance of the TimelineAggregation class. + /// + public TimelineAggregation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TimelineAggregation class. + /// + /// the total items found for a kind + /// the query kind. Possible values include: + /// 'Activity', 'Bookmark', 'SecurityAlert' + public TimelineAggregation(int count, string kind) + { + Count = count; + Kind = kind; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the total items found for a kind + /// + [JsonProperty(PropertyName = "count")] + public int Count { get; set; } + + /// + /// Gets or sets the query kind. Possible values include: 'Activity', + /// 'Bookmark', 'SecurityAlert' + /// + [JsonProperty(PropertyName = "kind")] + public string Kind { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Kind == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Kind"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TimelineError.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TimelineError.cs new file mode 100644 index 0000000000000..90d64f7d80d90 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TimelineError.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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Timeline Query Errors. + /// + public partial class TimelineError + { + /// + /// Initializes a new instance of the TimelineError class. + /// + public TimelineError() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TimelineError class. + /// + /// the query kind. Possible values include: + /// 'Activity', 'Bookmark', 'SecurityAlert' + /// the error message + /// the query id + public TimelineError(string kind, string errorMessage, string queryId = default(string)) + { + Kind = kind; + QueryId = queryId; + ErrorMessage = errorMessage; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the query kind. Possible values include: 'Activity', + /// 'Bookmark', 'SecurityAlert' + /// + [JsonProperty(PropertyName = "kind")] + public string Kind { get; set; } + + /// + /// Gets or sets the query id + /// + [JsonProperty(PropertyName = "queryId")] + public string QueryId { get; set; } + + /// + /// Gets or sets the error message + /// + [JsonProperty(PropertyName = "errorMessage")] + public string ErrorMessage { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Kind == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Kind"); + } + if (ErrorMessage == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ErrorMessage"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TimelineResultsMetadata.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TimelineResultsMetadata.cs new file mode 100644 index 0000000000000..2f5583f8a9dd6 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TimelineResultsMetadata.cs @@ -0,0 +1,104 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Expansion result metadata. + /// + public partial class TimelineResultsMetadata + { + /// + /// Initializes a new instance of the TimelineResultsMetadata class. + /// + public TimelineResultsMetadata() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TimelineResultsMetadata class. + /// + /// the total items found for the timeline + /// request + /// timeline aggregation per kind + /// information about the failure queries + public TimelineResultsMetadata(int totalCount, IList aggregations, IList errors = default(IList)) + { + TotalCount = totalCount; + Aggregations = aggregations; + Errors = errors; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the total items found for the timeline request + /// + [JsonProperty(PropertyName = "totalCount")] + public int TotalCount { get; set; } + + /// + /// Gets or sets timeline aggregation per kind + /// + [JsonProperty(PropertyName = "aggregations")] + public IList Aggregations { get; set; } + + /// + /// Gets or sets information about the failure queries + /// + [JsonProperty(PropertyName = "errors")] + public IList Errors { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Aggregations == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Aggregations"); + } + if (Aggregations != null) + { + foreach (var element in Aggregations) + { + if (element != null) + { + element.Validate(); + } + } + } + if (Errors != null) + { + foreach (var element1 in Errors) + { + if (element1 != null) + { + element1.Validate(); + } + } + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TrackedResource.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TrackedResource.cs new file mode 100644 index 0000000000000..491fc1d89b550 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TrackedResource.cs @@ -0,0 +1,89 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Tracked Resource + /// + /// + /// The resource model definition for an Azure Resource Manager tracked top + /// level resource which has 'tags' and a 'location' + /// + public partial class TrackedResource : Resource + { + /// + /// Initializes a new instance of the TrackedResource class. + /// + public TrackedResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TrackedResource class. + /// + /// The geo-location where the resource + /// lives + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Resource tags. + public TrackedResource(string location, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary tags = default(IDictionary)) + : base(id, name, type, systemData) + { + Tags = tags; + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets or sets the geo-location where the resource lives + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Location"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Ueba.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Ueba.cs new file mode 100644 index 0000000000000..5c51113236c06 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Ueba.cs @@ -0,0 +1,67 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Settings with single toggle. + /// + [Rest.Serialization.JsonTransformation] + public partial class Ueba : Settings + { + /// + /// Initializes a new instance of the Ueba class. + /// + public Ueba() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Ueba class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Etag of the azure resource + /// The relevant data sources that enriched + /// by ueba + public Ueba(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string), IList dataSources = default(IList)) + : base(id, name, type, systemData, etag) + { + DataSources = dataSources; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the relevant data sources that enriched by ueba + /// + [JsonProperty(PropertyName = "properties.dataSources")] + public IList DataSources { get; set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/UebaDataSources.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/UebaDataSources.cs new file mode 100644 index 0000000000000..ebcd91eeb63ca --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/UebaDataSources.cs @@ -0,0 +1,24 @@ +// +// 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.Models +{ + + /// + /// Defines values for UebaDataSources. + /// + public static class UebaDataSources + { + public const string AuditLogs = "AuditLogs"; + public const string AzureActivity = "AzureActivity"; + public const string SecurityEvent = "SecurityEvent"; + public const string SigninLogs = "SigninLogs"; + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/UebaSettings.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/UebaSettings.cs deleted file mode 100644 index 840992edae715..0000000000000 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/UebaSettings.cs +++ /dev/null @@ -1,84 +0,0 @@ -// -// 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.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Represents settings for User and Entity Behavior Analytics enablement. - /// - [Rest.Serialization.JsonTransformation] - public partial class UebaSettings : Settings - { - /// - /// Initializes a new instance of the UebaSettings class. - /// - public UebaSettings() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the UebaSettings class. - /// - /// Azure resource Id - /// Azure resource name - /// Azure resource type - /// Etag of the azure resource - /// Determines whether the tenant has - /// ATP (Advanced Threat Protection) license. Possible values include: - /// 'Enabled', 'Disabled' - /// Determines whether User and Entity Behavior - /// Analytics is enabled for this workspace. - /// Determines whether User and Entity - /// Behavior Analytics is enabled from MCAS (Microsoft Cloud App - /// Security). Possible values include: 'Enabled', 'Disabled' - public UebaSettings(string id = default(string), string name = default(string), string type = default(string), string etag = default(string), string atpLicenseStatus = default(string), bool? isEnabled = default(bool?), string statusInMcas = default(string)) - : base(id, name, type, etag) - { - AtpLicenseStatus = atpLicenseStatus; - IsEnabled = isEnabled; - StatusInMcas = statusInMcas; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets determines whether the tenant has ATP (Advanced Threat - /// Protection) license. Possible values include: 'Enabled', 'Disabled' - /// - [JsonProperty(PropertyName = "properties.atpLicenseStatus")] - public string AtpLicenseStatus { get; private set; } - - /// - /// Gets or sets determines whether User and Entity Behavior Analytics - /// is enabled for this workspace. - /// - [JsonProperty(PropertyName = "properties.isEnabled")] - public bool? IsEnabled { get; set; } - - /// - /// Gets determines whether User and Entity Behavior Analytics is - /// enabled from MCAS (Microsoft Cloud App Security). Possible values - /// include: 'Enabled', 'Disabled' - /// - [JsonProperty(PropertyName = "properties.statusInMcas")] - public string StatusInMcas { get; private set; } - - } -} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/UrlEntity.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/UrlEntity.cs new file mode 100644 index 0000000000000..a31d999bd2e1e --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/UrlEntity.cs @@ -0,0 +1,88 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents a url entity. + /// + [Newtonsoft.Json.JsonObject("Url")] + [Rest.Serialization.JsonTransformation] + public partial class UrlEntity : Entity + { + /// + /// Initializes a new instance of the UrlEntity class. + /// + public UrlEntity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UrlEntity class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// A bag of custom fields that should be + /// part of the entity and will be presented to the user. + /// The graph item display name which is a + /// short humanly readable description of the graph item instance. This + /// property is optional and might be system generated. + /// A full URL the entity points to + public UrlEntity(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary additionalData = default(IDictionary), string friendlyName = default(string), string url = default(string)) + : base(id, name, type, systemData) + { + AdditionalData = additionalData; + FriendlyName = friendlyName; + Url = url; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets a bag of custom fields that should be part of the entity and + /// will be presented to the user. + /// + [JsonProperty(PropertyName = "properties.additionalData")] + public IDictionary AdditionalData { get; private set; } + + /// + /// Gets the graph item display name which is a short humanly readable + /// description of the graph item instance. This property is optional + /// and might be system generated. + /// + [JsonProperty(PropertyName = "properties.friendlyName")] + public string FriendlyName { get; private set; } + + /// + /// Gets a full URL the entity points to + /// + [JsonProperty(PropertyName = "properties.url")] + public string Url { get; private set; } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/UserInfo.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/UserInfo.cs index 3573080ba7374..22ee58fb1b3d1 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/UserInfo.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/UserInfo.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Management.SecurityInsights.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -30,10 +29,10 @@ public UserInfo() /// /// Initializes a new instance of the UserInfo class. /// - /// The object id of the user. /// The email of the user. /// The name of the user. - public UserInfo(System.Guid? objectId, string email = default(string), string name = default(string)) + /// The object id of the user. + public UserInfo(string email = default(string), string name = default(string), System.Guid? objectId = default(System.Guid?)) { Email = email; Name = name; @@ -64,18 +63,5 @@ public UserInfo() [JsonProperty(PropertyName = "objectId")] public System.Guid? ObjectId { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (ObjectId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ObjectId"); - } - } } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Watchlist.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Watchlist.cs new file mode 100644 index 0000000000000..ed5627ee61a49 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Watchlist.cs @@ -0,0 +1,284 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Represents a Watchlist in Azure Security Insights. + /// + [Rest.Serialization.JsonTransformation] + public partial class Watchlist : ResourceWithEtag + { + /// + /// Initializes a new instance of the Watchlist class. + /// + public Watchlist() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Watchlist class. + /// + /// The display name of the watchlist + /// The provider of the watchlist + /// The source of the watchlist. Possible values + /// include: 'Local file', 'Remote storage' + /// The search key is used to optimize + /// query performance when using watchlists for joins with other data. + /// For example, enable a column with IP addresses to be the designated + /// SearchKey field, then use this field as the key field when joining + /// to other event data by IP address. + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Etag of the azure resource + /// The id (a Guid) of the watchlist + /// The time the watchlist was created + /// The last time the watchlist was + /// updated + /// Describes a user that created the + /// watchlist + /// Describes a user that updated the + /// watchlist + /// A description of the watchlist + /// The type of the watchlist + /// The alias of the watchlist + /// A flag that indicates if the watchlist is + /// deleted or not + /// List of labels relevant to this + /// watchlist + /// The default duration of a watchlist + /// (in ISO 8601 duration format) + /// The tenantId where the watchlist belongs + /// to + /// The number of lines in a csv/tsv + /// content to skip before the header + /// The raw content that represents to + /// watchlist items to create. In case of csv/tsv content type, it's + /// the content of the file that will parsed by the endpoint + /// The content type of the raw content. + /// Example : text/csv or text/tsv + /// The status of the Watchlist upload : + /// New, InProgress or Complete. Pls note : When a Watchlist upload + /// status is equal to InProgress, the Watchlist cannot be + /// deleted + /// The number of Watchlist Items in + /// the Watchlist + public Watchlist(string displayName, string provider, string source, string itemsSearchKey, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string), string watchlistId = default(string), System.DateTime? created = default(System.DateTime?), System.DateTime? updated = default(System.DateTime?), UserInfo createdBy = default(UserInfo), UserInfo updatedBy = default(UserInfo), string description = default(string), string watchlistType = default(string), string watchlistAlias = default(string), bool? isDeleted = default(bool?), IList labels = default(IList), System.TimeSpan? defaultDuration = default(System.TimeSpan?), string tenantId = default(string), int? numberOfLinesToSkip = default(int?), string rawContent = default(string), string contentType = default(string), string uploadStatus = default(string), int? watchlistItemsCount = default(int?)) + : base(id, name, type, systemData, etag) + { + WatchlistId = watchlistId; + DisplayName = displayName; + Provider = provider; + Source = source; + Created = created; + Updated = updated; + CreatedBy = createdBy; + UpdatedBy = updatedBy; + Description = description; + WatchlistType = watchlistType; + WatchlistAlias = watchlistAlias; + IsDeleted = isDeleted; + Labels = labels; + DefaultDuration = defaultDuration; + TenantId = tenantId; + NumberOfLinesToSkip = numberOfLinesToSkip; + RawContent = rawContent; + ItemsSearchKey = itemsSearchKey; + ContentType = contentType; + UploadStatus = uploadStatus; + WatchlistItemsCount = watchlistItemsCount; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the id (a Guid) of the watchlist + /// + [JsonProperty(PropertyName = "properties.watchlistId")] + public string WatchlistId { get; set; } + + /// + /// Gets or sets the display name of the watchlist + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets the provider of the watchlist + /// + [JsonProperty(PropertyName = "properties.provider")] + public string Provider { get; set; } + + /// + /// Gets or sets the source of the watchlist. Possible values include: + /// 'Local file', 'Remote storage' + /// + [JsonProperty(PropertyName = "properties.source")] + public string Source { get; set; } + + /// + /// Gets or sets the time the watchlist was created + /// + [JsonProperty(PropertyName = "properties.created")] + public System.DateTime? Created { get; set; } + + /// + /// Gets or sets the last time the watchlist was updated + /// + [JsonProperty(PropertyName = "properties.updated")] + public System.DateTime? Updated { get; set; } + + /// + /// Gets or sets describes a user that created the watchlist + /// + [JsonProperty(PropertyName = "properties.createdBy")] + public UserInfo CreatedBy { get; set; } + + /// + /// Gets or sets describes a user that updated the watchlist + /// + [JsonProperty(PropertyName = "properties.updatedBy")] + public UserInfo UpdatedBy { get; set; } + + /// + /// Gets or sets a description of the watchlist + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the type of the watchlist + /// + [JsonProperty(PropertyName = "properties.watchlistType")] + public string WatchlistType { get; set; } + + /// + /// Gets or sets the alias of the watchlist + /// + [JsonProperty(PropertyName = "properties.watchlistAlias")] + public string WatchlistAlias { get; set; } + + /// + /// Gets or sets a flag that indicates if the watchlist is deleted or + /// not + /// + [JsonProperty(PropertyName = "properties.isDeleted")] + public bool? IsDeleted { get; set; } + + /// + /// Gets or sets list of labels relevant to this watchlist + /// + [JsonProperty(PropertyName = "properties.labels")] + public IList Labels { get; set; } + + /// + /// Gets or sets the default duration of a watchlist (in ISO 8601 + /// duration format) + /// + [JsonProperty(PropertyName = "properties.defaultDuration")] + public System.TimeSpan? DefaultDuration { get; set; } + + /// + /// Gets or sets the tenantId where the watchlist belongs to + /// + [JsonProperty(PropertyName = "properties.tenantId")] + public string TenantId { get; set; } + + /// + /// Gets or sets the number of lines in a csv/tsv content to skip + /// before the header + /// + [JsonProperty(PropertyName = "properties.numberOfLinesToSkip")] + public int? NumberOfLinesToSkip { get; set; } + + /// + /// Gets or sets the raw content that represents to watchlist items to + /// create. In case of csv/tsv content type, it's the content of the + /// file that will parsed by the endpoint + /// + [JsonProperty(PropertyName = "properties.rawContent")] + public string RawContent { get; set; } + + /// + /// Gets or sets the search key is used to optimize query performance + /// when using watchlists for joins with other data. For example, + /// enable a column with IP addresses to be the designated SearchKey + /// field, then use this field as the key field when joining to other + /// event data by IP address. + /// + [JsonProperty(PropertyName = "properties.itemsSearchKey")] + public string ItemsSearchKey { get; set; } + + /// + /// Gets or sets the content type of the raw content. Example : + /// text/csv or text/tsv + /// + [JsonProperty(PropertyName = "properties.contentType")] + public string ContentType { get; set; } + + /// + /// Gets or sets the status of the Watchlist upload : New, InProgress + /// or Complete. Pls note : When a Watchlist upload status is equal to + /// InProgress, the Watchlist cannot be deleted + /// + [JsonProperty(PropertyName = "properties.uploadStatus")] + public string UploadStatus { get; set; } + + /// + /// Gets or sets the number of Watchlist Items in the Watchlist + /// + [JsonProperty(PropertyName = "properties.watchlistItemsCount")] + public int? WatchlistItemsCount { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DisplayName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DisplayName"); + } + if (Provider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Provider"); + } + if (Source == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Source"); + } + if (ItemsSearchKey == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ItemsSearchKey"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/WatchlistItem.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/WatchlistItem.cs new file mode 100644 index 0000000000000..161d2e5d31bcb --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/WatchlistItem.cs @@ -0,0 +1,160 @@ +// +// 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.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents a Watchlist item in Azure Security Insights. + /// + [Rest.Serialization.JsonTransformation] + public partial class WatchlistItem : ResourceWithEtag + { + /// + /// Initializes a new instance of the WatchlistItem class. + /// + public WatchlistItem() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WatchlistItem class. + /// + /// key-value pairs for a watchlist + /// item + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Etag of the azure resource + /// The type of the watchlist + /// item + /// The id (a Guid) of the watchlist + /// item + /// The tenantId to which the watchlist item + /// belongs to + /// A flag that indicates if the watchlist item + /// is deleted or not + /// The time the watchlist item was + /// created + /// The last time the watchlist item was + /// updated + /// Describes a user that created the watchlist + /// item + /// Describes a user that updated the watchlist + /// item + /// key-value pairs for a watchlist item + /// entity mapping + public WatchlistItem(object itemsKeyValue, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string), string watchlistItemType = default(string), string watchlistItemId = default(string), string tenantId = default(string), bool? isDeleted = default(bool?), System.DateTime? created = default(System.DateTime?), System.DateTime? updated = default(System.DateTime?), UserInfo createdBy = default(UserInfo), UserInfo updatedBy = default(UserInfo), object entityMapping = default(object)) + : base(id, name, type, systemData, etag) + { + WatchlistItemType = watchlistItemType; + WatchlistItemId = watchlistItemId; + TenantId = tenantId; + IsDeleted = isDeleted; + Created = created; + Updated = updated; + CreatedBy = createdBy; + UpdatedBy = updatedBy; + ItemsKeyValue = itemsKeyValue; + EntityMapping = entityMapping; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the type of the watchlist item + /// + [JsonProperty(PropertyName = "properties.watchlistItemType")] + public string WatchlistItemType { get; set; } + + /// + /// Gets or sets the id (a Guid) of the watchlist item + /// + [JsonProperty(PropertyName = "properties.watchlistItemId")] + public string WatchlistItemId { get; set; } + + /// + /// Gets or sets the tenantId to which the watchlist item belongs to + /// + [JsonProperty(PropertyName = "properties.tenantId")] + public string TenantId { get; set; } + + /// + /// Gets or sets a flag that indicates if the watchlist item is deleted + /// or not + /// + [JsonProperty(PropertyName = "properties.isDeleted")] + public bool? IsDeleted { get; set; } + + /// + /// Gets or sets the time the watchlist item was created + /// + [JsonProperty(PropertyName = "properties.created")] + public System.DateTime? Created { get; set; } + + /// + /// Gets or sets the last time the watchlist item was updated + /// + [JsonProperty(PropertyName = "properties.updated")] + public System.DateTime? Updated { get; set; } + + /// + /// Gets or sets describes a user that created the watchlist item + /// + [JsonProperty(PropertyName = "properties.createdBy")] + public UserInfo CreatedBy { get; set; } + + /// + /// Gets or sets describes a user that updated the watchlist item + /// + [JsonProperty(PropertyName = "properties.updatedBy")] + public UserInfo UpdatedBy { get; set; } + + /// + /// Gets or sets key-value pairs for a watchlist item + /// + [JsonProperty(PropertyName = "properties.itemsKeyValue")] + public object ItemsKeyValue { get; set; } + + /// + /// Gets or sets key-value pairs for a watchlist item entity mapping + /// + [JsonProperty(PropertyName = "properties.entityMapping")] + public object EntityMapping { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ItemsKeyValue == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ItemsKeyValue"); + } + } + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/OfficeConsentsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/OfficeConsentsOperations.cs new file mode 100644 index 0000000000000..034ff97ca71cd --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/OfficeConsentsOperations.cs @@ -0,0 +1,950 @@ +// +// 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; + + /// + /// OfficeConsentsOperations operations. + /// + internal partial class OfficeConsentsOperations : IServiceOperations, IOfficeConsentsOperations + { + /// + /// Initializes a new instance of the OfficeConsentsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal OfficeConsentsOperations(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 office365 consents. + /// + /// + /// 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/officeConsents").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 office365 consent. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// consent 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 consentId, 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 (consentId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "consentId"); + } + // 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("consentId", consentId); + 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/officeConsents/{consentId}").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("{consentId}", System.Uri.EscapeDataString(consentId)); + 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; + } + + /// + /// Delete the office365 consent. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// consent 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 consentId, 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 (consentId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "consentId"); + } + // 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("consentId", consentId); + 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/officeConsents/{consentId}").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("{consentId}", System.Uri.EscapeDataString(consentId)); + 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 office365 consents. + /// + /// + /// 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/OfficeConsentsOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/OfficeConsentsOperationsExtensions.cs new file mode 100644 index 0000000000000..bf4be1efa75fe --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/OfficeConsentsOperationsExtensions.cs @@ -0,0 +1,212 @@ +// +// 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 OfficeConsentsOperations. + /// + public static partial class OfficeConsentsOperationsExtensions + { + /// + /// Gets all office365 consents. + /// + /// + /// 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 IOfficeConsentsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName) + { + return operations.ListAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Gets all office365 consents. + /// + /// + /// 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 IOfficeConsentsOperations 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 office365 consent. + /// + /// + /// 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. + /// + /// + /// consent ID + /// + public static OfficeConsent Get(this IOfficeConsentsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string consentId) + { + return operations.GetAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, consentId).GetAwaiter().GetResult(); + } + + /// + /// Gets an office365 consent. + /// + /// + /// 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. + /// + /// + /// consent ID + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IOfficeConsentsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string consentId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, consentId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete the office365 consent. + /// + /// + /// 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. + /// + /// + /// consent ID + /// + public static void Delete(this IOfficeConsentsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string consentId) + { + operations.DeleteAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, consentId).GetAwaiter().GetResult(); + } + + /// + /// Delete the office365 consent. + /// + /// + /// 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. + /// + /// + /// consent ID + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IOfficeConsentsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string consentId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, consentId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets all office365 consents. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IOfficeConsentsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all office365 consents. + /// + /// + /// 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 IOfficeConsentsOperations 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/Operations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Operations.cs index 38e2e487d6dea..817cb31f1651c 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Operations.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Operations.cs @@ -65,11 +65,28 @@ internal Operations(SecurityInsightsClient client) /// /// 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(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); + } + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ProductSettingsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ProductSettingsOperations.cs new file mode 100644 index 0000000000000..e836120762362 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ProductSettingsOperations.cs @@ -0,0 +1,1042 @@ +// +// 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; + + /// + /// ProductSettingsOperations operations. + /// + internal partial class ProductSettingsOperations : IServiceOperations, IProductSettingsOperations + { + /// + /// Initializes a new instance of the ProductSettingsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ProductSettingsOperations(SecurityInsightsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SecurityInsightsClient + /// + public SecurityInsightsClient Client { get; private set; } + + /// + /// List of all the settings + /// + /// + /// 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/settings").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 a setting. + /// + /// + /// 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 setting name. Supports - Anomalies, EyesOn, EntityAnalytics, Ueba + /// + /// + /// 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 settingsName, 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 (settingsName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "settingsName"); + } + // 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("settingsName", settingsName); + 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/settings/{settingsName}").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("{settingsName}", System.Uri.EscapeDataString(settingsName)); + 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; + } + + /// + /// Delete setting of the product. + /// + /// + /// 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 setting name. Supports - Anomalies, EyesOn, EntityAnalytics, Ueba + /// + /// + /// 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 settingsName, 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 (settingsName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "settingsName"); + } + // 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("settingsName", settingsName); + 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/settings/{settingsName}").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("{settingsName}", System.Uri.EscapeDataString(settingsName)); + 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; + } + + /// + /// Updates setting. + /// + /// + /// 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 setting name. Supports - Anomalies, EyesOn, EntityAnalytics, Ueba + /// + /// + /// The setting + /// + /// + /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string settingsName, Settings settings, 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 (settingsName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "settingsName"); + } + if (settings == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "settings"); + } + // 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("settingsName", settingsName); + tracingParameters.Add("settings", settings); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", 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/settings/{settingsName}").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("{settingsName}", System.Uri.EscapeDataString(settingsName)); + 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(settings != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(settings, 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/ProductSettingsOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ProductSettingsOperationsExtensions.cs new file mode 100644 index 0000000000000..edb569b500b5d --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ProductSettingsOperationsExtensions.cs @@ -0,0 +1,238 @@ +// +// 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 ProductSettingsOperations. + /// + public static partial class ProductSettingsOperationsExtensions + { + /// + /// List of all the settings + /// + /// + /// 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 SettingList List(this IProductSettingsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName) + { + return operations.ListAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// List of all the settings + /// + /// + /// 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 IProductSettingsOperations 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 a setting. + /// + /// + /// 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 setting name. Supports - Anomalies, EyesOn, EntityAnalytics, Ueba + /// + public static Settings Get(this IProductSettingsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string settingsName) + { + return operations.GetAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, settingsName).GetAwaiter().GetResult(); + } + + /// + /// Gets a setting. + /// + /// + /// 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 setting name. Supports - Anomalies, EyesOn, EntityAnalytics, Ueba + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IProductSettingsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string settingsName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, settingsName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete setting of the product. + /// + /// + /// 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 setting name. Supports - Anomalies, EyesOn, EntityAnalytics, Ueba + /// + public static void Delete(this IProductSettingsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string settingsName) + { + operations.DeleteAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, settingsName).GetAwaiter().GetResult(); + } + + /// + /// Delete setting of the product. + /// + /// + /// 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 setting name. Supports - Anomalies, EyesOn, EntityAnalytics, Ueba + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IProductSettingsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string settingsName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, settingsName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Updates setting. + /// + /// + /// 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 setting name. Supports - Anomalies, EyesOn, EntityAnalytics, Ueba + /// + /// + /// The setting + /// + public static Settings Update(this IProductSettingsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string settingsName, Settings settings) + { + return operations.UpdateAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, settingsName, settings).GetAwaiter().GetResult(); + } + + /// + /// Updates setting. + /// + /// + /// 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 setting name. Supports - Anomalies, EyesOn, EntityAnalytics, Ueba + /// + /// + /// The setting + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IProductSettingsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string settingsName, Settings settings, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, settingsName, settings, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/SdkInfo_SecurityInsights.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/SdkInfo_SecurityInsights.cs index 6a833696e11f7..66be192836fa5 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/SdkInfo_SecurityInsights.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/SdkInfo_SecurityInsights.cs @@ -19,27 +19,40 @@ public static IEnumerable> ApiInfo_SecurityInsight { return new Tuple[] { - new Tuple("OperationalInsights", "Actions", "2020-01-01"), - new Tuple("OperationalInsights", "AlertRuleTemplates", "2020-01-01"), - new Tuple("OperationalInsights", "AlertRules", "2020-01-01"), - new Tuple("OperationalInsights", "Bookmarks", "2020-01-01"), - new Tuple("OperationalInsights", "DataConnectors", "2020-01-01"), - new Tuple("OperationalInsights", "IncidentComments", "2020-01-01"), - new Tuple("OperationalInsights", "Incidents", "2020-01-01"), - new Tuple("SecurityInsights", "Operations", "2020-01-01"), + new Tuple("SecurityInsights", "Actions", "2021-09-01-preview"), + new Tuple("SecurityInsights", "AlertRuleTemplates", "2021-09-01-preview"), + new Tuple("SecurityInsights", "AlertRules", "2021-09-01-preview"), + new Tuple("SecurityInsights", "AutomationRules", "2021-09-01-preview"), + new Tuple("SecurityInsights", "Bookmark", "2021-09-01-preview"), + new Tuple("SecurityInsights", "BookmarkRelations", "2021-09-01-preview"), + new Tuple("SecurityInsights", "Bookmarks", "2021-09-01-preview"), + new Tuple("SecurityInsights", "DataConnectors", "2021-09-01-preview"), + new Tuple("SecurityInsights", "DataConnectorsCheckRequirements", "2021-09-01-preview"), + new Tuple("SecurityInsights", "DomainWhois", "2021-09-01-preview"), + new Tuple("SecurityInsights", "Entities", "2021-09-01-preview"), + new Tuple("SecurityInsights", "EntitiesGetTimeline", "2021-09-01-preview"), + new Tuple("SecurityInsights", "EntitiesRelations", "2021-09-01-preview"), + new Tuple("SecurityInsights", "EntityQueries", "2021-09-01-preview"), + new Tuple("SecurityInsights", "EntityQueryTemplates", "2021-09-01-preview"), + new Tuple("SecurityInsights", "EntityRelations", "2021-09-01-preview"), + new Tuple("SecurityInsights", "IPGeodata", "2021-09-01-preview"), + new Tuple("SecurityInsights", "IncidentComments", "2021-09-01-preview"), + new Tuple("SecurityInsights", "IncidentRelations", "2021-09-01-preview"), + new Tuple("SecurityInsights", "Incidents", "2021-09-01-preview"), + new Tuple("SecurityInsights", "Metadata", "2021-09-01-preview"), + new Tuple("SecurityInsights", "OfficeConsents", "2021-09-01-preview"), + new Tuple("SecurityInsights", "Operations", "2021-09-01-preview"), + new Tuple("SecurityInsights", "ProductSettings", "2021-09-01-preview"), + new Tuple("SecurityInsights", "SentinelOnboardingStates", "2021-09-01-preview"), + new Tuple("SecurityInsights", "SourceControl", "2021-09-01-preview"), + new Tuple("SecurityInsights", "SourceControls", "2021-09-01-preview"), + new Tuple("SecurityInsights", "ThreatIntelligenceIndicator", "2021-09-01-preview"), + new Tuple("SecurityInsights", "ThreatIntelligenceIndicatorMetrics", "2021-09-01-preview"), + new Tuple("SecurityInsights", "ThreatIntelligenceIndicators", "2021-09-01-preview"), + new Tuple("SecurityInsights", "WatchlistItems", "2021-09-01-preview"), + new Tuple("SecurityInsights", "Watchlists", "2021-09-01-preview"), }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "v2"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4413"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/securityinsights/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=E:\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "fb680afc380cccb44a59ed277232ad4224ac809b"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/SecurityInsightsClient.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/SecurityInsightsClient.cs index 1b02da754ef26..381f9f8f6e63c 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/SecurityInsightsClient.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/SecurityInsightsClient.cs @@ -48,14 +48,14 @@ public partial class SecurityInsightsClient : ServiceClient - /// API version for the operation + /// The ID of the target subscription. /// - public string ApiVersion { get; private set; } + public string SubscriptionId { get; set; } /// - /// Azure subscription ID + /// The API version to use for this operation. /// - public string SubscriptionId { get; set; } + public string ApiVersion { get; private set; } /// /// The preferred language for the response. @@ -75,11 +75,6 @@ public partial class SecurityInsightsClient : ServiceClient public bool? GenerateClientRequestId { get; set; } - /// - /// Gets the IOperations. - /// - public virtual IOperations Operations { get; private set; } - /// /// Gets the IAlertRulesOperations. /// @@ -95,15 +90,60 @@ public partial class SecurityInsightsClient : ServiceClient public virtual IAlertRuleTemplatesOperations AlertRuleTemplates { get; private set; } + /// + /// Gets the IAutomationRulesOperations. + /// + public virtual IAutomationRulesOperations AutomationRules { get; private set; } + /// /// Gets the IBookmarksOperations. /// public virtual IBookmarksOperations Bookmarks { get; private set; } /// - /// Gets the IDataConnectorsOperations. + /// Gets the IBookmarkRelationsOperations. /// - public virtual IDataConnectorsOperations DataConnectors { get; private set; } + public virtual IBookmarkRelationsOperations BookmarkRelations { get; private set; } + + /// + /// Gets the IBookmarkOperations. + /// + public virtual IBookmarkOperations Bookmark { get; private set; } + + /// + /// Gets the IIPGeodataOperations. + /// + public virtual IIPGeodataOperations IPGeodata { get; private set; } + + /// + /// Gets the IDomainWhoisOperations. + /// + public virtual IDomainWhoisOperations DomainWhois { get; private set; } + + /// + /// Gets the IEntityQueriesOperations. + /// + public virtual IEntityQueriesOperations EntityQueries { get; private set; } + + /// + /// Gets the IEntitiesOperations. + /// + public virtual IEntitiesOperations Entities { get; private set; } + + /// + /// Gets the IEntitiesGetTimelineOperations. + /// + public virtual IEntitiesGetTimelineOperations EntitiesGetTimeline { get; private set; } + + /// + /// Gets the IEntitiesRelationsOperations. + /// + public virtual IEntitiesRelationsOperations EntitiesRelations { get; private set; } + + /// + /// Gets the IEntityRelationsOperations. + /// + public virtual IEntityRelationsOperations EntityRelations { get; private set; } /// /// Gets the IIncidentsOperations. @@ -115,6 +155,86 @@ public partial class SecurityInsightsClient : ServiceClient public virtual IIncidentCommentsOperations IncidentComments { get; private set; } + /// + /// Gets the IIncidentRelationsOperations. + /// + public virtual IIncidentRelationsOperations IncidentRelations { get; private set; } + + /// + /// Gets the IMetadataOperations. + /// + public virtual IMetadataOperations Metadata { get; private set; } + + /// + /// Gets the ISentinelOnboardingStatesOperations. + /// + public virtual ISentinelOnboardingStatesOperations SentinelOnboardingStates { get; private set; } + + /// + /// Gets the IProductSettingsOperations. + /// + public virtual IProductSettingsOperations ProductSettings { get; private set; } + + /// + /// Gets the ISourceControlOperations. + /// + public virtual ISourceControlOperations SourceControl { get; private set; } + + /// + /// Gets the ISourceControlsOperations. + /// + public virtual ISourceControlsOperations SourceControls { get; private set; } + + /// + /// Gets the IWatchlistsOperations. + /// + public virtual IWatchlistsOperations Watchlists { get; private set; } + + /// + /// Gets the IWatchlistItemsOperations. + /// + public virtual IWatchlistItemsOperations WatchlistItems { get; private set; } + + /// + /// Gets the IDataConnectorsOperations. + /// + public virtual IDataConnectorsOperations DataConnectors { get; private set; } + + /// + /// Gets the IDataConnectorsCheckRequirementsOperations. + /// + public virtual IDataConnectorsCheckRequirementsOperations DataConnectorsCheckRequirements { get; private set; } + + /// + /// Gets the IThreatIntelligenceIndicatorOperations. + /// + public virtual IThreatIntelligenceIndicatorOperations ThreatIntelligenceIndicator { get; private set; } + + /// + /// Gets the IThreatIntelligenceIndicatorsOperations. + /// + public virtual IThreatIntelligenceIndicatorsOperations ThreatIntelligenceIndicators { get; private set; } + + /// + /// Gets the IThreatIntelligenceIndicatorMetricsOperations. + /// + public virtual IThreatIntelligenceIndicatorMetricsOperations ThreatIntelligenceIndicatorMetrics { get; private set; } + + /// + /// Gets the IOperations. + /// + public virtual IOperations Operations { get; private set; } + + /// + /// Gets the IOfficeConsentsOperations. + /// + public virtual IOfficeConsentsOperations OfficeConsents { get; private set; } + + /// + /// Gets the IEntityQueryTemplatesOperations. + /// + public virtual IEntityQueryTemplatesOperations EntityQueryTemplates { get; private set; } + /// /// Initializes a new instance of the SecurityInsightsClient class. /// @@ -356,16 +476,40 @@ public SecurityInsightsClient(System.Uri baseUri, ServiceClientCredentials crede /// private void Initialize() { - Operations = new Operations(this); AlertRules = new AlertRulesOperations(this); Actions = new ActionsOperations(this); AlertRuleTemplates = new AlertRuleTemplatesOperations(this); + AutomationRules = new AutomationRulesOperations(this); Bookmarks = new BookmarksOperations(this); - DataConnectors = new DataConnectorsOperations(this); + BookmarkRelations = new BookmarkRelationsOperations(this); + Bookmark = new BookmarkOperations(this); + IPGeodata = new IPGeodataOperations(this); + DomainWhois = new DomainWhoisOperations(this); + EntityQueries = new EntityQueriesOperations(this); + Entities = new EntitiesOperations(this); + EntitiesGetTimeline = new EntitiesGetTimelineOperations(this); + EntitiesRelations = new EntitiesRelationsOperations(this); + EntityRelations = new EntityRelationsOperations(this); Incidents = new IncidentsOperations(this); IncidentComments = new IncidentCommentsOperations(this); + IncidentRelations = new IncidentRelationsOperations(this); + Metadata = new MetadataOperations(this); + SentinelOnboardingStates = new SentinelOnboardingStatesOperations(this); + ProductSettings = new ProductSettingsOperations(this); + SourceControl = new SourceControlOperations(this); + SourceControls = new SourceControlsOperations(this); + Watchlists = new WatchlistsOperations(this); + WatchlistItems = new WatchlistItemsOperations(this); + DataConnectors = new DataConnectorsOperations(this); + DataConnectorsCheckRequirements = new DataConnectorsCheckRequirementsOperations(this); + ThreatIntelligenceIndicator = new ThreatIntelligenceIndicatorOperations(this); + ThreatIntelligenceIndicators = new ThreatIntelligenceIndicatorsOperations(this); + ThreatIntelligenceIndicatorMetrics = new ThreatIntelligenceIndicatorMetricsOperations(this); + Operations = new Operations(this); + OfficeConsents = new OfficeConsentsOperations(this); + EntityQueryTemplates = new EntityQueryTemplatesOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2020-01-01"; + ApiVersion = "2021-09-01-preview"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; @@ -399,10 +543,30 @@ private void Initialize() DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("kind")); SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("kind")); DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("kind")); - SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("kind")); - DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("kind")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("conditionType")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("conditionType")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("actionType")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("actionType")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("kind")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("kind")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("kind")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("kind")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("kind")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("kind")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("kind")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("kind")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("kind")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("kind")); SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("kind")); DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("kind")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("kind")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("kind")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("kind")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("kind")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("kind")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("kind")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("kind")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("kind")); CustomInitialize(); DeserializationSettings.Converters.Add(new TransformationJsonConverter()); DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/SentinelOnboardingStatesOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/SentinelOnboardingStatesOperations.cs new file mode 100644 index 0000000000000..644f7ff89d7c1 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/SentinelOnboardingStatesOperations.cs @@ -0,0 +1,1066 @@ +// +// 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; + + /// + /// SentinelOnboardingStatesOperations operations. + /// + internal partial class SentinelOnboardingStatesOperations : IServiceOperations, ISentinelOnboardingStatesOperations + { + /// + /// Initializes a new instance of the SentinelOnboardingStatesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal SentinelOnboardingStatesOperations(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 Sentinel onboarding state + /// + /// + /// 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 Sentinel onboarding state name. Supports - default + /// + /// + /// 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 sentinelOnboardingStateName, 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 (sentinelOnboardingStateName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sentinelOnboardingStateName"); + } + // 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("sentinelOnboardingStateName", sentinelOnboardingStateName); + 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/onboardingStates/{sentinelOnboardingStateName}").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("{sentinelOnboardingStateName}", System.Uri.EscapeDataString(sentinelOnboardingStateName)); + 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; + } + + /// + /// Create Sentinel onboarding state + /// + /// + /// 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 Sentinel onboarding state name. Supports - default + /// + /// + /// Etag of the azure resource + /// + /// + /// Flag that indicates the status of the CMK setting + /// + /// + /// 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> CreateWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string sentinelOnboardingStateName, string etag = default(string), bool? customerManagedKey = default(bool?), 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 (sentinelOnboardingStateName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sentinelOnboardingStateName"); + } + SentinelOnboardingState sentinelOnboardingStateParameter = default(SentinelOnboardingState); + if (etag != null || customerManagedKey != null) + { + sentinelOnboardingStateParameter = new SentinelOnboardingState(); + sentinelOnboardingStateParameter.Etag = etag; + sentinelOnboardingStateParameter.CustomerManagedKey = customerManagedKey; + } + // 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("sentinelOnboardingStateName", sentinelOnboardingStateName); + tracingParameters.Add("sentinelOnboardingStateParameter", sentinelOnboardingStateParameter); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", 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/onboardingStates/{sentinelOnboardingStateName}").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("{sentinelOnboardingStateName}", System.Uri.EscapeDataString(sentinelOnboardingStateName)); + 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(sentinelOnboardingStateParameter != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(sentinelOnboardingStateParameter, 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 Sentinel onboarding state + /// + /// + /// 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 Sentinel onboarding state name. Supports - default + /// + /// + /// 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 sentinelOnboardingStateName, 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 (sentinelOnboardingStateName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sentinelOnboardingStateName"); + } + // 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("sentinelOnboardingStateName", sentinelOnboardingStateName); + 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/onboardingStates/{sentinelOnboardingStateName}").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("{sentinelOnboardingStateName}", System.Uri.EscapeDataString(sentinelOnboardingStateName)); + 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 Sentinel onboarding states + /// + /// + /// 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/onboardingStates").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; + } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/SentinelOnboardingStatesOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/SentinelOnboardingStatesOperationsExtensions.cs new file mode 100644 index 0000000000000..bf950c51ed785 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/SentinelOnboardingStatesOperationsExtensions.cs @@ -0,0 +1,244 @@ +// +// 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 SentinelOnboardingStatesOperations. + /// + public static partial class SentinelOnboardingStatesOperationsExtensions + { + /// + /// Get Sentinel onboarding state + /// + /// + /// 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 Sentinel onboarding state name. Supports - default + /// + public static SentinelOnboardingState Get(this ISentinelOnboardingStatesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string sentinelOnboardingStateName) + { + return operations.GetAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, sentinelOnboardingStateName).GetAwaiter().GetResult(); + } + + /// + /// Get Sentinel onboarding state + /// + /// + /// 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 Sentinel onboarding state name. Supports - default + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ISentinelOnboardingStatesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string sentinelOnboardingStateName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, sentinelOnboardingStateName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create Sentinel onboarding state + /// + /// + /// 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 Sentinel onboarding state name. Supports - default + /// + /// + /// Etag of the azure resource + /// + /// + /// Flag that indicates the status of the CMK setting + /// + public static SentinelOnboardingState Create(this ISentinelOnboardingStatesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string sentinelOnboardingStateName, string etag = default(string), bool? customerManagedKey = default(bool?)) + { + return operations.CreateAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, sentinelOnboardingStateName, etag, customerManagedKey).GetAwaiter().GetResult(); + } + + /// + /// Create Sentinel onboarding state + /// + /// + /// 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 Sentinel onboarding state name. Supports - default + /// + /// + /// Etag of the azure resource + /// + /// + /// Flag that indicates the status of the CMK setting + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this ISentinelOnboardingStatesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string sentinelOnboardingStateName, string etag = default(string), bool? customerManagedKey = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, sentinelOnboardingStateName, etag, customerManagedKey, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete Sentinel onboarding state + /// + /// + /// 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 Sentinel onboarding state name. Supports - default + /// + public static void Delete(this ISentinelOnboardingStatesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string sentinelOnboardingStateName) + { + operations.DeleteAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, sentinelOnboardingStateName).GetAwaiter().GetResult(); + } + + /// + /// Delete Sentinel onboarding state + /// + /// + /// 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 Sentinel onboarding state name. Supports - default + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ISentinelOnboardingStatesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string sentinelOnboardingStateName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, sentinelOnboardingStateName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets all Sentinel onboarding states + /// + /// + /// 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 SentinelOnboardingStatesList List(this ISentinelOnboardingStatesOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName) + { + return operations.ListAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Gets all Sentinel onboarding states + /// + /// + /// 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 ISentinelOnboardingStatesOperations 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; + } + } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/SourceControlOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/SourceControlOperations.cs new file mode 100644 index 0000000000000..9e6b193d4143c --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/SourceControlOperations.cs @@ -0,0 +1,483 @@ +// +// 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; + + /// + /// SourceControlOperations operations. + /// + internal partial class SourceControlOperations : IServiceOperations, ISourceControlOperations + { + /// + /// Initializes a new instance of the SourceControlOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal SourceControlOperations(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 a list of repositories metadata. + /// + /// + /// 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 repo type. Possible values include: 'Github', 'DevOps' + /// + /// + /// 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>> ListRepositoriesWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string repoType, 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 (repoType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "repoType"); + } + // 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("repoType", repoType); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListRepositories", 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/listRepositories").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(repoType != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(repoType, 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 a list of repositories metadata. + /// + /// + /// 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>> ListRepositoriesNextWithHttpMessagesAsync(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, "ListRepositoriesNext", 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("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 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/SourceControlOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/SourceControlOperationsExtensions.cs new file mode 100644 index 0000000000000..deb656564c4af --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/SourceControlOperationsExtensions.cs @@ -0,0 +1,113 @@ +// +// 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 SourceControlOperations. + /// + public static partial class SourceControlOperationsExtensions + { + /// + /// Gets a list of repositories metadata. + /// + /// + /// 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 repo type. Possible values include: 'Github', 'DevOps' + /// + public static IPage ListRepositories(this ISourceControlOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string repoType) + { + return operations.ListRepositoriesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, repoType).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of repositories metadata. + /// + /// + /// 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 repo type. Possible values include: 'Github', 'DevOps' + /// + /// + /// The cancellation token. + /// + public static async Task> ListRepositoriesAsync(this ISourceControlOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string repoType, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListRepositoriesWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, repoType, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of repositories metadata. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListRepositoriesNext(this ISourceControlOperations operations, string nextPageLink) + { + return operations.ListRepositoriesNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of repositories metadata. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListRepositoriesNextAsync(this ISourceControlOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListRepositoriesNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/SourceControlsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/SourceControlsOperations.cs new file mode 100644 index 0000000000000..ecb44184411e0 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/SourceControlsOperations.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; + + /// + /// SourceControlsOperations operations. + /// + internal partial class SourceControlsOperations : IServiceOperations, ISourceControlsOperations + { + /// + /// Initializes a new instance of the SourceControlsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal SourceControlsOperations(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 source controls, without source control items. + /// + /// + /// 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/sourcecontrols").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 a source control byt its identifier. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Source control 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 sourceControlId, 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 (sourceControlId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sourceControlId"); + } + // 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("sourceControlId", sourceControlId); + 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/sourcecontrols/{sourceControlId}").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("{sourceControlId}", System.Uri.EscapeDataString(sourceControlId)); + 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; + } + + /// + /// Delete a source control. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Source control 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 sourceControlId, 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 (sourceControlId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sourceControlId"); + } + // 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("sourceControlId", sourceControlId); + 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/sourcecontrols/{sourceControlId}").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("{sourceControlId}", System.Uri.EscapeDataString(sourceControlId)); + 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; + } + + /// + /// Creates a source control. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Source control Id + /// + /// + /// The SourceControl + /// + /// + /// 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> CreateWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string sourceControlId, SourceControl sourceControl, 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 (sourceControlId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sourceControlId"); + } + if (sourceControl == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sourceControl"); + } + if (sourceControl != null) + { + sourceControl.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("sourceControlId", sourceControlId); + tracingParameters.Add("sourceControl", sourceControl); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", 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/sourcecontrols/{sourceControlId}").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("{sourceControlId}", System.Uri.EscapeDataString(sourceControlId)); + 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(sourceControl != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(sourceControl, 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; + } + + /// + /// Gets all source controls, without source control items. + /// + /// + /// 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/SourceControlsOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/SourceControlsOperationsExtensions.cs new file mode 100644 index 0000000000000..50d50d18e63f9 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/SourceControlsOperationsExtensions.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 SourceControlsOperations. + /// + public static partial class SourceControlsOperationsExtensions + { + /// + /// Gets all source controls, without source control items. + /// + /// + /// 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 ISourceControlsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName) + { + return operations.ListAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Gets all source controls, without source control items. + /// + /// + /// 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 ISourceControlsOperations 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 a source control byt its identifier. + /// + /// + /// 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. + /// + /// + /// Source control Id + /// + public static SourceControl Get(this ISourceControlsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string sourceControlId) + { + return operations.GetAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, sourceControlId).GetAwaiter().GetResult(); + } + + /// + /// Gets a source control byt its identifier. + /// + /// + /// 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. + /// + /// + /// Source control Id + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ISourceControlsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string sourceControlId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, sourceControlId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a source control. + /// + /// + /// 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. + /// + /// + /// Source control Id + /// + public static void Delete(this ISourceControlsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string sourceControlId) + { + operations.DeleteAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, sourceControlId).GetAwaiter().GetResult(); + } + + /// + /// Delete a source control. + /// + /// + /// 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. + /// + /// + /// Source control Id + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ISourceControlsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string sourceControlId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, sourceControlId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Creates a source control. + /// + /// + /// 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. + /// + /// + /// Source control Id + /// + /// + /// The SourceControl + /// + public static SourceControl Create(this ISourceControlsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string sourceControlId, SourceControl sourceControl) + { + return operations.CreateAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, sourceControlId, sourceControl).GetAwaiter().GetResult(); + } + + /// + /// Creates a source control. + /// + /// + /// 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. + /// + /// + /// Source control Id + /// + /// + /// The SourceControl + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this ISourceControlsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string sourceControlId, SourceControl sourceControl, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, sourceControlId, sourceControl, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all source controls, without source control items. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ISourceControlsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all source controls, without source control items. + /// + /// + /// 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 ISourceControlsOperations 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/ThreatIntelligenceIndicatorMetricsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ThreatIntelligenceIndicatorMetricsOperations.cs new file mode 100644 index 0000000000000..ab35d16caa436 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ThreatIntelligenceIndicatorMetricsOperations.cs @@ -0,0 +1,297 @@ +// +// 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; + + /// + /// ThreatIntelligenceIndicatorMetricsOperations operations. + /// + internal partial class ThreatIntelligenceIndicatorMetricsOperations : IServiceOperations, IThreatIntelligenceIndicatorMetricsOperations + { + /// + /// Initializes a new instance of the ThreatIntelligenceIndicatorMetricsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ThreatIntelligenceIndicatorMetricsOperations(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 threat intelligence indicators metrics (Indicators counts by Type, + /// Threat Type, Source). + /// + /// + /// 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/threatIntelligence/main/metrics").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; + } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ThreatIntelligenceIndicatorMetricsOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ThreatIntelligenceIndicatorMetricsOperationsExtensions.cs new file mode 100644 index 0000000000000..2c21ad4c8ebbc --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ThreatIntelligenceIndicatorMetricsOperationsExtensions.cs @@ -0,0 +1,75 @@ +// +// 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 ThreatIntelligenceIndicatorMetricsOperations. + /// + public static partial class ThreatIntelligenceIndicatorMetricsOperationsExtensions + { + /// + /// Get threat intelligence indicators metrics (Indicators counts by Type, + /// Threat Type, Source). + /// + /// + /// 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 ThreatIntelligenceMetricsList List(this IThreatIntelligenceIndicatorMetricsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName) + { + return operations.ListAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Get threat intelligence indicators metrics (Indicators counts by Type, + /// Threat Type, Source). + /// + /// + /// 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 IThreatIntelligenceIndicatorMetricsOperations 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; + } + } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ThreatIntelligenceIndicatorOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ThreatIntelligenceIndicatorOperations.cs new file mode 100644 index 0000000000000..d2b992b828e4d --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ThreatIntelligenceIndicatorOperations.cs @@ -0,0 +1,2031 @@ +// +// 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; + + /// + /// ThreatIntelligenceIndicatorOperations operations. + /// + internal partial class ThreatIntelligenceIndicatorOperations : IServiceOperations, IThreatIntelligenceIndicatorOperations + { + /// + /// Initializes a new instance of the ThreatIntelligenceIndicatorOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ThreatIntelligenceIndicatorOperations(SecurityInsightsClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SecurityInsightsClient + /// + public SecurityInsightsClient Client { get; private set; } + + /// + /// Create a new threat intelligence indicator. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Properties of threat intelligence indicators to create and 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> CreateIndicatorWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, ThreatIntelligenceIndicatorModelForRequestBody threatIntelligenceProperties, 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 (threatIntelligenceProperties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "threatIntelligenceProperties"); + } + // 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("threatIntelligenceProperties", threatIntelligenceProperties); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateIndicator", 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/threatIntelligence/main/createIndicator").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(threatIntelligenceProperties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(threatIntelligenceProperties, 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; + } + + /// + /// View a threat intelligence indicator by name. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Threat intelligence indicator name field. + /// + /// + /// 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 name, 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 (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + // 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("name", name); + 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/threatIntelligence/main/indicators/{name}").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("{name}", System.Uri.EscapeDataString(name)); + 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; + } + + /// + /// Update a threat Intelligence indicator. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Threat intelligence indicator name field. + /// + /// + /// Properties of threat intelligence indicators to create and 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> CreateWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string name, ThreatIntelligenceIndicatorModelForRequestBody threatIntelligenceProperties, 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 (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (threatIntelligenceProperties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "threatIntelligenceProperties"); + } + // 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("name", name); + tracingParameters.Add("threatIntelligenceProperties", threatIntelligenceProperties); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Create", 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/threatIntelligence/main/indicators/{name}").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("{name}", System.Uri.EscapeDataString(name)); + 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(threatIntelligenceProperties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(threatIntelligenceProperties, 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 a threat intelligence indicator. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Threat intelligence indicator name field. + /// + /// + /// 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 name, 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 (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + // 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("name", name); + 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/threatIntelligence/main/indicators/{name}").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("{name}", System.Uri.EscapeDataString(name)); + 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; + } + + /// + /// Query threat intelligence indicators as per filtering criteria. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Filtering criteria for querying threat intelligence indicators. + /// + /// + /// 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>> QueryIndicatorsWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, ThreatIntelligenceFilteringCriteria threatIntelligenceFilteringCriteria, 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 (threatIntelligenceFilteringCriteria == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "threatIntelligenceFilteringCriteria"); + } + // 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("threatIntelligenceFilteringCriteria", threatIntelligenceFilteringCriteria); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "QueryIndicators", 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/threatIntelligence/main/queryIndicators").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(threatIntelligenceFilteringCriteria != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(threatIntelligenceFilteringCriteria, 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; + } + + /// + /// Append tags to a threat intelligence indicator. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Threat intelligence indicator name field. + /// + /// + /// List of tags to be appended. + /// + /// + /// 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 AppendTagsWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string name, IList threatIntelligenceTags = default(IList), 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 (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + ThreatIntelligenceAppendTags threatIntelligenceAppendTags = new ThreatIntelligenceAppendTags(); + if (threatIntelligenceTags != null) + { + threatIntelligenceAppendTags.ThreatIntelligenceTags = threatIntelligenceTags; + } + // 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("name", name); + tracingParameters.Add("threatIntelligenceAppendTags", threatIntelligenceAppendTags); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "AppendTags", 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/threatIntelligence/main/indicators/{name}/appendTags").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("{name}", System.Uri.EscapeDataString(name)); + 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(threatIntelligenceAppendTags != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(threatIntelligenceAppendTags, 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(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Replace tags added to a threat intelligence indicator. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Threat intelligence indicator name field. + /// + /// + /// Tags in the threat intelligence indicator to be replaced. + /// + /// + /// 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> ReplaceTagsWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string name, ThreatIntelligenceIndicatorModelForRequestBody threatIntelligenceReplaceTags, 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 (name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "name"); + } + if (threatIntelligenceReplaceTags == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "threatIntelligenceReplaceTags"); + } + // 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("name", name); + tracingParameters.Add("threatIntelligenceReplaceTags", threatIntelligenceReplaceTags); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ReplaceTags", 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/threatIntelligence/main/indicators/{name}/replaceTags").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("{name}", System.Uri.EscapeDataString(name)); + 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(threatIntelligenceReplaceTags != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(threatIntelligenceReplaceTags, 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; + } + + /// + /// Query threat intelligence indicators as per filtering criteria. + /// + /// + /// 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>> QueryIndicatorsNextWithHttpMessagesAsync(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, "QueryIndicatorsNext", 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("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 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/ThreatIntelligenceIndicatorOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ThreatIntelligenceIndicatorOperationsExtensions.cs new file mode 100644 index 0000000000000..dd71617e20018 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ThreatIntelligenceIndicatorOperationsExtensions.cs @@ -0,0 +1,451 @@ +// +// 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.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ThreatIntelligenceIndicatorOperations. + /// + public static partial class ThreatIntelligenceIndicatorOperationsExtensions + { + /// + /// Create a new threat intelligence indicator. + /// + /// + /// 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. + /// + /// + /// Properties of threat intelligence indicators to create and update. + /// + public static ThreatIntelligenceInformation CreateIndicator(this IThreatIntelligenceIndicatorOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, ThreatIntelligenceIndicatorModelForRequestBody threatIntelligenceProperties) + { + return operations.CreateIndicatorAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, threatIntelligenceProperties).GetAwaiter().GetResult(); + } + + /// + /// Create a new threat intelligence indicator. + /// + /// + /// 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. + /// + /// + /// Properties of threat intelligence indicators to create and update. + /// + /// + /// The cancellation token. + /// + public static async Task CreateIndicatorAsync(this IThreatIntelligenceIndicatorOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, ThreatIntelligenceIndicatorModelForRequestBody threatIntelligenceProperties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateIndicatorWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, threatIntelligenceProperties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// View a threat intelligence indicator by name. + /// + /// + /// 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. + /// + /// + /// Threat intelligence indicator name field. + /// + public static ThreatIntelligenceInformation Get(this IThreatIntelligenceIndicatorOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string name) + { + return operations.GetAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, name).GetAwaiter().GetResult(); + } + + /// + /// View a threat intelligence indicator by name. + /// + /// + /// 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. + /// + /// + /// Threat intelligence indicator name field. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IThreatIntelligenceIndicatorOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, name, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a threat Intelligence indicator. + /// + /// + /// 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. + /// + /// + /// Threat intelligence indicator name field. + /// + /// + /// Properties of threat intelligence indicators to create and update. + /// + public static ThreatIntelligenceInformation Create(this IThreatIntelligenceIndicatorOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string name, ThreatIntelligenceIndicatorModelForRequestBody threatIntelligenceProperties) + { + return operations.CreateAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, name, threatIntelligenceProperties).GetAwaiter().GetResult(); + } + + /// + /// Update a threat Intelligence indicator. + /// + /// + /// 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. + /// + /// + /// Threat intelligence indicator name field. + /// + /// + /// Properties of threat intelligence indicators to create and update. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IThreatIntelligenceIndicatorOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string name, ThreatIntelligenceIndicatorModelForRequestBody threatIntelligenceProperties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, name, threatIntelligenceProperties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a threat intelligence indicator. + /// + /// + /// 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. + /// + /// + /// Threat intelligence indicator name field. + /// + public static void Delete(this IThreatIntelligenceIndicatorOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string name) + { + operations.DeleteAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, name).GetAwaiter().GetResult(); + } + + /// + /// Delete a threat intelligence indicator. + /// + /// + /// 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. + /// + /// + /// Threat intelligence indicator name field. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IThreatIntelligenceIndicatorOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string name, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Query threat intelligence indicators as per filtering criteria. + /// + /// + /// 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. + /// + /// + /// Filtering criteria for querying threat intelligence indicators. + /// + public static IPage QueryIndicators(this IThreatIntelligenceIndicatorOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, ThreatIntelligenceFilteringCriteria threatIntelligenceFilteringCriteria) + { + return operations.QueryIndicatorsAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, threatIntelligenceFilteringCriteria).GetAwaiter().GetResult(); + } + + /// + /// Query threat intelligence indicators as per filtering criteria. + /// + /// + /// 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. + /// + /// + /// Filtering criteria for querying threat intelligence indicators. + /// + /// + /// The cancellation token. + /// + public static async Task> QueryIndicatorsAsync(this IThreatIntelligenceIndicatorOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, ThreatIntelligenceFilteringCriteria threatIntelligenceFilteringCriteria, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.QueryIndicatorsWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, threatIntelligenceFilteringCriteria, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Append tags to a threat intelligence indicator. + /// + /// + /// 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. + /// + /// + /// Threat intelligence indicator name field. + /// + /// + /// List of tags to be appended. + /// + public static void AppendTags(this IThreatIntelligenceIndicatorOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string name, IList threatIntelligenceTags = default(IList)) + { + operations.AppendTagsAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, name, threatIntelligenceTags).GetAwaiter().GetResult(); + } + + /// + /// Append tags to a threat intelligence indicator. + /// + /// + /// 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. + /// + /// + /// Threat intelligence indicator name field. + /// + /// + /// List of tags to be appended. + /// + /// + /// The cancellation token. + /// + public static async Task AppendTagsAsync(this IThreatIntelligenceIndicatorOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string name, IList threatIntelligenceTags = default(IList), CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.AppendTagsWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, name, threatIntelligenceTags, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Replace tags added to a threat intelligence indicator. + /// + /// + /// 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. + /// + /// + /// Threat intelligence indicator name field. + /// + /// + /// Tags in the threat intelligence indicator to be replaced. + /// + public static ThreatIntelligenceInformation ReplaceTags(this IThreatIntelligenceIndicatorOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string name, ThreatIntelligenceIndicatorModelForRequestBody threatIntelligenceReplaceTags) + { + return operations.ReplaceTagsAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, name, threatIntelligenceReplaceTags).GetAwaiter().GetResult(); + } + + /// + /// Replace tags added to a threat intelligence indicator. + /// + /// + /// 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. + /// + /// + /// Threat intelligence indicator name field. + /// + /// + /// Tags in the threat intelligence indicator to be replaced. + /// + /// + /// The cancellation token. + /// + public static async Task ReplaceTagsAsync(this IThreatIntelligenceIndicatorOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string name, ThreatIntelligenceIndicatorModelForRequestBody threatIntelligenceReplaceTags, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ReplaceTagsWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, name, threatIntelligenceReplaceTags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Query threat intelligence indicators as per filtering criteria. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage QueryIndicatorsNext(this IThreatIntelligenceIndicatorOperations operations, string nextPageLink) + { + return operations.QueryIndicatorsNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Query threat intelligence indicators as per filtering criteria. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> QueryIndicatorsNextAsync(this IThreatIntelligenceIndicatorOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.QueryIndicatorsNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ThreatIntelligenceIndicatorsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ThreatIntelligenceIndicatorsOperations.cs new file mode 100644 index 0000000000000..b915b2a656dcd --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ThreatIntelligenceIndicatorsOperations.cs @@ -0,0 +1,504 @@ +// +// 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; + + /// + /// ThreatIntelligenceIndicatorsOperations operations. + /// + internal partial class ThreatIntelligenceIndicatorsOperations : IServiceOperations, IThreatIntelligenceIndicatorsOperations + { + /// + /// Initializes a new instance of the ThreatIntelligenceIndicatorsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ThreatIntelligenceIndicatorsOperations(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 all threat intelligence indicators. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Filters the results, based on a Boolean condition. Optional. + /// + /// + /// Sorts the results. Optional. + /// + /// + /// Returns only the first n results. Optional. + /// + /// + /// 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 filter = default(string), string orderby = default(string), int? top = default(int?), 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); + } + } + // 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("filter", filter); + tracingParameters.Add("orderby", orderby); + tracingParameters.Add("top", top); + 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/threatIntelligence/main/indicators").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 (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (orderby != null) + { + _queryParameters.Add(string.Format("$orderby={0}", System.Uri.EscapeDataString(orderby))); + } + if (top != null) + { + _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); + } + 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; + } + + /// + /// Get all threat intelligence indicators. + /// + /// + /// 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/ThreatIntelligenceIndicatorsOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ThreatIntelligenceIndicatorsOperationsExtensions.cs new file mode 100644 index 0000000000000..bac8e5493b9f4 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ThreatIntelligenceIndicatorsOperationsExtensions.cs @@ -0,0 +1,137 @@ +// +// 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 ThreatIntelligenceIndicatorsOperations. + /// + public static partial class ThreatIntelligenceIndicatorsOperationsExtensions + { + /// + /// Get all threat intelligence indicators. + /// + /// + /// 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. + /// + /// + /// Filters the results, based on a Boolean condition. Optional. + /// + /// + /// Sorts the results. Optional. + /// + /// + /// Returns only the first n results. Optional. + /// + /// + /// 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 IThreatIntelligenceIndicatorsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string filter = default(string), string orderby = default(string), int? top = default(int?), string skipToken = default(string)) + { + return operations.ListAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, filter, orderby, top, skipToken).GetAwaiter().GetResult(); + } + + /// + /// Get all threat intelligence indicators. + /// + /// + /// 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. + /// + /// + /// Filters the results, based on a Boolean condition. Optional. + /// + /// + /// Sorts the results. Optional. + /// + /// + /// Returns only the first n results. Optional. + /// + /// + /// 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 IThreatIntelligenceIndicatorsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string filter = default(string), string orderby = default(string), int? top = default(int?), string skipToken = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, filter, orderby, top, skipToken, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get all threat intelligence indicators. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IThreatIntelligenceIndicatorsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get all threat intelligence indicators. + /// + /// + /// 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 IThreatIntelligenceIndicatorsOperations 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/WatchlistItemsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/WatchlistItemsOperations.cs new file mode 100644 index 0000000000000..710eada60fe7b --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/WatchlistItemsOperations.cs @@ -0,0 +1,1273 @@ +// +// 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; + + /// + /// WatchlistItemsOperations operations. + /// + internal partial class WatchlistItemsOperations : IServiceOperations, IWatchlistItemsOperations + { + /// + /// Initializes a new instance of the WatchlistItemsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal WatchlistItemsOperations(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 watchlist Items. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Watchlist Alias + /// + /// + /// 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 watchlistAlias, 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 (watchlistAlias == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "watchlistAlias"); + } + // 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("watchlistAlias", watchlistAlias); + 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/watchlists/{watchlistAlias}/watchlistItems").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("{watchlistAlias}", System.Uri.EscapeDataString(watchlistAlias)); + 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 a watchlist, without its watchlist items. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Watchlist Alias + /// + /// + /// Watchlist Item Id (GUID) + /// + /// + /// 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 watchlistAlias, string watchlistItemId, 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 (watchlistAlias == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "watchlistAlias"); + } + if (watchlistItemId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "watchlistItemId"); + } + // 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("watchlistAlias", watchlistAlias); + tracingParameters.Add("watchlistItemId", watchlistItemId); + 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/watchlists/{watchlistAlias}/watchlistItems/{watchlistItemId}").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("{watchlistAlias}", System.Uri.EscapeDataString(watchlistAlias)); + _url = _url.Replace("{watchlistItemId}", System.Uri.EscapeDataString(watchlistItemId)); + 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; + } + + /// + /// Delete a watchlist item. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Watchlist Alias + /// + /// + /// Watchlist Item Id (GUID) + /// + /// + /// 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 watchlistAlias, string watchlistItemId, 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 (watchlistAlias == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "watchlistAlias"); + } + if (watchlistItemId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "watchlistItemId"); + } + // 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("watchlistAlias", watchlistAlias); + tracingParameters.Add("watchlistItemId", watchlistItemId); + 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/watchlists/{watchlistAlias}/watchlistItems/{watchlistItemId}").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("{watchlistAlias}", System.Uri.EscapeDataString(watchlistAlias)); + _url = _url.Replace("{watchlistItemId}", System.Uri.EscapeDataString(watchlistItemId)); + 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; + } + + /// + /// Creates or updates a watchlist item. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Watchlist Alias + /// + /// + /// Watchlist Item Id (GUID) + /// + /// + /// The watchlist item + /// + /// + /// 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 watchlistAlias, string watchlistItemId, WatchlistItem watchlistItem, 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 (watchlistAlias == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "watchlistAlias"); + } + if (watchlistItemId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "watchlistItemId"); + } + if (watchlistItem == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "watchlistItem"); + } + if (watchlistItem != null) + { + watchlistItem.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("watchlistAlias", watchlistAlias); + tracingParameters.Add("watchlistItemId", watchlistItemId); + tracingParameters.Add("watchlistItem", watchlistItem); + 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/watchlists/{watchlistAlias}/watchlistItems/{watchlistItemId}").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("{watchlistAlias}", System.Uri.EscapeDataString(watchlistAlias)); + _url = _url.Replace("{watchlistItemId}", System.Uri.EscapeDataString(watchlistItemId)); + 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(watchlistItem != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(watchlistItem, 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; + } + + /// + /// Gets all watchlist Items. + /// + /// + /// 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/WatchlistItemsOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/WatchlistItemsOperationsExtensions.cs new file mode 100644 index 0000000000000..454a57046815c --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/WatchlistItemsOperationsExtensions.cs @@ -0,0 +1,296 @@ +// +// 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 WatchlistItemsOperations. + /// + public static partial class WatchlistItemsOperationsExtensions + { + /// + /// Gets all watchlist Items. + /// + /// + /// 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. + /// + /// + /// Watchlist Alias + /// + public static IPage List(this IWatchlistItemsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string watchlistAlias) + { + return operations.ListAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, watchlistAlias).GetAwaiter().GetResult(); + } + + /// + /// Gets all watchlist Items. + /// + /// + /// 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. + /// + /// + /// Watchlist Alias + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IWatchlistItemsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string watchlistAlias, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, watchlistAlias, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a watchlist, without its watchlist items. + /// + /// + /// 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. + /// + /// + /// Watchlist Alias + /// + /// + /// Watchlist Item Id (GUID) + /// + public static WatchlistItem Get(this IWatchlistItemsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string watchlistAlias, string watchlistItemId) + { + return operations.GetAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, watchlistAlias, watchlistItemId).GetAwaiter().GetResult(); + } + + /// + /// Gets a watchlist, without its watchlist items. + /// + /// + /// 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. + /// + /// + /// Watchlist Alias + /// + /// + /// Watchlist Item Id (GUID) + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IWatchlistItemsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string watchlistAlias, string watchlistItemId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, watchlistAlias, watchlistItemId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a watchlist item. + /// + /// + /// 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. + /// + /// + /// Watchlist Alias + /// + /// + /// Watchlist Item Id (GUID) + /// + public static void Delete(this IWatchlistItemsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string watchlistAlias, string watchlistItemId) + { + operations.DeleteAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, watchlistAlias, watchlistItemId).GetAwaiter().GetResult(); + } + + /// + /// Delete a watchlist item. + /// + /// + /// 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. + /// + /// + /// Watchlist Alias + /// + /// + /// Watchlist Item Id (GUID) + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IWatchlistItemsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string watchlistAlias, string watchlistItemId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, watchlistAlias, watchlistItemId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Creates or updates a watchlist item. + /// + /// + /// 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. + /// + /// + /// Watchlist Alias + /// + /// + /// Watchlist Item Id (GUID) + /// + /// + /// The watchlist item + /// + public static WatchlistItem CreateOrUpdate(this IWatchlistItemsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string watchlistAlias, string watchlistItemId, WatchlistItem watchlistItem) + { + return operations.CreateOrUpdateAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, watchlistAlias, watchlistItemId, watchlistItem).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a watchlist item. + /// + /// + /// 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. + /// + /// + /// Watchlist Alias + /// + /// + /// Watchlist Item Id (GUID) + /// + /// + /// The watchlist item + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IWatchlistItemsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string watchlistAlias, string watchlistItemId, WatchlistItem watchlistItem, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, watchlistAlias, watchlistItemId, watchlistItem, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all watchlist Items. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IWatchlistItemsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all watchlist Items. + /// + /// + /// 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 IWatchlistItemsOperations 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/WatchlistsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/WatchlistsOperations.cs new file mode 100644 index 0000000000000..367b58dd242c1 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/WatchlistsOperations.cs @@ -0,0 +1,1239 @@ +// +// 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; + + /// + /// WatchlistsOperations operations. + /// + internal partial class WatchlistsOperations : IServiceOperations, IWatchlistsOperations + { + /// + /// Initializes a new instance of the WatchlistsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal WatchlistsOperations(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 watchlists, without watchlist items. + /// + /// + /// 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/watchlists").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 a watchlist, without its watchlist items. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Watchlist Alias + /// + /// + /// 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 watchlistAlias, 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 (watchlistAlias == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "watchlistAlias"); + } + // 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("watchlistAlias", watchlistAlias); + 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/watchlists/{watchlistAlias}").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("{watchlistAlias}", System.Uri.EscapeDataString(watchlistAlias)); + 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; + } + + /// + /// Delete a watchlist. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Watchlist Alias + /// + /// + /// 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 watchlistAlias, 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 (watchlistAlias == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "watchlistAlias"); + } + // 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("watchlistAlias", watchlistAlias); + 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/watchlists/{watchlistAlias}").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("{watchlistAlias}", System.Uri.EscapeDataString(watchlistAlias)); + 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; + } + + /// + /// Creates or updates a watchlist and its watchlist items (bulk creation, e.g. + /// through text/csv content type). To create a Watchlist and its items, we + /// should call this endpoint with rawContent and contentType properties. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The namespace of workspaces resource provider- + /// Microsoft.OperationalInsights. + /// + /// + /// The name of the workspace. + /// + /// + /// Watchlist Alias + /// + /// + /// The watchlist + /// + /// + /// 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 watchlistAlias, Watchlist watchlist, 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 (watchlistAlias == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "watchlistAlias"); + } + if (watchlist == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "watchlist"); + } + if (watchlist != null) + { + watchlist.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("watchlistAlias", watchlistAlias); + tracingParameters.Add("watchlist", watchlist); + 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/watchlists/{watchlistAlias}").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("{watchlistAlias}", System.Uri.EscapeDataString(watchlistAlias)); + 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(watchlist != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(watchlist, 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; + } + + /// + /// Gets all watchlists, without watchlist items. + /// + /// + /// 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/WatchlistsOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/WatchlistsOperationsExtensions.cs new file mode 100644 index 0000000000000..7e3ca59bc3eb2 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/WatchlistsOperationsExtensions.cs @@ -0,0 +1,276 @@ +// +// 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 WatchlistsOperations. + /// + public static partial class WatchlistsOperationsExtensions + { + /// + /// Gets all watchlists, without watchlist items. + /// + /// + /// 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 IWatchlistsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName) + { + return operations.ListAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName).GetAwaiter().GetResult(); + } + + /// + /// Gets all watchlists, without watchlist items. + /// + /// + /// 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 IWatchlistsOperations 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 a watchlist, without its watchlist items. + /// + /// + /// 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. + /// + /// + /// Watchlist Alias + /// + public static Watchlist Get(this IWatchlistsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string watchlistAlias) + { + return operations.GetAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, watchlistAlias).GetAwaiter().GetResult(); + } + + /// + /// Gets a watchlist, without its watchlist items. + /// + /// + /// 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. + /// + /// + /// Watchlist Alias + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IWatchlistsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string watchlistAlias, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, watchlistAlias, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a watchlist. + /// + /// + /// 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. + /// + /// + /// Watchlist Alias + /// + public static void Delete(this IWatchlistsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string watchlistAlias) + { + operations.DeleteAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, watchlistAlias).GetAwaiter().GetResult(); + } + + /// + /// Delete a watchlist. + /// + /// + /// 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. + /// + /// + /// Watchlist Alias + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IWatchlistsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string watchlistAlias, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, watchlistAlias, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Creates or updates a watchlist and its watchlist items (bulk creation, e.g. + /// through text/csv content type). To create a Watchlist and its items, we + /// should call this endpoint with rawContent and contentType properties. + /// + /// + /// 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. + /// + /// + /// Watchlist Alias + /// + /// + /// The watchlist + /// + public static Watchlist CreateOrUpdate(this IWatchlistsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string watchlistAlias, Watchlist watchlist) + { + return operations.CreateOrUpdateAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, watchlistAlias, watchlist).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a watchlist and its watchlist items (bulk creation, e.g. + /// through text/csv content type). To create a Watchlist and its items, we + /// should call this endpoint with rawContent and contentType properties. + /// + /// + /// 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. + /// + /// + /// Watchlist Alias + /// + /// + /// The watchlist + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IWatchlistsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string watchlistAlias, Watchlist watchlist, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, watchlistAlias, watchlist, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all watchlists, without watchlist items. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IWatchlistsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all watchlists, without watchlist items. + /// + /// + /// 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 IWatchlistsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +}