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..44c5dc6e767ae 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,7 @@ 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 name of the workspace. @@ -69,7 +68,7 @@ internal ActionsOperations(SecurityInsightsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -86,15 +85,26 @@ internal ActionsOperations(SecurityInsightsClient client) /// public async Task>> ListByAlertRuleWithHttpMessagesAsync(string resourceGroupName, 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 +121,6 @@ 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 (workspaceName == null) { @@ -220,14 +226,13 @@ internal ActionsOperations(SecurityInsightsClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -237,10 +242,6 @@ internal ActionsOperations(SecurityInsightsClient client) } 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); @@ -289,8 +290,7 @@ 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 name of the workspace. @@ -307,7 +307,7 @@ internal ActionsOperations(SecurityInsightsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -324,15 +324,26 @@ internal ActionsOperations(SecurityInsightsClient client) /// public async Task> GetWithHttpMessagesAsync(string resourceGroupName, 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 +360,6 @@ 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 (workspaceName == null) { @@ -464,14 +471,13 @@ internal ActionsOperations(SecurityInsightsClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -481,10 +487,6 @@ internal ActionsOperations(SecurityInsightsClient client) } 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); @@ -533,8 +535,7 @@ 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 name of the workspace. @@ -554,7 +555,7 @@ internal ActionsOperations(SecurityInsightsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -571,15 +572,26 @@ internal ActionsOperations(SecurityInsightsClient client) /// public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, 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 +608,6 @@ 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 (workspaceName == null) { @@ -726,14 +734,13 @@ internal ActionsOperations(SecurityInsightsClient client) string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 201) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -743,10 +750,6 @@ internal ActionsOperations(SecurityInsightsClient client) } 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); @@ -813,8 +816,7 @@ 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 name of the workspace. @@ -831,7 +833,7 @@ internal ActionsOperations(SecurityInsightsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -845,15 +847,26 @@ internal ActionsOperations(SecurityInsightsClient client) /// public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, 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 +883,6 @@ 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 (workspaceName == null) { @@ -985,14 +994,13 @@ internal ActionsOperations(SecurityInsightsClient client) string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 204) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1002,10 +1010,6 @@ internal ActionsOperations(SecurityInsightsClient client) } 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); @@ -1044,7 +1048,7 @@ internal ActionsOperations(SecurityInsightsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1140,14 +1144,13 @@ internal ActionsOperations(SecurityInsightsClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1157,10 +1160,6 @@ internal ActionsOperations(SecurityInsightsClient client) } 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); 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..acea07a714f04 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,7 @@ 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 name of the workspace. @@ -49,8 +48,7 @@ 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 name of the workspace. @@ -76,8 +74,7 @@ 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 name of the workspace. @@ -100,8 +97,7 @@ 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 name of the workspace. @@ -130,8 +126,7 @@ 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 name of the workspace. @@ -157,8 +152,7 @@ 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 name of the workspace. @@ -190,8 +184,7 @@ 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 name of the workspace. @@ -214,8 +207,7 @@ 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 name of the workspace. 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..79826efb27b97 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,7 @@ 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 name of the workspace. @@ -66,7 +65,7 @@ internal AlertRuleTemplatesOperations(SecurityInsightsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -83,15 +82,26 @@ internal AlertRuleTemplatesOperations(SecurityInsightsClient client) /// public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, 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 +118,6 @@ 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 (workspaceName == null) { @@ -211,14 +217,13 @@ internal AlertRuleTemplatesOperations(SecurityInsightsClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -228,10 +233,6 @@ internal AlertRuleTemplatesOperations(SecurityInsightsClient client) } 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); @@ -280,8 +281,7 @@ 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 name of the workspace. @@ -295,7 +295,7 @@ internal AlertRuleTemplatesOperations(SecurityInsightsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -312,15 +312,26 @@ internal AlertRuleTemplatesOperations(SecurityInsightsClient client) /// public async Task> GetWithHttpMessagesAsync(string resourceGroupName, 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 +348,6 @@ 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 (workspaceName == null) { @@ -446,14 +453,13 @@ internal AlertRuleTemplatesOperations(SecurityInsightsClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -463,10 +469,6 @@ internal AlertRuleTemplatesOperations(SecurityInsightsClient client) } 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); @@ -523,7 +525,7 @@ internal AlertRuleTemplatesOperations(SecurityInsightsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -619,14 +621,13 @@ internal AlertRuleTemplatesOperations(SecurityInsightsClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -636,10 +637,6 @@ internal AlertRuleTemplatesOperations(SecurityInsightsClient client) } 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); 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..fdd5d9d5f7e8c 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AlertRuleTemplatesOperationsExtensions.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AlertRuleTemplatesOperationsExtensions.cs @@ -28,8 +28,7 @@ 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 name of the workspace. @@ -46,8 +45,7 @@ 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 name of the workspace. @@ -70,8 +68,7 @@ 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 name of the workspace. @@ -91,8 +88,7 @@ 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 name of the workspace. 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..6847fc261f900 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,7 @@ 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 name of the workspace. @@ -66,7 +65,7 @@ internal AlertRulesOperations(SecurityInsightsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -83,15 +82,26 @@ internal AlertRulesOperations(SecurityInsightsClient client) /// public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, 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 +118,6 @@ 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 (workspaceName == null) { @@ -211,14 +217,13 @@ internal AlertRulesOperations(SecurityInsightsClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -228,10 +233,6 @@ internal AlertRulesOperations(SecurityInsightsClient client) } 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); @@ -280,8 +281,7 @@ 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 name of the workspace. @@ -295,7 +295,7 @@ internal AlertRulesOperations(SecurityInsightsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -312,15 +312,26 @@ internal AlertRulesOperations(SecurityInsightsClient client) /// public async Task> GetWithHttpMessagesAsync(string resourceGroupName, 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 +348,6 @@ 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 (workspaceName == null) { @@ -446,14 +453,13 @@ internal AlertRulesOperations(SecurityInsightsClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -463,10 +469,6 @@ internal AlertRulesOperations(SecurityInsightsClient client) } 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); @@ -515,8 +517,7 @@ 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 name of the workspace. @@ -533,7 +534,7 @@ internal AlertRulesOperations(SecurityInsightsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -550,15 +551,26 @@ internal AlertRulesOperations(SecurityInsightsClient client) /// public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, 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 +587,6 @@ 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 (workspaceName == null) { @@ -695,14 +703,13 @@ internal AlertRulesOperations(SecurityInsightsClient client) string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 201) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -712,10 +719,6 @@ internal AlertRulesOperations(SecurityInsightsClient client) } 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); @@ -782,8 +785,7 @@ 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 name of the workspace. @@ -797,7 +799,7 @@ internal AlertRulesOperations(SecurityInsightsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -811,15 +813,26 @@ internal AlertRulesOperations(SecurityInsightsClient client) /// public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, 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 +849,6 @@ 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 (workspaceName == null) { @@ -945,14 +954,13 @@ internal AlertRulesOperations(SecurityInsightsClient client) string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 204) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -962,10 +970,6 @@ internal AlertRulesOperations(SecurityInsightsClient client) } 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); @@ -1004,7 +1008,7 @@ internal AlertRulesOperations(SecurityInsightsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1100,14 +1104,13 @@ internal AlertRulesOperations(SecurityInsightsClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1117,10 +1120,6 @@ internal AlertRulesOperations(SecurityInsightsClient client) } 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); 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..a6cb51c14cabe 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AlertRulesOperationsExtensions.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AlertRulesOperationsExtensions.cs @@ -28,8 +28,7 @@ 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 name of the workspace. @@ -46,8 +45,7 @@ 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 name of the workspace. @@ -70,8 +68,7 @@ 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 name of the workspace. @@ -91,8 +88,7 @@ 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 name of the workspace. @@ -118,8 +114,7 @@ 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 name of the workspace. @@ -142,8 +137,7 @@ 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 name of the workspace. @@ -172,8 +166,7 @@ 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 name of the workspace. @@ -193,8 +186,7 @@ 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 name of the workspace. diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/BookmarksOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/BookmarksOperationsExtensions.cs deleted file mode 100644 index 00b4bf29cc5ad..0000000000000 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/BookmarksOperationsExtensions.cs +++ /dev/null @@ -1,248 +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 -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for BookmarksOperations. - /// - public static partial class BookmarksOperationsExtensions - { - /// - /// Gets all bookmarks. - /// - /// - /// 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 workspace. - /// - public static IPage List(this IBookmarksOperations operations, string resourceGroupName, string workspaceName) - { - return operations.ListAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); - } - - /// - /// Gets all bookmarks. - /// - /// - /// 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 workspace. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IBookmarksOperations operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets a bookmark. - /// - /// - /// 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 workspace. - /// - /// - /// Bookmark ID - /// - public static Bookmark Get(this IBookmarksOperations operations, string resourceGroupName, string workspaceName, string bookmarkId) - { - return operations.GetAsync(resourceGroupName, workspaceName, bookmarkId).GetAwaiter().GetResult(); - } - - /// - /// Gets a bookmark. - /// - /// - /// 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 workspace. - /// - /// - /// Bookmark ID - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IBookmarksOperations operations, string resourceGroupName, string workspaceName, string bookmarkId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, workspaceName, bookmarkId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Creates or updates the bookmark. - /// - /// - /// 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 workspace. - /// - /// - /// Bookmark ID - /// - /// - /// The bookmark - /// - public static Bookmark CreateOrUpdate(this IBookmarksOperations operations, string resourceGroupName, string workspaceName, string bookmarkId, Bookmark bookmark) - { - return operations.CreateOrUpdateAsync(resourceGroupName, workspaceName, bookmarkId, bookmark).GetAwaiter().GetResult(); - } - - /// - /// Creates or updates the bookmark. - /// - /// - /// 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 workspace. - /// - /// - /// Bookmark ID - /// - /// - /// The bookmark - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IBookmarksOperations operations, string resourceGroupName, string workspaceName, string bookmarkId, Bookmark bookmark, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, bookmarkId, bookmark, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Delete the bookmark. - /// - /// - /// 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 workspace. - /// - /// - /// Bookmark ID - /// - public static void Delete(this IBookmarksOperations operations, string resourceGroupName, string workspaceName, string bookmarkId) - { - operations.DeleteAsync(resourceGroupName, workspaceName, bookmarkId).GetAwaiter().GetResult(); - } - - /// - /// Delete the bookmark. - /// - /// - /// 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 workspace. - /// - /// - /// Bookmark ID - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IBookmarksOperations operations, string resourceGroupName, string workspaceName, string bookmarkId, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, bookmarkId, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Gets all bookmarks. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IBookmarksOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Gets all bookmarks. - /// - /// - /// 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 IBookmarksOperations 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/DataConnectorsOperationsExtensions.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/DataConnectorsOperationsExtensions.cs deleted file mode 100644 index 63790d1dae244..0000000000000 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/DataConnectorsOperationsExtensions.cs +++ /dev/null @@ -1,248 +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 -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for DataConnectorsOperations. - /// - public static partial class DataConnectorsOperationsExtensions - { - /// - /// Gets all data connectors. - /// - /// - /// 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 workspace. - /// - public static IPage List(this IDataConnectorsOperations operations, string resourceGroupName, string workspaceName) - { - return operations.ListAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); - } - - /// - /// Gets all data connectors. - /// - /// - /// 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 workspace. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IDataConnectorsOperations operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets a data connector. - /// - /// - /// 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 workspace. - /// - /// - /// Connector ID - /// - public static DataConnector Get(this IDataConnectorsOperations operations, string resourceGroupName, string workspaceName, string dataConnectorId) - { - return operations.GetAsync(resourceGroupName, workspaceName, dataConnectorId).GetAwaiter().GetResult(); - } - - /// - /// Gets a data connector. - /// - /// - /// 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 workspace. - /// - /// - /// Connector ID - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IDataConnectorsOperations operations, string resourceGroupName, string workspaceName, string dataConnectorId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, workspaceName, dataConnectorId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Creates or updates the data connector. - /// - /// - /// 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 workspace. - /// - /// - /// Connector ID - /// - /// - /// The data connector - /// - public static DataConnector CreateOrUpdate(this IDataConnectorsOperations operations, string resourceGroupName, string workspaceName, string dataConnectorId, DataConnector dataConnector) - { - return operations.CreateOrUpdateAsync(resourceGroupName, workspaceName, dataConnectorId, dataConnector).GetAwaiter().GetResult(); - } - - /// - /// Creates or updates the data connector. - /// - /// - /// 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 workspace. - /// - /// - /// Connector ID - /// - /// - /// The data connector - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IDataConnectorsOperations operations, string resourceGroupName, string workspaceName, string dataConnectorId, DataConnector dataConnector, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, dataConnectorId, dataConnector, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Delete the data connector. - /// - /// - /// 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 workspace. - /// - /// - /// Connector ID - /// - public static void Delete(this IDataConnectorsOperations operations, string resourceGroupName, string workspaceName, string dataConnectorId) - { - operations.DeleteAsync(resourceGroupName, workspaceName, dataConnectorId).GetAwaiter().GetResult(); - } - - /// - /// Delete the data connector. - /// - /// - /// 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 workspace. - /// - /// - /// Connector ID - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IDataConnectorsOperations operations, string resourceGroupName, string workspaceName, string dataConnectorId, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, dataConnectorId, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Gets all data connectors. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IDataConnectorsOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Gets all data connectors. - /// - /// - /// 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 IDataConnectorsOperations 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/IActionsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IActionsOperations.cs index f42d11eaf67f9..600f56ce88f51 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,7 @@ 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 name of the workspace. @@ -42,7 +41,7 @@ public partial interface IActionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -56,8 +55,7 @@ public partial interface IActionsOperations /// 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 name of the workspace. @@ -74,7 +72,7 @@ public partial interface IActionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -88,8 +86,7 @@ public partial interface IActionsOperations /// 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 name of the workspace. @@ -109,7 +106,7 @@ public partial interface IActionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -123,8 +120,7 @@ public partial interface IActionsOperations /// 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 name of the workspace. @@ -141,7 +137,7 @@ public partial interface IActionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -160,7 +156,7 @@ public partial interface IActionsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// 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..51aa9a0d54484 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,7 @@ 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 name of the workspace. @@ -39,7 +38,7 @@ public partial interface IAlertRuleTemplatesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -53,8 +52,7 @@ public partial interface IAlertRuleTemplatesOperations /// 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 name of the workspace. @@ -68,7 +66,7 @@ public partial interface IAlertRuleTemplatesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -90,7 +88,7 @@ public partial interface IAlertRuleTemplatesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// 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..43ed4229a82c4 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,7 @@ 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 name of the workspace. @@ -39,7 +38,7 @@ public partial interface IAlertRulesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -53,8 +52,7 @@ public partial interface IAlertRulesOperations /// 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 name of the workspace. @@ -68,7 +66,7 @@ public partial interface IAlertRulesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -82,8 +80,7 @@ public partial interface IAlertRulesOperations /// 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 name of the workspace. @@ -100,7 +97,7 @@ public partial interface IAlertRulesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -114,8 +111,7 @@ public partial interface IAlertRulesOperations /// 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 name of the workspace. @@ -129,7 +125,7 @@ public partial interface IAlertRulesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -148,7 +144,7 @@ public partial interface IAlertRulesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// 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..e858d5a733985 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IIncidentCommentsOperations.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IIncidentCommentsOperations.cs @@ -25,11 +25,10 @@ namespace Microsoft.Azure.Management.SecurityInsights public partial interface IIncidentCommentsOperations { /// - /// Gets all incident comments. + /// Gets all comments for a given 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 name of the workspace. @@ -53,7 +52,7 @@ public partial interface IIncidentCommentsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -64,11 +63,10 @@ public partial interface IIncidentCommentsOperations /// Task>> ListByIncidentWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string incidentId, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets an incident comment. + /// Gets a comment for a given 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 name of the workspace. @@ -85,7 +83,7 @@ public partial interface IIncidentCommentsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -96,11 +94,10 @@ public partial interface IIncidentCommentsOperations /// Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string incidentId, string incidentCommentId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Creates the incident comment. + /// Creates or updates a comment for a given 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 name of the workspace. @@ -114,13 +111,16 @@ public partial interface IIncidentCommentsOperations /// /// The comment message /// + /// + /// 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 /// /// @@ -129,9 +129,37 @@ 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> CreateCommentWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string incidentId, string incidentCommentId, string message, string etag = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a comment for a given incident. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// 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 DeleteCommentWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string incidentId, string incidentCommentId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets all incident comments. + /// Gets all comments for a given incident. /// /// /// The NextLink from the previous successful call to List operation. @@ -142,7 +170,7 @@ public partial interface IIncidentCommentsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IBookmarksOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IIncidentRelationsOperations.cs similarity index 58% rename from sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IBookmarksOperations.cs rename to sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IIncidentRelationsOperations.cs index 13d1d9379a05e..439674e147faa 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IBookmarksOperations.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IIncidentRelationsOperations.cs @@ -12,6 +12,7 @@ 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; @@ -19,27 +20,39 @@ namespace Microsoft.Azure.Management.SecurityInsights using System.Threading.Tasks; /// - /// BookmarksOperations operations. + /// IncidentRelationsOperations operations. /// - public partial interface IBookmarksOperations + public partial interface IIncidentRelationsOperations { /// - /// Gets all bookmarks. + /// Gets all relations for a given 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 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 /// /// @@ -48,19 +61,21 @@ 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 workspaceName, string incidentId, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets a bookmark. + /// Gets a relation for a given 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 name of the workspace. /// - /// - /// Bookmark ID + /// + /// Incident ID + /// + /// + /// Relation Name /// /// /// The headers that will be added to request. @@ -68,7 +83,7 @@ public partial interface IBookmarksOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -77,22 +92,27 @@ 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> GetRelationWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string incidentId, string relationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Creates or updates the bookmark. + /// Creates or updates a relation for a given 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 name of the workspace. /// - /// - /// Bookmark ID + /// + /// Incident ID /// - /// - /// The bookmark + /// + /// Relation Name + /// + /// + /// The resource ID of the related resource + /// + /// + /// Etag of the azure resource /// /// /// The headers that will be added to request. @@ -100,7 +120,7 @@ public partial interface IBookmarksOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -109,19 +129,21 @@ 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> CreateOrUpdateRelationWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string incidentId, string relationName, string relatedResourceId, string etag = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Delete the bookmark. + /// Deletes a relation for a given 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 name of the workspace. /// - /// - /// Bookmark ID + /// + /// Incident ID + /// + /// + /// Relation Name /// /// /// The headers that will be added to request. @@ -129,15 +151,15 @@ public partial interface IBookmarksOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when a required parameter is null /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string bookmarkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteRelationWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string incidentId, string relationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets all bookmarks. + /// Gets all relations for a given incident. /// /// /// The NextLink from the previous successful call to List operation. @@ -148,7 +170,7 @@ public partial interface IBookmarksOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -157,6 +179,6 @@ public partial interface IBookmarksOperations /// /// Thrown when a required parameter is null /// - Task>> ListNextWithHttpMessagesAsync(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/IIncidentsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IIncidentsOperations.cs index ff001b53476e0..86fb696847f16 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,7 @@ 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 name of the workspace. @@ -55,7 +54,7 @@ public partial interface IIncidentsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -66,11 +65,10 @@ public partial interface IIncidentsOperations /// 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)); /// - /// Gets an incident. + /// Gets a given 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 name of the workspace. @@ -84,7 +82,7 @@ public partial interface IIncidentsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -95,11 +93,10 @@ public partial interface IIncidentsOperations /// Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string incidentId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Creates or updates the incident. + /// Creates or updates 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 name of the workspace. @@ -116,7 +113,7 @@ public partial interface IIncidentsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -127,11 +124,10 @@ public partial interface IIncidentsOperations /// Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string incidentId, Incident incident, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Delete the incident. + /// Deletes a given 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 name of the workspace. @@ -145,7 +141,7 @@ public partial interface IIncidentsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -153,6 +149,90 @@ public partial interface IIncidentsOperations /// Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string incidentId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Gets all alerts for an incident. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// 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> ListOfAlertsWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string incidentId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all bookmarks for an incident. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// 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> ListOfBookmarksWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string incidentId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all entities for an incident. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// 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> ListOfEntitiesWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string incidentId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Gets all incidents. /// /// @@ -164,7 +244,7 @@ public partial interface IIncidentsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IOperations.cs index 9ab3684610fda..0a2f9899d822a 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IOperations.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IOperations.cs @@ -33,7 +33,7 @@ public partial interface IOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -56,7 +56,7 @@ public partial interface IOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// 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..1e9da93ccc1e1 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. @@ -71,44 +71,64 @@ public partial interface ISecurityInsightsClient : System.IDisposable /// - /// Gets the IOperations. + /// Gets the IIncidentsOperations. /// - IOperations Operations { get; } + IIncidentsOperations Incidents { get; } /// - /// Gets the IAlertRulesOperations. + /// Gets the IIncidentCommentsOperations. /// - IAlertRulesOperations AlertRules { get; } + IIncidentCommentsOperations IncidentComments { get; } /// - /// Gets the IActionsOperations. + /// Gets the IIncidentRelationsOperations. /// - IActionsOperations Actions { get; } + IIncidentRelationsOperations IncidentRelations { get; } /// - /// Gets the IAlertRuleTemplatesOperations. + /// Gets the IThreatIntelligenceIndicatorOperations. /// - IAlertRuleTemplatesOperations AlertRuleTemplates { get; } + IThreatIntelligenceIndicatorOperations ThreatIntelligenceIndicator { get; } /// - /// Gets the IBookmarksOperations. + /// Gets the IThreatIntelligenceIndicatorsOperations. /// - IBookmarksOperations Bookmarks { get; } + IThreatIntelligenceIndicatorsOperations ThreatIntelligenceIndicators { get; } /// - /// Gets the IDataConnectorsOperations. + /// Gets the IThreatIntelligenceIndicatorMetricsOperations. /// - IDataConnectorsOperations DataConnectors { get; } + IThreatIntelligenceIndicatorMetricsOperations ThreatIntelligenceIndicatorMetrics { get; } /// - /// Gets the IIncidentsOperations. + /// Gets the IWatchlistsOperations. /// - IIncidentsOperations Incidents { get; } + IWatchlistsOperations Watchlists { get; } /// - /// Gets the IIncidentCommentsOperations. + /// Gets the IWatchlistItemsOperations. /// - IIncidentCommentsOperations IncidentComments { get; } + IWatchlistItemsOperations WatchlistItems { get; } + + /// + /// Gets the IOperations. + /// + IOperations Operations { get; } + + /// + /// Gets the IAlertRulesOperations. + /// + IAlertRulesOperations AlertRules { get; } + + /// + /// Gets the IActionsOperations. + /// + IActionsOperations Actions { get; } + + /// + /// Gets the IAlertRuleTemplatesOperations. + /// + IAlertRuleTemplatesOperations AlertRuleTemplates { get; } } } 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..d8ed64f46c3c0 --- /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..dd78235326e08 --- /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..57a6f6ad2245d --- /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. + /// + /// + /// 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. + /// + /// + /// Sorts the results. 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), int? top = default(int?), string skipToken = default(string), string orderby = 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/IDataConnectorsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IWatchlistItemsOperations.cs similarity index 54% rename from sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IDataConnectorsOperations.cs rename to sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IWatchlistItemsOperations.cs index 22ae7053616e8..58791d6504813 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IDataConnectorsOperations.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IWatchlistItemsOperations.cs @@ -19,27 +19,40 @@ namespace Microsoft.Azure.Management.SecurityInsights using System.Threading.Tasks; /// - /// DataConnectorsOperations operations. + /// WatchlistItemsOperations operations. /// - public partial interface IDataConnectorsOperations + public partial interface IWatchlistItemsOperations { /// - /// Gets all data connectors. + /// Get all watchlist Items. /// /// - /// 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. /// + /// + /// The watchlist alias + /// + /// + /// 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 /// /// @@ -48,19 +61,25 @@ 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, string watchlistAlias, string skipToken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets a data connector. + /// Get a watchlist item. /// /// - /// 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 watchlist alias + /// + /// + /// The watchlist item id (GUID) /// /// /// The headers that will be added to request. @@ -68,7 +87,7 @@ public partial interface IDataConnectorsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -77,22 +96,25 @@ 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 watchlistAlias, string watchlistItemId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Creates or updates the data connector. + /// Delete a watchlist item. /// /// - /// 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 watchlist alias /// - /// - /// The data connector + /// + /// The watchlist item id (GUID) /// /// /// The headers that will be added to request. @@ -100,28 +122,34 @@ public partial interface IDataConnectorsOperations /// /// 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 workspaceName, string dataConnectorId, DataConnector dataConnector, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string watchlistAlias, string watchlistItemId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Delete the data connector. + /// Create or update a watchlist item. /// /// - /// 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 watchlist alias + /// + /// + /// The watchlist item id (GUID) + /// + /// + /// The watchlist item /// /// /// The headers that will be added to request. @@ -129,15 +157,18 @@ public partial interface IDataConnectorsOperations /// /// 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 dataConnectorId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string watchlistAlias, string watchlistItemId, WatchlistItem watchlistItem, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets all data connectors. + /// Get all watchlist Items. /// /// /// The NextLink from the previous successful call to List operation. @@ -148,7 +179,7 @@ public partial interface IDataConnectorsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -157,6 +188,6 @@ public partial interface IDataConnectorsOperations /// /// Thrown when a required parameter is null /// - Task>> ListNextWithHttpMessagesAsync(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/IWatchlistsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IWatchlistsOperations.cs new file mode 100644 index 0000000000000..543f804052359 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IWatchlistsOperations.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 +{ + 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 + { + /// + /// Get 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. + /// + /// + /// 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 skipToken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get 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. + /// + /// + /// The 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. + /// + /// + /// The 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)); + /// + /// Create or update 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. + /// + /// + /// The 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)); + /// + /// Get 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..fd7f4a3c5d64b 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IncidentCommentsOperations.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IncidentCommentsOperations.cs @@ -52,11 +52,10 @@ internal IncidentCommentsOperations(SecurityInsightsClient client) public SecurityInsightsClient Client { get; private set; } /// - /// Gets all incident comments. + /// Gets all comments for a given 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 name of the workspace. @@ -79,7 +78,7 @@ internal IncidentCommentsOperations(SecurityInsightsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -96,15 +95,26 @@ internal IncidentCommentsOperations(SecurityInsightsClient client) /// 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)) { + 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 +131,6 @@ 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 (workspaceName == null) { @@ -244,14 +250,13 @@ internal IncidentCommentsOperations(SecurityInsightsClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -261,10 +266,6 @@ internal IncidentCommentsOperations(SecurityInsightsClient client) } 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); @@ -310,11 +311,10 @@ internal IncidentCommentsOperations(SecurityInsightsClient client) } /// - /// Gets an incident comment. + /// Gets a comment for a given 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 name of the workspace. @@ -331,7 +331,7 @@ internal IncidentCommentsOperations(SecurityInsightsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -348,15 +348,26 @@ internal IncidentCommentsOperations(SecurityInsightsClient client) /// public async Task> GetWithHttpMessagesAsync(string resourceGroupName, 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 +384,6 @@ 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 (workspaceName == null) { @@ -488,14 +495,13 @@ internal IncidentCommentsOperations(SecurityInsightsClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -505,10 +511,6 @@ internal IncidentCommentsOperations(SecurityInsightsClient client) } 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); @@ -554,11 +556,10 @@ internal IncidentCommentsOperations(SecurityInsightsClient client) } /// - /// Creates the incident comment. + /// Creates or updates a comment for a given 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 name of the workspace. @@ -572,13 +573,16 @@ internal IncidentCommentsOperations(SecurityInsightsClient client) /// /// The comment message /// + /// + /// Etag of the azure resource + /// /// /// Headers that will be added to request. /// /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -593,17 +597,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> CreateCommentWithHttpMessagesAsync(string resourceGroupName, 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 +635,6 @@ 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 (workspaceName == null) { @@ -653,8 +664,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 @@ -749,16 +761,15 @@ 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)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -768,10 +779,6 @@ internal IncidentCommentsOperations(SecurityInsightsClient client) } 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); @@ -792,6 +799,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); @@ -817,7 +842,231 @@ internal IncidentCommentsOperations(SecurityInsightsClient client) } /// - /// Gets all incident comments. + /// Deletes a comment for a given incident. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// 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 DeleteCommentWithHttpMessagesAsync(string resourceGroupName, 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 (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("workspaceName", workspaceName); + tracingParameters.Add("incidentId", incidentId); + tracingParameters.Add("incidentCommentId", incidentCommentId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "DeleteComment", 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(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _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 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 comments for a given incident. /// /// /// The NextLink from the previous successful call to List operation. @@ -828,7 +1077,7 @@ internal IncidentCommentsOperations(SecurityInsightsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -924,14 +1173,13 @@ internal IncidentCommentsOperations(SecurityInsightsClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -941,10 +1189,6 @@ internal IncidentCommentsOperations(SecurityInsightsClient client) } 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); 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..59a3a9aca9848 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IncidentCommentsOperationsExtensions.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IncidentCommentsOperationsExtensions.cs @@ -23,14 +23,13 @@ namespace Microsoft.Azure.Management.SecurityInsights public static partial class IncidentCommentsOperationsExtensions { /// - /// Gets all incident comments. + /// Gets all comments for a given incident. /// /// /// 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 name of the workspace. @@ -53,14 +52,13 @@ public static partial class IncidentCommentsOperationsExtensions } /// - /// Gets all incident comments. + /// Gets all comments for a given incident. /// /// /// 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 name of the workspace. @@ -89,14 +87,13 @@ public static partial class IncidentCommentsOperationsExtensions } /// - /// Gets an incident comment. + /// Gets a comment for a given incident. /// /// /// 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 name of the workspace. @@ -113,14 +110,13 @@ public static IncidentComment Get(this IIncidentCommentsOperations operations, s } /// - /// Gets an incident comment. + /// Gets a comment for a given incident. /// /// /// 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 name of the workspace. @@ -143,14 +139,13 @@ public static IncidentComment Get(this IIncidentCommentsOperations operations, s } /// - /// Creates the incident comment. + /// Creates or updates a comment for a given incident. /// /// /// 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 name of the workspace. @@ -164,20 +159,22 @@ 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 CreateComment(this IIncidentCommentsOperations operations, string resourceGroupName, string workspaceName, string incidentId, string incidentCommentId, string message, string etag = default(string)) { - return operations.CreateCommentAsync(resourceGroupName, workspaceName, incidentId, incidentCommentId, message).GetAwaiter().GetResult(); + return operations.CreateCommentAsync(resourceGroupName, workspaceName, incidentId, incidentCommentId, message, etag).GetAwaiter().GetResult(); } /// - /// Creates the incident comment. + /// Creates or updates a comment for a given incident. /// /// /// 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 name of the workspace. @@ -191,19 +188,71 @@ 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 CreateCommentAsync(this IIncidentCommentsOperations operations, string resourceGroupName, 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.CreateCommentWithHttpMessagesAsync(resourceGroupName, workspaceName, incidentId, incidentCommentId, message, etag, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Gets all incident comments. + /// Deletes a comment for a given incident. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace. + /// + /// + /// Incident ID + /// + /// + /// Incident comment ID + /// + public static void DeleteComment(this IIncidentCommentsOperations operations, string resourceGroupName, string workspaceName, string incidentId, string incidentCommentId) + { + operations.DeleteCommentAsync(resourceGroupName, workspaceName, incidentId, incidentCommentId).GetAwaiter().GetResult(); + } + + /// + /// Deletes a comment for a given incident. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace. + /// + /// + /// Incident ID + /// + /// + /// Incident comment ID + /// + /// + /// The cancellation token. + /// + public static async Task DeleteCommentAsync(this IIncidentCommentsOperations operations, string resourceGroupName, string workspaceName, string incidentId, string incidentCommentId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteCommentWithHttpMessagesAsync(resourceGroupName, workspaceName, incidentId, incidentCommentId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets all comments for a given incident. /// /// /// The operations group for this extension method. @@ -217,7 +266,7 @@ public static IPage ListByIncidentNext(this IIncidentCommentsOp } /// - /// Gets all incident comments. + /// Gets all comments for a given incident. /// /// /// The operations group for this extension method. diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/BookmarksOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IncidentRelationsOperations.cs similarity index 80% rename from sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/BookmarksOperations.cs rename to sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IncidentRelationsOperations.cs index d5543ca885972..6967ab1725c11 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/BookmarksOperations.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IncidentRelationsOperations.cs @@ -12,6 +12,7 @@ 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; @@ -23,12 +24,12 @@ namespace Microsoft.Azure.Management.SecurityInsights using System.Threading.Tasks; /// - /// BookmarksOperations operations. + /// IncidentRelationsOperations operations. /// - internal partial class BookmarksOperations : IServiceOperations, IBookmarksOperations + internal partial class IncidentRelationsOperations : IServiceOperations, IIncidentRelationsOperations { /// - /// Initializes a new instance of the BookmarksOperations class. + /// Initializes a new instance of the IncidentRelationsOperations class. /// /// /// Reference to the service client. @@ -36,7 +37,7 @@ internal partial class BookmarksOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal BookmarksOperations(SecurityInsightsClient client) + internal IncidentRelationsOperations(SecurityInsightsClient client) { if (client == null) { @@ -51,22 +52,33 @@ internal BookmarksOperations(SecurityInsightsClient client) public SecurityInsightsClient Client { get; private set; } /// - /// Gets all bookmarks. + /// Gets all relations for a given 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 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 /// /// @@ -81,17 +93,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 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) @@ -108,10 +131,6 @@ 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 (workspaceName == null) { @@ -128,6 +147,10 @@ internal BookmarksOperations(SecurityInsightsClient client) throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); } } + if (incidentId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "incidentId"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -135,22 +158,38 @@ internal BookmarksOperations(SecurityInsightsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("resourceGroupName", resourceGroupName); 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/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/Microsoft.OperationalInsights/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("{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); @@ -211,14 +250,13 @@ internal BookmarksOperations(SecurityInsightsClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -228,10 +266,6 @@ internal BookmarksOperations(SecurityInsightsClient client) } 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); @@ -244,7 +278,7 @@ internal BookmarksOperations(SecurityInsightsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -257,7 +291,7 @@ internal BookmarksOperations(SecurityInsightsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -277,17 +311,19 @@ internal BookmarksOperations(SecurityInsightsClient client) } /// - /// Gets a bookmark. + /// Gets a relation for a given 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 name of the workspace. /// - /// - /// Bookmark ID + /// + /// Incident ID + /// + /// + /// Relation Name /// /// /// Headers that will be added to request. @@ -295,7 +331,7 @@ internal BookmarksOperations(SecurityInsightsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -310,17 +346,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> GetRelationWithHttpMessagesAsync(string resourceGroupName, 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 (!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 +384,6 @@ 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 (workspaceName == null) { @@ -357,9 +400,13 @@ internal BookmarksOperations(SecurityInsightsClient client) throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); } } - if (bookmarkId == null) + if (incidentId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "incidentId"); + } + if (relationName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "bookmarkId"); + throw new ValidationException(ValidationRules.CannotBeNull, "relationName"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -370,17 +417,19 @@ internal BookmarksOperations(SecurityInsightsClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("workspaceName", workspaceName); - tracingParameters.Add("bookmarkId", bookmarkId); + tracingParameters.Add("incidentId", incidentId); + tracingParameters.Add("relationName", relationName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + 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/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/Microsoft.OperationalInsights/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("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); - _url = _url.Replace("{bookmarkId}", System.Uri.EscapeDataString(bookmarkId)); + _url = _url.Replace("{incidentId}", System.Uri.EscapeDataString(incidentId)); + _url = _url.Replace("{relationName}", System.Uri.EscapeDataString(relationName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -446,14 +495,13 @@ internal BookmarksOperations(SecurityInsightsClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -463,10 +511,6 @@ internal BookmarksOperations(SecurityInsightsClient client) } 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); @@ -479,7 +523,7 @@ internal BookmarksOperations(SecurityInsightsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -492,7 +536,7 @@ internal BookmarksOperations(SecurityInsightsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -512,20 +556,25 @@ internal BookmarksOperations(SecurityInsightsClient client) } /// - /// Creates or updates the bookmark. + /// Creates or updates a relation for a given 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 name of the workspace. /// - /// - /// Bookmark ID + /// + /// Incident ID + /// + /// + /// Relation Name /// - /// - /// The bookmark + /// + /// The resource ID of the related resource + /// + /// + /// Etag of the azure resource /// /// /// Headers that will be added to request. @@ -533,7 +582,7 @@ internal BookmarksOperations(SecurityInsightsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -548,17 +597,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> CreateOrUpdateRelationWithHttpMessagesAsync(string resourceGroupName, 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 (!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 +635,6 @@ 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 (workspaceName == null) { @@ -595,17 +651,23 @@ internal BookmarksOperations(SecurityInsightsClient client) throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); } } - if (bookmarkId == null) + if (incidentId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "bookmarkId"); + throw new ValidationException(ValidationRules.CannotBeNull, "incidentId"); } - if (bookmark == null) + if (relationName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "bookmark"); + throw new ValidationException(ValidationRules.CannotBeNull, "relationName"); } - if (bookmark != null) + if (relatedResourceId == null) { - bookmark.Validate(); + 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; @@ -616,18 +678,20 @@ internal BookmarksOperations(SecurityInsightsClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("workspaceName", workspaceName); - tracingParameters.Add("bookmarkId", bookmarkId); - tracingParameters.Add("bookmark", bookmark); + tracingParameters.Add("incidentId", incidentId); + tracingParameters.Add("relationName", relationName); + tracingParameters.Add("relation", relation); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdateRelation", 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/{bookmarkId}").ToString(); + 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}/relations/{relationName}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); - _url = _url.Replace("{bookmarkId}", System.Uri.EscapeDataString(bookmarkId)); + _url = _url.Replace("{incidentId}", System.Uri.EscapeDataString(incidentId)); + _url = _url.Replace("{relationName}", System.Uri.EscapeDataString(relationName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -671,9 +735,9 @@ internal BookmarksOperations(SecurityInsightsClient client) // Serialize Request string _requestContent = null; - if(bookmark != null) + if(relation != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(bookmark, Client.SerializationSettings); + _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"); } @@ -699,14 +763,13 @@ internal BookmarksOperations(SecurityInsightsClient client) string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 201) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -716,10 +779,6 @@ internal BookmarksOperations(SecurityInsightsClient client) } 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); @@ -732,7 +791,7 @@ internal BookmarksOperations(SecurityInsightsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -745,7 +804,7 @@ internal BookmarksOperations(SecurityInsightsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -763,7 +822,7 @@ internal BookmarksOperations(SecurityInsightsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -783,17 +842,19 @@ internal BookmarksOperations(SecurityInsightsClient client) } /// - /// Delete the bookmark. + /// Deletes a relation for a given 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 name of the workspace. /// - /// - /// Bookmark ID + /// + /// Incident ID + /// + /// + /// Relation Name /// /// /// Headers that will be added to request. @@ -801,7 +862,7 @@ internal BookmarksOperations(SecurityInsightsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -813,17 +874,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 DeleteRelationWithHttpMessagesAsync(string resourceGroupName, 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 (!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 +912,6 @@ 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 (workspaceName == null) { @@ -860,9 +928,13 @@ internal BookmarksOperations(SecurityInsightsClient client) throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); } } - if (bookmarkId == null) + if (incidentId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "incidentId"); + } + if (relationName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "bookmarkId"); + throw new ValidationException(ValidationRules.CannotBeNull, "relationName"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -873,17 +945,19 @@ internal BookmarksOperations(SecurityInsightsClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("workspaceName", workspaceName); - tracingParameters.Add("bookmarkId", bookmarkId); + tracingParameters.Add("incidentId", incidentId); + tracingParameters.Add("relationName", relationName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "DeleteRelation", 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/{bookmarkId}").ToString(); + 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}/relations/{relationName}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); - _url = _url.Replace("{bookmarkId}", System.Uri.EscapeDataString(bookmarkId)); + _url = _url.Replace("{incidentId}", System.Uri.EscapeDataString(incidentId)); + _url = _url.Replace("{relationName}", System.Uri.EscapeDataString(relationName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -949,14 +1023,13 @@ internal BookmarksOperations(SecurityInsightsClient client) string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 204) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -966,10 +1039,6 @@ internal BookmarksOperations(SecurityInsightsClient client) } 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); @@ -997,7 +1066,7 @@ internal BookmarksOperations(SecurityInsightsClient client) } /// - /// Gets all bookmarks. + /// Gets all relations for a given incident. /// /// /// The NextLink from the previous successful call to List operation. @@ -1008,7 +1077,7 @@ internal BookmarksOperations(SecurityInsightsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1023,7 +1092,7 @@ internal BookmarksOperations(SecurityInsightsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListNextWithHttpMessagesAsync(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) { @@ -1104,14 +1173,13 @@ internal BookmarksOperations(SecurityInsightsClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1121,10 +1189,6 @@ internal BookmarksOperations(SecurityInsightsClient client) } 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); @@ -1137,7 +1201,7 @@ internal BookmarksOperations(SecurityInsightsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1150,7 +1214,7 @@ internal BookmarksOperations(SecurityInsightsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { 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..3a64800b542cc --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IncidentRelationsOperationsExtensions.cs @@ -0,0 +1,289 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by 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 relations for a given incident. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// 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 workspaceName, string incidentId, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string)) + { + return operations.ListAsync(resourceGroupName, workspaceName, incidentId, odataQuery, skipToken).GetAwaiter().GetResult(); + } + + /// + /// Gets all relations for a given incident. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// 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 workspaceName, string incidentId, ODataQuery odataQuery = default(ODataQuery), string skipToken = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, workspaceName, incidentId, odataQuery, skipToken, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a relation for a given incident. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace. + /// + /// + /// Incident ID + /// + /// + /// Relation Name + /// + public static Relation GetRelation(this IIncidentRelationsOperations operations, string resourceGroupName, string workspaceName, string incidentId, string relationName) + { + return operations.GetRelationAsync(resourceGroupName, workspaceName, incidentId, relationName).GetAwaiter().GetResult(); + } + + /// + /// Gets a relation for a given incident. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace. + /// + /// + /// Incident ID + /// + /// + /// Relation Name + /// + /// + /// The cancellation token. + /// + public static async Task GetRelationAsync(this IIncidentRelationsOperations operations, string resourceGroupName, string workspaceName, string incidentId, string relationName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetRelationWithHttpMessagesAsync(resourceGroupName, workspaceName, incidentId, relationName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a relation for a given incident. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace. + /// + /// + /// Incident ID + /// + /// + /// Relation Name + /// + /// + /// The resource ID of the related resource + /// + /// + /// Etag of the azure resource + /// + public static Relation CreateOrUpdateRelation(this IIncidentRelationsOperations operations, string resourceGroupName, string workspaceName, string incidentId, string relationName, string relatedResourceId, string etag = default(string)) + { + return operations.CreateOrUpdateRelationAsync(resourceGroupName, workspaceName, incidentId, relationName, relatedResourceId, etag).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a relation for a given incident. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// 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 CreateOrUpdateRelationAsync(this IIncidentRelationsOperations operations, string resourceGroupName, string workspaceName, string incidentId, string relationName, string relatedResourceId, string etag = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateRelationWithHttpMessagesAsync(resourceGroupName, workspaceName, incidentId, relationName, relatedResourceId, etag, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a relation for a given incident. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace. + /// + /// + /// Incident ID + /// + /// + /// Relation Name + /// + public static void DeleteRelation(this IIncidentRelationsOperations operations, string resourceGroupName, string workspaceName, string incidentId, string relationName) + { + operations.DeleteRelationAsync(resourceGroupName, workspaceName, incidentId, relationName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a relation for a given incident. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace. + /// + /// + /// Incident ID + /// + /// + /// Relation Name + /// + /// + /// The cancellation token. + /// + public static async Task DeleteRelationAsync(this IIncidentRelationsOperations operations, string resourceGroupName, string workspaceName, string incidentId, string relationName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteRelationWithHttpMessagesAsync(resourceGroupName, workspaceName, incidentId, relationName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets all relations for a given incident. + /// + /// + /// 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 relations for a given incident. + /// + /// + /// 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..eca0c4b709f87 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,7 @@ 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 name of the workspace. @@ -81,7 +80,7 @@ internal IncidentsOperations(SecurityInsightsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -98,15 +97,26 @@ internal IncidentsOperations(SecurityInsightsClient client) /// 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)) { + 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 +133,6 @@ 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 (workspaceName == null) { @@ -246,14 +252,13 @@ internal IncidentsOperations(SecurityInsightsClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -263,10 +268,6 @@ internal IncidentsOperations(SecurityInsightsClient client) } 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); @@ -312,11 +313,10 @@ internal IncidentsOperations(SecurityInsightsClient client) } /// - /// Gets an incident. + /// Gets a given 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 name of the workspace. @@ -330,7 +330,7 @@ internal IncidentsOperations(SecurityInsightsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -347,15 +347,26 @@ internal IncidentsOperations(SecurityInsightsClient client) /// public async Task> GetWithHttpMessagesAsync(string resourceGroupName, 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 +383,6 @@ 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 (workspaceName == null) { @@ -481,14 +488,13 @@ internal IncidentsOperations(SecurityInsightsClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -498,10 +504,6 @@ internal IncidentsOperations(SecurityInsightsClient client) } 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); @@ -547,11 +549,10 @@ internal IncidentsOperations(SecurityInsightsClient client) } /// - /// Creates or updates the incident. + /// Creates or updates 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 name of the workspace. @@ -568,7 +569,7 @@ internal IncidentsOperations(SecurityInsightsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -585,15 +586,26 @@ internal IncidentsOperations(SecurityInsightsClient client) /// public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, 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 +622,6 @@ 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 (workspaceName == null) { @@ -734,14 +742,13 @@ internal IncidentsOperations(SecurityInsightsClient client) string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 201) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -751,10 +758,6 @@ internal IncidentsOperations(SecurityInsightsClient client) } 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); @@ -818,11 +821,10 @@ internal IncidentsOperations(SecurityInsightsClient client) } /// - /// Delete the incident. + /// Deletes a given 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 name of the workspace. @@ -836,7 +838,7 @@ internal IncidentsOperations(SecurityInsightsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -850,15 +852,26 @@ internal IncidentsOperations(SecurityInsightsClient client) /// public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, 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 +888,6 @@ 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 (workspaceName == null) { @@ -984,14 +993,13 @@ internal IncidentsOperations(SecurityInsightsClient client) string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 204) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1001,10 +1009,6 @@ internal IncidentsOperations(SecurityInsightsClient client) } 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); @@ -1032,10 +1036,16 @@ internal IncidentsOperations(SecurityInsightsClient client) } /// - /// Gets all incidents. + /// Gets all alerts for an incident. /// - /// - /// The NextLink from the previous successful call to List operation. + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace. + /// + /// + /// Incident ID /// /// /// Headers that will be added to request. @@ -1043,7 +1053,7 @@ internal IncidentsOperations(SecurityInsightsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1058,11 +1068,63 @@ internal IncidentsOperations(SecurityInsightsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListOfAlertsWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string incidentId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (nextPageLink == null) + if (Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + 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 (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; @@ -1071,14 +1133,24 @@ internal IncidentsOperations(SecurityInsightsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("incidentId", incidentId); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListOfAlerts", tracingParameters); } // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); + 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}/alerts").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _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); @@ -1086,7 +1158,7 @@ internal IncidentsOperations(SecurityInsightsClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1139,14 +1211,13 @@ internal IncidentsOperations(SecurityInsightsClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1156,10 +1227,646 @@ internal IncidentsOperations(SecurityInsightsClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + _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 bookmarks for an incident. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// 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> ListOfBookmarksWithHttpMessagesAsync(string resourceGroupName, 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 (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("workspaceName", workspaceName); + tracingParameters.Add("incidentId", incidentId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListOfBookmarks", 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}/bookmarks").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _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 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(); + } + // 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 for an incident. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// 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> ListOfEntitiesWithHttpMessagesAsync(string resourceGroupName, 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 (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("workspaceName", workspaceName); + tracingParameters.Add("incidentId", incidentId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListOfEntities", 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}/entities").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _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 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(); + } + // 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. + /// + /// + /// 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 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); 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..e3e743b99b6bd 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,7 @@ 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 name of the workspace. @@ -61,8 +60,7 @@ 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 name of the workspace. @@ -94,14 +92,13 @@ public static partial class IncidentsOperationsExtensions } /// - /// Gets an incident. + /// Gets a given incident. /// /// /// 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 name of the workspace. @@ -115,14 +112,13 @@ public static Incident Get(this IIncidentsOperations operations, string resource } /// - /// Gets an incident. + /// Gets a given incident. /// /// /// 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 name of the workspace. @@ -142,14 +138,13 @@ public static Incident Get(this IIncidentsOperations operations, string resource } /// - /// Creates or updates the incident. + /// Creates or updates an incident. /// /// /// 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 name of the workspace. @@ -166,14 +161,13 @@ public static Incident CreateOrUpdate(this IIncidentsOperations operations, stri } /// - /// Creates or updates the incident. + /// Creates or updates an incident. /// /// /// 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 name of the workspace. @@ -196,14 +190,13 @@ public static Incident CreateOrUpdate(this IIncidentsOperations operations, stri } /// - /// Delete the incident. + /// Deletes a given incident. /// /// /// 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 name of the workspace. @@ -217,14 +210,13 @@ public static void Delete(this IIncidentsOperations operations, string resourceG } /// - /// Delete the incident. + /// Deletes a given incident. /// /// /// 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 name of the workspace. @@ -240,6 +232,144 @@ public static void Delete(this IIncidentsOperations operations, string resourceG (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, incidentId, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// Gets all alerts for an incident. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace. + /// + /// + /// Incident ID + /// + public static IncidentAlertList ListOfAlerts(this IIncidentsOperations operations, string resourceGroupName, string workspaceName, string incidentId) + { + return operations.ListOfAlertsAsync(resourceGroupName, workspaceName, incidentId).GetAwaiter().GetResult(); + } + + /// + /// Gets all alerts for an incident. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace. + /// + /// + /// Incident ID + /// + /// + /// The cancellation token. + /// + public static async Task ListOfAlertsAsync(this IIncidentsOperations operations, string resourceGroupName, string workspaceName, string incidentId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListOfAlertsWithHttpMessagesAsync(resourceGroupName, workspaceName, incidentId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all bookmarks for an incident. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace. + /// + /// + /// Incident ID + /// + public static IncidentBookmarkList ListOfBookmarks(this IIncidentsOperations operations, string resourceGroupName, string workspaceName, string incidentId) + { + return operations.ListOfBookmarksAsync(resourceGroupName, workspaceName, incidentId).GetAwaiter().GetResult(); + } + + /// + /// Gets all bookmarks for an incident. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace. + /// + /// + /// Incident ID + /// + /// + /// The cancellation token. + /// + public static async Task ListOfBookmarksAsync(this IIncidentsOperations operations, string resourceGroupName, string workspaceName, string incidentId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListOfBookmarksWithHttpMessagesAsync(resourceGroupName, workspaceName, incidentId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all entities for an incident. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace. + /// + /// + /// Incident ID + /// + public static IncidentEntitiesResponse ListOfEntities(this IIncidentsOperations operations, string resourceGroupName, string workspaceName, string incidentId) + { + return operations.ListOfEntitiesAsync(resourceGroupName, workspaceName, incidentId).GetAwaiter().GetResult(); + } + + /// + /// Gets all entities for an incident. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the workspace. + /// + /// + /// Incident ID + /// + /// + /// The cancellation token. + /// + public static async Task ListOfEntitiesAsync(this IIncidentsOperations operations, string resourceGroupName, string workspaceName, string incidentId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListOfEntitiesWithHttpMessagesAsync(resourceGroupName, workspaceName, incidentId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Gets all incidents. /// 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 deleted file mode 100644 index d820cf3585077..0000000000000 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AADDataConnector.cs +++ /dev/null @@ -1,70 +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 AAD (Azure Active Directory) data connector. - /// - [Newtonsoft.Json.JsonObject("AzureActiveDirectory")] - [Rest.Serialization.JsonTransformation] - public partial class AADDataConnector : DataConnector - { - /// - /// Initializes a new instance of the AADDataConnector class. - /// - public AADDataConnector() - { - CustomInit(); - } - - /// - /// 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. - /// 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) - { - 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; } - - } -} 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 deleted file mode 100644 index f9c73a8b99f92..0000000000000 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AATPDataConnector.cs +++ /dev/null @@ -1,70 +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 AATP (Azure Advanced Threat Protection) data connector. - /// - [Newtonsoft.Json.JsonObject("AzureAdvancedThreatProtection")] - [Rest.Serialization.JsonTransformation] - public partial class AATPDataConnector : DataConnector - { - /// - /// Initializes a new instance of the AATPDataConnector class. - /// - public AATPDataConnector() - { - CustomInit(); - } - - /// - /// 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. - /// 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) - { - 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; } - - } -} 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 deleted file mode 100644 index b0885c94718dd..0000000000000 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ASCDataConnector.cs +++ /dev/null @@ -1,71 +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 ASC (Azure Security Center) data connector. - /// - [Newtonsoft.Json.JsonObject("AzureSecurityCenter")] - [Rest.Serialization.JsonTransformation] - public partial class ASCDataConnector : DataConnector - { - /// - /// Initializes a new instance of the ASCDataConnector class. - /// - public ASCDataConnector() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ASCDataConnector class. - /// - /// Azure resource Id - /// Azure resource name - /// Azure resource type - /// 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) - { - DataTypes = dataTypes; - SubscriptionId = subscriptionId; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the available data types for the connector. - /// - [JsonProperty(PropertyName = "properties.dataTypes")] - public AlertsDataTypeOfDataConnector DataTypes { get; set; } - - /// - /// 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/AccountEntity.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AccountEntity.cs new file mode 100644 index 0000000000000..2ae363f6c42bb --- /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..ddd0355e63417 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 @@ -34,14 +34,19 @@ 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 + /// 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 action. /// 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; LogicAppResourceId = logicAppResourceId; 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/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/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/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/AwsCloudTrailDataConnector.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsCloudTrailDataConnector.cs deleted file mode 100644 index ee41347c8b5a6..0000000000000 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsCloudTrailDataConnector.cs +++ /dev/null @@ -1,71 +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 Amazon Web Services CloudTrail data connector. - /// - [Newtonsoft.Json.JsonObject("AmazonWebServicesCloudTrail")] - [Rest.Serialization.JsonTransformation] - public partial class AwsCloudTrailDataConnector : DataConnector - { - /// - /// Initializes a new instance of the AwsCloudTrailDataConnector class. - /// - public AwsCloudTrailDataConnector() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AwsCloudTrailDataConnector class. - /// - /// Azure resource Id - /// Azure resource name - /// Azure resource type - /// 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) - { - AwsRoleArn = awsRoleArn; - DataTypes = dataTypes; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the Aws Role Arn (with CloudTrailReadOnly policy) that - /// is used to access the Aws account. - /// - [JsonProperty(PropertyName = "properties.awsRoleArn")] - public string AwsRoleArn { get; set; } - - /// - /// Gets or sets the available data types for the connector. - /// - [JsonProperty(PropertyName = "properties.dataTypes")] - public AwsCloudTrailDataConnectorDataTypes DataTypes { get; set; } - - } -} 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 deleted file mode 100644 index 02803069b81e5..0000000000000 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsCloudTrailDataConnectorDataTypesLogs.cs +++ /dev/null @@ -1,48 +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 System.Linq; - - /// - /// Logs data type. - /// - public partial class AwsCloudTrailDataConnectorDataTypesLogs : DataConnectorDataTypeCommon - { - /// - /// Initializes a new instance of the - /// AwsCloudTrailDataConnectorDataTypesLogs class. - /// - public AwsCloudTrailDataConnectorDataTypesLogs() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// AwsCloudTrailDataConnectorDataTypesLogs class. - /// - /// Describe whether this data type connection is - /// enabled or not. Possible values include: 'Enabled', - /// 'Disabled' - public AwsCloudTrailDataConnectorDataTypesLogs(string state = default(string)) - : base(state) - { - 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/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/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/ConfidenceLevel.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ConfidenceLevel.cs new file mode 100644 index 0000000000000..8cc0d1c0ca290 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ConfidenceLevel.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 ConfidenceLevel. + /// + public static class ConfidenceLevel + { + /// + /// Unknown confidence, the is the default value + /// + public const string Unknown = "Unknown"; + /// + /// Low confidence, meaning we have some doubts this is indeed + /// malicious or part of an attack + /// + public const string Low = "Low"; + /// + /// High confidence that the alert is true positive malicious + /// + 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/LicenseStatus.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CreatedByType.cs similarity index 62% rename from sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/LicenseStatus.cs rename to sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CreatedByType.cs index 5791bdcbd9b92..3cd5fb995c533 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/LicenseStatus.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/CreatedByType.cs @@ -12,11 +12,13 @@ namespace Microsoft.Azure.Management.SecurityInsights.Models { /// - /// Defines values for LicenseStatus. + /// Defines values for CreatedByType. /// - public static class LicenseStatus + public static class CreatedByType { - public const string Enabled = "Enabled"; - public const string Disabled = "Disabled"; + 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/DataConnector.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnector.cs deleted file mode 100644 index 41ea4bba92e3e..0000000000000 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnector.cs +++ /dev/null @@ -1,47 +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 System.Linq; - - /// - /// Data connector. - /// - public partial class DataConnector : ResourceWithEtag - { - /// - /// Initializes a new instance of the DataConnector class. - /// - public DataConnector() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the DataConnector class. - /// - /// Azure resource Id - /// Azure resource name - /// Azure resource type - /// 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) - { - 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/DataConnectorKind.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorKind.cs deleted file mode 100644 index 6db67ec03c55b..0000000000000 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorKind.cs +++ /dev/null @@ -1,28 +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 -{ - - /// - /// Defines values for DataConnectorKind. - /// - public static class DataConnectorKind - { - public const string AzureActiveDirectory = "AzureActiveDirectory"; - public const string AzureSecurityCenter = "AzureSecurityCenter"; - public const string MicrosoftCloudAppSecurity = "MicrosoftCloudAppSecurity"; - public const string ThreatIntelligence = "ThreatIntelligence"; - public const string Office365 = "Office365"; - public const string AmazonWebServicesCloudTrail = "AmazonWebServicesCloudTrail"; - public const string AzureAdvancedThreatProtection = "AzureAdvancedThreatProtection"; - public const string MicrosoftDefenderAdvancedThreatProtection = "MicrosoftDefenderAdvancedThreatProtection"; - } -} 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/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/Entity.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Entity.cs new file mode 100644 index 0000000000000..a7a4e29d8d966 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Entity.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.Linq; + + /// + /// Specific entity. + /// + public partial class Entity + { + /// + /// 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)) + { + Id = id; + Name = name; + Type = type; + SystemData = systemData; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// 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 the name of the resource + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// 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/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/EntityKind.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityKind.cs new file mode 100644 index 0000000000000..43c66ddc82a53 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityKind.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; + + /// + /// Describes an entity with kind. + /// + public partial class EntityKind + { + /// + /// Initializes a new instance of the EntityKind class. + /// + public EntityKind() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EntityKind class. + /// + /// The kind of the 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 EntityKind(string kind) + { + Kind = kind; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the kind of the 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 = "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/EntityKindEnum.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityKindEnum.cs new file mode 100644 index 0000000000000..9d2b8d711433a --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/EntityKindEnum.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 EntityKindEnum. + /// + public static class EntityKindEnum + { + /// + /// 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/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/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..00805d4b10070 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,9 +35,14 @@ public FusionAlertRuleTemplate() /// /// Initializes a new instance of the FusionAlertRuleTemplate 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 number of alert /// rules that were created by this template /// The time that this alert rule template @@ -55,8 +60,8 @@ public FusionAlertRuleTemplate() /// '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 id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), 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, systemData) { AlertRulesCreatedByTemplateCount = alertRulesCreatedByTemplateCount; CreatedDateUTC = createdDateUTC; 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/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/Bookmark.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/HuntingBookmark.cs similarity index 64% rename from sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Bookmark.cs rename to sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/HuntingBookmark.cs index 24573b469b66b..b8308cccc64b8 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Bookmark.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/HuntingBookmark.cs @@ -18,31 +18,42 @@ namespace Microsoft.Azure.Management.SecurityInsights.Models using System.Linq; /// - /// Represents a bookmark in Azure Security Insights. + /// Represents a Hunting bookmark entity. /// + [Newtonsoft.Json.JsonObject("Bookmark")] [Rest.Serialization.JsonTransformation] - public partial class Bookmark : ResourceWithEtag + public partial class HuntingBookmark : Entity { /// - /// Initializes a new instance of the Bookmark class. + /// Initializes a new instance of the HuntingBookmark class. /// - public Bookmark() + public HuntingBookmark() { CustomInit(); } /// - /// Initializes a new instance of the Bookmark class. + /// Initializes a new instance of the HuntingBookmark class. /// /// The display name of the bookmark /// The query of the bookmark. - /// Azure resource Id - /// Azure resource name - /// Azure resource type - /// Etag of the azure 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. + /// 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 @@ -51,26 +62,23 @@ public Bookmark() /// updated /// Describes a user that updated the /// bookmark - /// The bookmark event time - /// The start time for the query - /// 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 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; - EventTime = eventTime; - QueryStartTime = queryStartTime; - QueryEndTime = queryEndTime; IncidentInfo = incidentInfo; CustomInit(); } @@ -80,6 +88,21 @@ public Bookmark() /// 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 /// @@ -98,6 +121,12 @@ public 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 /// @@ -134,24 +163,6 @@ public Bookmark() [JsonProperty(PropertyName = "properties.updatedBy")] public UserInfo UpdatedBy { get; set; } - /// - /// Gets or sets the bookmark event time - /// - [JsonProperty(PropertyName = "properties.eventTime")] - public System.DateTime? EventTime { get; set; } - - /// - /// Gets or sets the start time for the query - /// - [JsonProperty(PropertyName = "properties.queryStartTime")] - public System.DateTime? QueryStartTime { get; set; } - - /// - /// Gets or sets the end time for the query - /// - [JsonProperty(PropertyName = "properties.queryEndTime")] - public System.DateTime? QueryEndTime { get; set; } - /// /// Gets or sets describes an incident that relates to bookmark /// @@ -174,14 +185,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/Incident.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Incident.cs index 9d7d25e0af371..d70233e5c3c6e 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 @@ -72,8 +77,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), 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; 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/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/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/MCASDataConnector.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MCASDataConnector.cs deleted file mode 100644 index 77df2ea8a0738..0000000000000 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MCASDataConnector.cs +++ /dev/null @@ -1,70 +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 MCAS (Microsoft Cloud App Security) data connector. - /// - [Newtonsoft.Json.JsonObject("MicrosoftCloudAppSecurity")] - [Rest.Serialization.JsonTransformation] - public partial class MCASDataConnector : DataConnector - { - /// - /// Initializes a new instance of the MCASDataConnector class. - /// - public MCASDataConnector() - { - CustomInit(); - } - - /// - /// 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) - { - 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 MCASDataConnectorDataTypes DataTypes { get; set; } - - } -} 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 deleted file mode 100644 index 0c04dc116f3e1..0000000000000 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MCASDataConnectorDataTypes.cs +++ /dev/null @@ -1,55 +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 Newtonsoft.Json; - using System.Linq; - - /// - /// The available data types for MCAS (Microsoft Cloud App Security) data - /// connector. - /// - public partial class MCASDataConnectorDataTypes : AlertsDataTypeOfDataConnector - { - /// - /// Initializes a new instance of the MCASDataConnectorDataTypes class. - /// - public MCASDataConnectorDataTypes() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the MCASDataConnectorDataTypes class. - /// - /// Alerts data type connection. - /// Discovery log data type - /// connection. - public MCASDataConnectorDataTypes(DataConnectorDataTypeCommon alerts = default(DataConnectorDataTypeCommon), DataConnectorDataTypeCommon discoveryLogs = default(DataConnectorDataTypeCommon)) - : base(alerts) - { - DiscoveryLogs = discoveryLogs; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets discovery log data type connection. - /// - [JsonProperty(PropertyName = "discoveryLogs")] - public DataConnectorDataTypeCommon DiscoveryLogs { get; set; } - - } -} 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 deleted file mode 100644 index 5cbec5f4150b6..0000000000000 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MDATPDataConnector.cs +++ /dev/null @@ -1,71 +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 MDATP (Microsoft Defender Advanced Threat Protection) data - /// connector. - /// - [Newtonsoft.Json.JsonObject("MicrosoftDefenderAdvancedThreatProtection")] - [Rest.Serialization.JsonTransformation] - public partial class MDATPDataConnector : DataConnector - { - /// - /// Initializes a new instance of the MDATPDataConnector class. - /// - public MDATPDataConnector() - { - CustomInit(); - } - - /// - /// 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. - /// 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) - { - 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; } - - } -} 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/MicrosoftSecurityIncidentCreationAlertRule.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/MicrosoftSecurityIncidentCreationAlertRule.cs index c8775e0769254..2603ccb07ba1c 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 @@ -46,9 +46,14 @@ public MicrosoftSecurityIncidentCreationAlertRule() /// 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 +67,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; 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..1f3488e0716ca 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 @@ -42,9 +42,14 @@ public MicrosoftSecurityIncidentCreationAlertRuleTemplate() /// 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 + /// 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 time that this alert rule template @@ -63,8 +68,8 @@ public MicrosoftSecurityIncidentCreationAlertRuleTemplate() /// 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(string productFilter, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), 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, systemData) { AlertRulesCreatedByTemplateCount = alertRulesCreatedByTemplateCount; CreatedDateUTC = createdDateUTC; 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/OfficeConsent.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeConsent.cs deleted file mode 100644 index d07012d86d16c..0000000000000 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeConsent.cs +++ /dev/null @@ -1,68 +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; - - /// - /// Consent for Office365 tenant that already made. - /// - [Rest.Serialization.JsonTransformation] - public partial class OfficeConsent : Resource - { - /// - /// Initializes a new instance of the OfficeConsent class. - /// - public OfficeConsent() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the OfficeConsent class. - /// - /// Azure resource Id - /// Azure resource name - /// Azure resource type - /// 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) - { - TenantId = tenantId; - TenantName = tenantName; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the tenantId of the Office365 with the consent. - /// - [JsonProperty(PropertyName = "properties.tenantId")] - public string TenantId { get; set; } - - /// - /// Gets the tenant name of the Office365 with the consent. - /// - [JsonProperty(PropertyName = "properties.tenantName")] - public string TenantName { get; private 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 deleted file mode 100644 index 425a8b2bf0a33..0000000000000 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnector.cs +++ /dev/null @@ -1,70 +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 office data connector. - /// - [Newtonsoft.Json.JsonObject("Office365")] - [Rest.Serialization.JsonTransformation] - public partial class OfficeDataConnector : DataConnector - { - /// - /// Initializes a new instance of the OfficeDataConnector class. - /// - public OfficeDataConnector() - { - CustomInit(); - } - - /// - /// 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) - { - 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 OfficeDataConnectorDataTypes DataTypes { get; set; } - - } -} 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 deleted file mode 100644 index 278bc09539aac..0000000000000 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnectorDataTypes.cs +++ /dev/null @@ -1,69 +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 Newtonsoft.Json; - using System.Linq; - - /// - /// The available data types for office data connector. - /// - public partial class OfficeDataConnectorDataTypes - { - /// - /// Initializes a new instance of the OfficeDataConnectorDataTypes - /// class. - /// - public OfficeDataConnectorDataTypes() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the OfficeDataConnectorDataTypes - /// class. - /// - /// 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)) - { - Exchange = exchange; - SharePoint = sharePoint; - Teams = teams; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets exchange data type connection. - /// - [JsonProperty(PropertyName = "exchange")] - public OfficeDataConnectorDataTypesExchange Exchange { get; set; } - - /// - /// Gets or sets sharePoint data type connection. - /// - [JsonProperty(PropertyName = "sharePoint")] - public OfficeDataConnectorDataTypesSharePoint SharePoint { get; set; } - - /// - /// Gets or sets teams data type connection. - /// - [JsonProperty(PropertyName = "teams")] - public OfficeDataConnectorDataTypesTeams Teams { get; set; } - - } -} 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 deleted file mode 100644 index b06d0c806844d..0000000000000 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnectorDataTypesExchange.cs +++ /dev/null @@ -1,48 +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 System.Linq; - - /// - /// Exchange data type connection. - /// - public partial class OfficeDataConnectorDataTypesExchange : DataConnectorDataTypeCommon - { - /// - /// Initializes a new instance of the - /// OfficeDataConnectorDataTypesExchange class. - /// - public OfficeDataConnectorDataTypesExchange() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// OfficeDataConnectorDataTypesExchange class. - /// - /// Describe whether this data type connection is - /// enabled or not. Possible values include: 'Enabled', - /// 'Disabled' - public OfficeDataConnectorDataTypesExchange(string state = default(string)) - : base(state) - { - 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/OfficeDataConnectorDataTypesSharePoint.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnectorDataTypesSharePoint.cs deleted file mode 100644 index ffe852f246520..0000000000000 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnectorDataTypesSharePoint.cs +++ /dev/null @@ -1,48 +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 System.Linq; - - /// - /// SharePoint data type connection. - /// - public partial class OfficeDataConnectorDataTypesSharePoint : DataConnectorDataTypeCommon - { - /// - /// Initializes a new instance of the - /// OfficeDataConnectorDataTypesSharePoint class. - /// - public OfficeDataConnectorDataTypesSharePoint() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// OfficeDataConnectorDataTypesSharePoint class. - /// - /// Describe whether this data type connection is - /// enabled or not. Possible values include: 'Enabled', - /// 'Disabled' - public OfficeDataConnectorDataTypesSharePoint(string state = default(string)) - : base(state) - { - 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/Operation.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Operation.cs index c5d3af3929eb8..31a7102091967 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,12 @@ 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 + public Operation(OperationDisplay display = default(OperationDisplay), string name = default(string), string origin = default(string)) { Display = display; Name = name; + Origin = origin; CustomInit(); } @@ -55,5 +57,11 @@ 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; } + } } 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/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/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/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/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/ScheduledAlertRule.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ScheduledAlertRule.cs index cc53fa1d1090a..9298fca41ec1e 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 @@ -44,9 +44,14 @@ public ScheduledAlertRule() /// triggered. /// Determines whether the suppression /// for 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 query that creates alerts for this /// rule. @@ -69,8 +74,8 @@ public ScheduledAlertRule() /// 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) + public ScheduledAlertRule(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 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, systemData, etag) { Query = query; QueryFrequency = queryFrequency; 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..cef0acaf332cd 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,9 +35,14 @@ public ScheduledAlertRuleTemplate() /// /// Initializes a new instance of the ScheduledAlertRuleTemplate 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 number of alert /// rules that were created by this template /// The time that this alert rule template @@ -66,8 +71,8 @@ public ScheduledAlertRuleTemplate() /// 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) + public ScheduledAlertRuleTemplate(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), 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, systemData) { AlertRulesCreatedByTemplateCount = alertRulesCreatedByTemplateCount; CreatedDateUTC = createdDateUTC; 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/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/Settings.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Settings.cs deleted file mode 100644 index 8c278ec9b2f50..0000000000000 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Settings.cs +++ /dev/null @@ -1,47 +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 System.Linq; - - /// - /// The Settings. - /// - public partial class Settings : ResourceWithEtag - { - /// - /// Initializes a new instance of the Settings class. - /// - public Settings() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the Settings class. - /// - /// Azure resource Id - /// Azure resource name - /// Azure resource type - /// 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) - { - 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/StatusInMcas.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Source.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/Source.cs index 397794960d901..12261c5c8fa68 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/StatusInMcas.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Source.cs @@ -12,11 +12,11 @@ namespace Microsoft.Azure.Management.SecurityInsights.Models { /// - /// Defines values for StatusInMcas. + /// Defines values for Source. /// - public static class StatusInMcas + public static class Source { - public const string Enabled = "Enabled"; - public const string Disabled = "Disabled"; + public const string Localfile = "Local file"; + public const string Remotestorage = "Remote storage"; } } 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/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/TIDataConnector.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TIDataConnector.cs deleted file mode 100644 index caa1fc0f80a62..0000000000000 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TIDataConnector.cs +++ /dev/null @@ -1,79 +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 threat intelligence data connector. - /// - [Newtonsoft.Json.JsonObject("ThreatIntelligence")] - [Rest.Serialization.JsonTransformation] - public partial class TIDataConnector : DataConnector - { - /// - /// Initializes a new instance of the TIDataConnector class. - /// - public TIDataConnector() - { - CustomInit(); - } - - /// - /// 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) - { - TenantId = tenantId; - TipLookbackPeriod = tipLookbackPeriod; - 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 lookback period for the feed to be imported. - /// - [JsonProperty(PropertyName = "properties.tipLookbackPeriod")] - public System.DateTime? TipLookbackPeriod { get; set; } - - /// - /// Gets or sets the available data types for the connector. - /// - [JsonProperty(PropertyName = "properties.dataTypes")] - public TIDataConnectorDataTypes DataTypes { get; set; } - - } -} 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 deleted file mode 100644 index 92fdaf0c1d617..0000000000000 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TIDataConnectorDataTypes.cs +++ /dev/null @@ -1,52 +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 Newtonsoft.Json; - using System.Linq; - - /// - /// The available data types for TI (Threat Intelligence) data connector. - /// - public partial class TIDataConnectorDataTypes - { - /// - /// Initializes a new instance of the TIDataConnectorDataTypes class. - /// - public TIDataConnectorDataTypes() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the TIDataConnectorDataTypes class. - /// - /// Data type for indicators - /// connection. - public TIDataConnectorDataTypes(TIDataConnectorDataTypesIndicators indicators = default(TIDataConnectorDataTypesIndicators)) - { - Indicators = indicators; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets data type for indicators connection. - /// - [JsonProperty(PropertyName = "indicators")] - public TIDataConnectorDataTypesIndicators Indicators { get; set; } - - } -} 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 deleted file mode 100644 index 75d4809736719..0000000000000 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/TIDataConnectorDataTypesIndicators.cs +++ /dev/null @@ -1,48 +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 System.Linq; - - /// - /// Data type for indicators connection. - /// - public partial class TIDataConnectorDataTypesIndicators : DataConnectorDataTypeCommon - { - /// - /// Initializes a new instance of the - /// TIDataConnectorDataTypesIndicators class. - /// - public TIDataConnectorDataTypesIndicators() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// TIDataConnectorDataTypesIndicators class. - /// - /// Describe whether this data type connection is - /// enabled or not. Possible values include: 'Enabled', - /// 'Disabled' - public TIDataConnectorDataTypesIndicators(string state = default(string)) - : base(state) - { - 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/DataConnectorDataTypeCommon.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceAppendTags.cs similarity index 53% rename from sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorDataTypeCommon.cs rename to sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceAppendTags.cs index 322fd804d6c76..2b45b4e8ac260 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorDataTypeCommon.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceAppendTags.cs @@ -11,32 +11,33 @@ namespace Microsoft.Azure.Management.SecurityInsights.Models { using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// - /// Common field for data type in data connectors. + /// Array of tags to be appended to the threat intelligence indicator. /// - public partial class DataConnectorDataTypeCommon + public partial class ThreatIntelligenceAppendTags { /// - /// Initializes a new instance of the DataConnectorDataTypeCommon + /// Initializes a new instance of the ThreatIntelligenceAppendTags /// class. /// - public DataConnectorDataTypeCommon() + public ThreatIntelligenceAppendTags() { CustomInit(); } /// - /// Initializes a new instance of the DataConnectorDataTypeCommon + /// Initializes a new instance of the ThreatIntelligenceAppendTags /// class. /// - /// Describe whether this data type connection is - /// enabled or not. Possible values include: 'Enabled', - /// 'Disabled' - public DataConnectorDataTypeCommon(string state = default(string)) + /// List of tags to be + /// appended. + public ThreatIntelligenceAppendTags(IList threatIntelligenceTags = default(IList)) { - State = state; + ThreatIntelligenceTags = threatIntelligenceTags; CustomInit(); } @@ -46,11 +47,10 @@ public DataConnectorDataTypeCommon() partial void CustomInit(); /// - /// Gets or sets describe whether this data type connection is enabled - /// or not. Possible values include: 'Enabled', 'Disabled' + /// Gets or sets list of tags to be appended. /// - [JsonProperty(PropertyName = "state")] - public string State { get; set; } + [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/AlertsDataTypeOfDataConnector.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceInformation.cs similarity index 58% rename from sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertsDataTypeOfDataConnector.cs rename to sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceInformation.cs index 3a96fcd1dfe5d..078ef8bffc0d0 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AlertsDataTypeOfDataConnector.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceInformation.cs @@ -14,27 +14,27 @@ namespace Microsoft.Azure.Management.SecurityInsights.Models using System.Linq; /// - /// Alerts data type for data connectors. + /// Threat intelligence information object. /// - public partial class AlertsDataTypeOfDataConnector + public partial class ThreatIntelligenceInformation { /// - /// Initializes a new instance of the AlertsDataTypeOfDataConnector + /// Initializes a new instance of the ThreatIntelligenceInformation /// class. /// - public AlertsDataTypeOfDataConnector() + public ThreatIntelligenceInformation() { CustomInit(); } /// - /// Initializes a new instance of the AlertsDataTypeOfDataConnector + /// Initializes a new instance of the ThreatIntelligenceInformation /// class. /// - /// Alerts data type connection. - public AlertsDataTypeOfDataConnector(DataConnectorDataTypeCommon alerts = default(DataConnectorDataTypeCommon)) + /// Etag of the azure resource + public ThreatIntelligenceInformation(string etag = default(string)) { - Alerts = alerts; + Etag = etag; CustomInit(); } @@ -44,10 +44,10 @@ public AlertsDataTypeOfDataConnector() partial void CustomInit(); /// - /// Gets or sets alerts data type connection. + /// Gets or sets etag of the azure resource /// - [JsonProperty(PropertyName = "alerts")] - public DataConnectorDataTypeCommon Alerts { get; set; } + [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/DataConnectorWithAlertsProperties.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceMetricEntity.cs similarity index 50% rename from sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorWithAlertsProperties.cs rename to sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceMetricEntity.cs index b11f7fa33d1b1..d5a5fe883fca1 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorWithAlertsProperties.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceMetricEntity.cs @@ -14,28 +14,29 @@ namespace Microsoft.Azure.Management.SecurityInsights.Models using System.Linq; /// - /// Data connector properties. + /// Describes threat intelligence metric entity /// - public partial class DataConnectorWithAlertsProperties + public partial class ThreatIntelligenceMetricEntity { /// - /// Initializes a new instance of the DataConnectorWithAlertsProperties + /// Initializes a new instance of the ThreatIntelligenceMetricEntity /// class. /// - public DataConnectorWithAlertsProperties() + public ThreatIntelligenceMetricEntity() { CustomInit(); } /// - /// Initializes a new instance of the DataConnectorWithAlertsProperties + /// Initializes a new instance of the ThreatIntelligenceMetricEntity /// class. /// - /// The available data types for the - /// connector. - public DataConnectorWithAlertsProperties(AlertsDataTypeOfDataConnector dataTypes = default(AlertsDataTypeOfDataConnector)) + /// Metric name + /// Metric value + public ThreatIntelligenceMetricEntity(string metricName = default(string), int? metricValue = default(int?)) { - DataTypes = dataTypes; + MetricName = metricName; + MetricValue = metricValue; CustomInit(); } @@ -45,10 +46,16 @@ public DataConnectorWithAlertsProperties() partial void CustomInit(); /// - /// Gets or sets the available data types for the connector. + /// Gets or sets metric name /// - [JsonProperty(PropertyName = "dataTypes")] - public AlertsDataTypeOfDataConnector DataTypes { get; set; } + [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/DataConnectorTenantId.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceMetrics.cs similarity index 57% rename from sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorTenantId.cs rename to sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceMetrics.cs index 58c3b3457f4c1..dc805c507c02c 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnectorTenantId.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceMetrics.cs @@ -14,26 +14,25 @@ namespace Microsoft.Azure.Management.SecurityInsights.Models using System.Linq; /// - /// Properties data connector on tenant level. + /// Threat intelligence metrics. /// - public partial class DataConnectorTenantId + public partial class ThreatIntelligenceMetrics { /// - /// Initializes a new instance of the DataConnectorTenantId class. + /// Initializes a new instance of the ThreatIntelligenceMetrics class. /// - public DataConnectorTenantId() + public ThreatIntelligenceMetrics() { CustomInit(); } /// - /// Initializes a new instance of the DataConnectorTenantId class. + /// Initializes a new instance of the ThreatIntelligenceMetrics class. /// - /// The tenant id to connect to, and get the - /// data from. - public DataConnectorTenantId(string tenantId = default(string)) + /// Threat intelligence metrics. + public ThreatIntelligenceMetrics(ThreatIntelligenceMetric properties = default(ThreatIntelligenceMetric)) { - TenantId = tenantId; + Properties = properties; CustomInit(); } @@ -43,10 +42,10 @@ public DataConnectorTenantId() partial void CustomInit(); /// - /// Gets or sets the tenant id to connect to, and get the data from. + /// Gets or sets threat intelligence metrics. /// - [JsonProperty(PropertyName = "tenantId")] - public string TenantId { get; set; } + [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/AwsCloudTrailDataConnectorDataTypes.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceParsedPatternTypeValue.cs similarity index 52% rename from sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsCloudTrailDataConnectorDataTypes.cs rename to sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceParsedPatternTypeValue.cs index 279ef3f6a6fd1..c0e546cef959d 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/AwsCloudTrailDataConnectorDataTypes.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceParsedPatternTypeValue.cs @@ -14,28 +14,29 @@ namespace Microsoft.Azure.Management.SecurityInsights.Models using System.Linq; /// - /// The available data types for Amazon Web Services CloudTrail data - /// connector. + /// Describes threat kill chain phase entity /// - public partial class AwsCloudTrailDataConnectorDataTypes + public partial class ThreatIntelligenceParsedPatternTypeValue { /// /// Initializes a new instance of the - /// AwsCloudTrailDataConnectorDataTypes class. + /// ThreatIntelligenceParsedPatternTypeValue class. /// - public AwsCloudTrailDataConnectorDataTypes() + public ThreatIntelligenceParsedPatternTypeValue() { CustomInit(); } /// /// Initializes a new instance of the - /// AwsCloudTrailDataConnectorDataTypes class. + /// ThreatIntelligenceParsedPatternTypeValue class. /// - /// Logs data type. - public AwsCloudTrailDataConnectorDataTypes(AwsCloudTrailDataConnectorDataTypesLogs logs = default(AwsCloudTrailDataConnectorDataTypesLogs)) + /// Type of the value + /// Value of parsed pattern + public ThreatIntelligenceParsedPatternTypeValue(string valueType = default(string), string value = default(string)) { - Logs = logs; + ValueType = valueType; + Value = value; CustomInit(); } @@ -45,10 +46,16 @@ public AwsCloudTrailDataConnectorDataTypes() partial void CustomInit(); /// - /// Gets or sets logs data type. + /// Gets or sets type of the value /// - [JsonProperty(PropertyName = "logs")] - public AwsCloudTrailDataConnectorDataTypesLogs Logs { get; set; } + [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/SettingKind.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceResourceInnerKind.cs similarity index 61% rename from sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SettingKind.cs rename to sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceResourceInnerKind.cs index 663b0f801f7f0..04dd0a98dd9e3 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/SettingKind.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceResourceInnerKind.cs @@ -12,11 +12,13 @@ namespace Microsoft.Azure.Management.SecurityInsights.Models { /// - /// Defines values for SettingKind. + /// Defines values for ThreatIntelligenceResourceInnerKind. /// - public static class SettingKind + public static class ThreatIntelligenceResourceInnerKind { - public const string UebaSettings = "UebaSettings"; - public const string ToggleSettings = "ToggleSettings"; + /// + /// 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/OfficeDataConnectorDataTypesTeams.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceResourceKind.cs similarity index 55% rename from sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnectorDataTypesTeams.cs rename to sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceResourceKind.cs index 583503a8e8e4c..8481324af1b1d 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnectorDataTypesTeams.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceResourceKind.cs @@ -10,33 +10,29 @@ namespace Microsoft.Azure.Management.SecurityInsights.Models { + using Newtonsoft.Json; using System.Linq; /// - /// Teams data type connection. + /// Describes an entity with kind. /// - public partial class OfficeDataConnectorDataTypesTeams : DataConnectorDataTypeCommon + public partial class ThreatIntelligenceResourceKind { /// - /// Initializes a new instance of the OfficeDataConnectorDataTypesTeams + /// Initializes a new instance of the ThreatIntelligenceResourceKind /// class. /// - public OfficeDataConnectorDataTypesTeams() + public ThreatIntelligenceResourceKind() { CustomInit(); } /// - /// Initializes a new instance of the OfficeDataConnectorDataTypesTeams - /// class. + /// Static constructor for ThreatIntelligenceResourceKind class. /// - /// Describe whether this data type connection is - /// enabled or not. Possible values include: 'Enabled', - /// 'Disabled' - public OfficeDataConnectorDataTypesTeams(string state = default(string)) - : base(state) + static ThreatIntelligenceResourceKind() { - CustomInit(); + Kind = "indicator"; } /// @@ -44,5 +40,11 @@ public OfficeDataConnectorDataTypesTeams() /// 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/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/DataTypeState.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceSortingOrder.cs similarity index 63% rename from sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataTypeState.cs rename to sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceSortingOrder.cs index e2cdbff7312b4..f020a15d0ea20 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataTypeState.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ThreatIntelligenceSortingOrder.cs @@ -12,11 +12,12 @@ namespace Microsoft.Azure.Management.SecurityInsights.Models { /// - /// Defines values for DataTypeState. + /// Defines values for ThreatIntelligenceSortingOrder. /// - public static class DataTypeState + public static class ThreatIntelligenceSortingOrder { - public const string Enabled = "Enabled"; - public const string Disabled = "Disabled"; + 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/ToggleSettings.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ToggleSettings.cs deleted file mode 100644 index 076630967b68c..0000000000000 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ToggleSettings.cs +++ /dev/null @@ -1,60 +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; - - /// - /// Settings with single toggle. - /// - [Rest.Serialization.JsonTransformation] - public partial class ToggleSettings : Settings - { - /// - /// Initializes a new instance of the ToggleSettings class. - /// - public ToggleSettings() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ToggleSettings class. - /// - /// Azure resource Id - /// Azure resource name - /// Azure resource type - /// 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) - { - IsEnabled = isEnabled; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets determines whether the setting is enable or disabled. - /// - [JsonProperty(PropertyName = "properties.isEnabled")] - public bool? IsEnabled { get; set; } - - } -} 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/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..2468ac47f826e --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Watchlist.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.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 + /// content to skip before the header + /// The raw content that represents to + /// watchlist items to create. Example : This line will be skipped + /// header1,header2 + /// value1,value2 + /// The content type of the raw content. For + /// now, only text/csv is valid + /// The status of the Watchlist upload : + /// New, InProgress or Complete. **Note** : When a Watchlist upload + /// status is InProgress, the Watchlist cannot be deleted + 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)) + : 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; + 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 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. Example : This line will be skipped + /// header1,header2 + /// value1,value2 + /// + [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. For now, only + /// text/csv is valid + /// + [JsonProperty(PropertyName = "properties.contentType")] + public string ContentType { get; set; } + + /// + /// Gets or sets the status of the Watchlist upload : New, InProgress + /// or Complete. **Note** : When a Watchlist upload status is + /// InProgress, the Watchlist cannot be deleted + /// + [JsonProperty(PropertyName = "properties.uploadStatus")] + public string UploadStatus { 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..91b67bf38c095 --- /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/Operations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Operations.cs index 38e2e487d6dea..995c7fe742ea8 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Operations.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Operations.cs @@ -59,17 +59,34 @@ internal Operations(SecurityInsightsClient client) /// /// 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(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; @@ -148,14 +165,13 @@ internal Operations(SecurityInsightsClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -165,10 +181,6 @@ internal Operations(SecurityInsightsClient client) } 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); @@ -225,7 +237,7 @@ internal Operations(SecurityInsightsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -321,14 +333,13 @@ internal Operations(SecurityInsightsClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -338,10 +349,6 @@ internal Operations(SecurityInsightsClient client) } 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); 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..96544676a40c1 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,20 @@ 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("OperationalInsights", "Actions", "2021-10-01"), + new Tuple("OperationalInsights", "AlertRuleTemplates", "2021-10-01"), + new Tuple("OperationalInsights", "AlertRules", "2021-10-01"), + new Tuple("OperationalInsights", "IncidentComments", "2021-10-01"), + new Tuple("OperationalInsights", "IncidentRelations", "2021-10-01"), + new Tuple("OperationalInsights", "Incidents", "2021-10-01"), + new Tuple("SecurityInsights", "Operations", "2021-10-01"), + new Tuple("SecurityInsights", "ThreatIntelligenceIndicator", "2021-10-01"), + new Tuple("SecurityInsights", "ThreatIntelligenceIndicatorMetrics", "2021-10-01"), + new Tuple("SecurityInsights", "ThreatIntelligenceIndicators", "2021-10-01"), + new Tuple("SecurityInsights", "WatchlistItems", "2021-10-01"), + new Tuple("SecurityInsights", "Watchlists", "2021-10-01"), }.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..eca701e57fd91 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. @@ -76,44 +76,64 @@ public partial class SecurityInsightsClient : ServiceClient - /// Gets the IOperations. + /// Gets the IIncidentsOperations. /// - public virtual IOperations Operations { get; private set; } + public virtual IIncidentsOperations Incidents { get; private set; } /// - /// Gets the IAlertRulesOperations. + /// Gets the IIncidentCommentsOperations. /// - public virtual IAlertRulesOperations AlertRules { get; private set; } + public virtual IIncidentCommentsOperations IncidentComments { get; private set; } /// - /// Gets the IActionsOperations. + /// Gets the IIncidentRelationsOperations. /// - public virtual IActionsOperations Actions { get; private set; } + public virtual IIncidentRelationsOperations IncidentRelations { get; private set; } /// - /// Gets the IAlertRuleTemplatesOperations. + /// Gets the IThreatIntelligenceIndicatorOperations. /// - public virtual IAlertRuleTemplatesOperations AlertRuleTemplates { get; private set; } + public virtual IThreatIntelligenceIndicatorOperations ThreatIntelligenceIndicator { get; private set; } /// - /// Gets the IBookmarksOperations. + /// Gets the IThreatIntelligenceIndicatorsOperations. /// - public virtual IBookmarksOperations Bookmarks { get; private set; } + public virtual IThreatIntelligenceIndicatorsOperations ThreatIntelligenceIndicators { get; private set; } /// - /// Gets the IDataConnectorsOperations. + /// Gets the IThreatIntelligenceIndicatorMetricsOperations. /// - public virtual IDataConnectorsOperations DataConnectors { get; private set; } + public virtual IThreatIntelligenceIndicatorMetricsOperations ThreatIntelligenceIndicatorMetrics { get; private set; } /// - /// Gets the IIncidentsOperations. + /// Gets the IWatchlistsOperations. /// - public virtual IIncidentsOperations Incidents { get; private set; } + public virtual IWatchlistsOperations Watchlists { get; private set; } /// - /// Gets the IIncidentCommentsOperations. + /// Gets the IWatchlistItemsOperations. /// - public virtual IIncidentCommentsOperations IncidentComments { get; private set; } + public virtual IWatchlistItemsOperations WatchlistItems { get; private set; } + + /// + /// Gets the IOperations. + /// + public virtual IOperations Operations { get; private set; } + + /// + /// Gets the IAlertRulesOperations. + /// + public virtual IAlertRulesOperations AlertRules { get; private set; } + + /// + /// Gets the IActionsOperations. + /// + public virtual IActionsOperations Actions { get; private set; } + + /// + /// Gets the IAlertRuleTemplatesOperations. + /// + public virtual IAlertRuleTemplatesOperations AlertRuleTemplates { get; private set; } /// /// Initializes a new instance of the SecurityInsightsClient class. @@ -356,16 +376,20 @@ public SecurityInsightsClient(System.Uri baseUri, ServiceClientCredentials crede /// private void Initialize() { + Incidents = new IncidentsOperations(this); + IncidentComments = new IncidentCommentsOperations(this); + IncidentRelations = new IncidentRelationsOperations(this); + ThreatIntelligenceIndicator = new ThreatIntelligenceIndicatorOperations(this); + ThreatIntelligenceIndicators = new ThreatIntelligenceIndicatorsOperations(this); + ThreatIntelligenceIndicatorMetrics = new ThreatIntelligenceIndicatorMetricsOperations(this); + Watchlists = new WatchlistsOperations(this); + WatchlistItems = new WatchlistItemsOperations(this); Operations = new Operations(this); AlertRules = new AlertRulesOperations(this); Actions = new ActionsOperations(this); AlertRuleTemplates = new AlertRuleTemplatesOperations(this); - Bookmarks = new BookmarksOperations(this); - DataConnectors = new DataConnectorsOperations(this); - Incidents = new IncidentsOperations(this); - IncidentComments = new IncidentCommentsOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2020-01-01"; + ApiVersion = "2021-10-01"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; @@ -395,14 +419,14 @@ private void Initialize() new Iso8601TimeSpanConverter() } }; + 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/ThreatIntelligenceIndicatorMetricsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ThreatIntelligenceIndicatorMetricsOperations.cs new file mode 100644 index 0000000000000..4f7edb267823d --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ThreatIntelligenceIndicatorMetricsOperations.cs @@ -0,0 +1,292 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by 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 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(); + } + // 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..daa8cbde10d42 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ThreatIntelligenceIndicatorOperations.cs @@ -0,0 +1,1991 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by 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 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(); + } + // 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 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(); + } + // 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 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(); + } + // 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 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; + } + + /// + /// 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 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(); + } + // 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 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; + } + + /// + /// 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 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(); + } + // 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 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(); + } + // 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..14144ab07bc0c --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ThreatIntelligenceIndicatorsOperations.cs @@ -0,0 +1,494 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by 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. + /// + /// + /// 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. + /// + /// + /// Sorts the results. 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), int? top = default(int?), string skipToken = default(string), string orderby = 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("top", top); + tracingParameters.Add("skipToken", skipToken); + tracingParameters.Add("orderby", orderby); + 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 (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 (orderby != null) + { + _queryParameters.Add(string.Format("$orderby={0}", System.Uri.EscapeDataString(orderby))); + } + 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 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(); + } + // 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 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(); + } + // 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..143c2884935b4 --- /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. + /// + /// + /// 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. + /// + /// + /// Sorts the results. Optional. + /// + public static IPage List(this IThreatIntelligenceIndicatorsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string filter = default(string), int? top = default(int?), string skipToken = default(string), string orderby = default(string)) + { + return operations.ListAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, filter, top, skipToken, orderby).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. + /// + /// + /// 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. + /// + /// + /// Sorts the results. Optional. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IThreatIntelligenceIndicatorsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string filter = default(string), int? top = default(int?), string skipToken = default(string), string orderby = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, filter, top, skipToken, orderby, 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..a5d39da78bc56 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/WatchlistItemsOperations.cs @@ -0,0 +1,1259 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by 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; } + + /// + /// Get 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. + /// + /// + /// The watchlist alias + /// + /// + /// 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 watchlistAlias, 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 (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("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/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 (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 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(); + } + // 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 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. + /// + /// + /// The watchlist alias + /// + /// + /// The 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 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(); + } + // 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. + /// + /// + /// The watchlist alias + /// + /// + /// The 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 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; + } + + /// + /// Create or update 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. + /// + /// + /// The watchlist alias + /// + /// + /// The 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 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(); + } + // 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; + } + + /// + /// Get 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 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(); + } + // 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..55f6121e25d80 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/WatchlistItemsOperationsExtensions.cs @@ -0,0 +1,308 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by 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 + { + /// + /// Get 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. + /// + /// + /// The watchlist alias + /// + /// + /// 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 IWatchlistItemsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string watchlistAlias, string skipToken = default(string)) + { + return operations.ListAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, watchlistAlias, skipToken).GetAwaiter().GetResult(); + } + + /// + /// Get 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. + /// + /// + /// The watchlist alias + /// + /// + /// 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 IWatchlistItemsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string watchlistAlias, string skipToken = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, watchlistAlias, skipToken, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get 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. + /// + /// + /// The watchlist alias + /// + /// + /// The 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(); + } + + /// + /// Get 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. + /// + /// + /// The watchlist alias + /// + /// + /// The 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. + /// + /// + /// The watchlist alias + /// + /// + /// The 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. + /// + /// + /// The watchlist alias + /// + /// + /// The 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(); + } + + /// + /// Create or update 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. + /// + /// + /// The watchlist alias + /// + /// + /// The 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(); + } + + /// + /// Create or update 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. + /// + /// + /// The watchlist alias + /// + /// + /// The 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; + } + } + + /// + /// Get 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(); + } + + /// + /// Get 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/DataConnectorsOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/WatchlistsOperations.cs similarity index 78% rename from sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/DataConnectorsOperations.cs rename to sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/WatchlistsOperations.cs index bd4235e711488..9b9dfc6a2f180 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/DataConnectorsOperations.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/WatchlistsOperations.cs @@ -23,12 +23,12 @@ namespace Microsoft.Azure.Management.SecurityInsights using System.Threading.Tasks; /// - /// DataConnectorsOperations operations. + /// WatchlistsOperations operations. /// - internal partial class DataConnectorsOperations : IServiceOperations, IDataConnectorsOperations + internal partial class WatchlistsOperations : IServiceOperations, IWatchlistsOperations { /// - /// Initializes a new instance of the DataConnectorsOperations class. + /// Initializes a new instance of the WatchlistsOperations class. /// /// /// Reference to the service client. @@ -36,7 +36,7 @@ internal partial class DataConnectorsOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal DataConnectorsOperations(SecurityInsightsClient client) + internal WatchlistsOperations(SecurityInsightsClient client) { if (client == null) { @@ -51,22 +51,31 @@ internal DataConnectorsOperations(SecurityInsightsClient client) public SecurityInsightsClient Client { get; private set; } /// - /// Gets all data connectors. + /// Get all watchlists, without watchlist items. /// /// - /// 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. /// + /// + /// 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 /// /// @@ -81,17 +90,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, 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) @@ -108,10 +128,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,21 +156,28 @@ 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("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/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/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 (skipToken != null) + { + _queryParameters.Add(string.Format("$skipToken={0}", System.Uri.EscapeDataString(skipToken))); + } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); @@ -211,14 +238,13 @@ internal DataConnectorsOperations(SecurityInsightsClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -228,10 +254,6 @@ internal DataConnectorsOperations(SecurityInsightsClient client) } 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); @@ -244,7 +266,7 @@ internal DataConnectorsOperations(SecurityInsightsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -257,7 +279,7 @@ internal DataConnectorsOperations(SecurityInsightsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -277,17 +299,20 @@ internal DataConnectorsOperations(SecurityInsightsClient client) } /// - /// Gets a data connector. + /// Get a watchlist, without its watchlist items. /// /// - /// 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 watchlist alias /// /// /// Headers that will be added to request. @@ -295,7 +320,7 @@ internal DataConnectorsOperations(SecurityInsightsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -310,17 +335,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 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 (!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 +373,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) { @@ -357,9 +393,9 @@ internal DataConnectorsOperations(SecurityInsightsClient client) throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); } } - if (dataConnectorId == null) + if (watchlistAlias == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "dataConnectorId"); + throw new ValidationException(ValidationRules.CannotBeNull, "watchlistAlias"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -369,18 +405,20 @@ 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("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/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/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("{dataConnectorId}", System.Uri.EscapeDataString(dataConnectorId)); + _url = _url.Replace("{watchlistAlias}", System.Uri.EscapeDataString(watchlistAlias)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -446,14 +484,13 @@ internal DataConnectorsOperations(SecurityInsightsClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -463,10 +500,6 @@ internal DataConnectorsOperations(SecurityInsightsClient client) } 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); @@ -479,7 +512,7 @@ internal DataConnectorsOperations(SecurityInsightsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -492,7 +525,7 @@ internal DataConnectorsOperations(SecurityInsightsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -512,20 +545,20 @@ internal DataConnectorsOperations(SecurityInsightsClient client) } /// - /// Creates or updates the data connector. + /// Delete a watchlist. /// /// - /// 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 data connector + /// + /// The watchlist alias /// /// /// Headers that will be added to request. @@ -533,12 +566,9 @@ internal DataConnectorsOperations(SecurityInsightsClient client) /// /// 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 /// @@ -548,17 +578,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 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 (!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 +616,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) { @@ -595,13 +636,9 @@ internal DataConnectorsOperations(SecurityInsightsClient client) throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); } } - if (dataConnectorId == null) + if (watchlistAlias == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "dataConnectorId"); - } - if (dataConnector == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "dataConnector"); + throw new ValidationException(ValidationRules.CannotBeNull, "watchlistAlias"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -611,19 +648,20 @@ 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); + tracingParameters.Add("watchlistAlias", watchlistAlias); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + 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/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/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("{dataConnectorId}", System.Uri.EscapeDataString(dataConnectorId)); + _url = _url.Replace("{watchlistAlias}", System.Uri.EscapeDataString(watchlistAlias)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -636,7 +674,7 @@ internal DataConnectorsOperations(SecurityInsightsClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -667,12 +705,6 @@ internal DataConnectorsOperations(SecurityInsightsClient client) // Serialize Request string _requestContent = null; - if(dataConnector != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(dataConnector, 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) { @@ -693,16 +725,15 @@ internal DataConnectorsOperations(SecurityInsightsClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) + if ((int)_statusCode != 200 && (int)_statusCode != 204) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -712,10 +743,6 @@ internal DataConnectorsOperations(SecurityInsightsClient client) } 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); @@ -728,49 +755,13 @@ internal DataConnectorsOperations(SecurityInsightsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + 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); @@ -779,17 +770,25 @@ internal DataConnectorsOperations(SecurityInsightsClient client) } /// - /// Delete the data connector. + /// Create or update 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 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 watchlist alias + /// + /// + /// The watchlist /// /// /// Headers that will be added to request. @@ -797,9 +796,12 @@ internal DataConnectorsOperations(SecurityInsightsClient client) /// /// 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 /// @@ -809,17 +811,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> 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 (!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 +849,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) { @@ -856,9 +869,17 @@ internal DataConnectorsOperations(SecurityInsightsClient client) throw new ValidationException(ValidationRules.MinLength, "workspaceName", 1); } } - if (dataConnectorId == null) + if (watchlistAlias == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "watchlistAlias"); + } + if (watchlist == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "dataConnectorId"); + throw new ValidationException(ValidationRules.CannotBeNull, "watchlist"); + } + if (watchlist != null) + { + watchlist.Validate(); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -868,18 +889,21 @@ 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("watchlistAlias", watchlistAlias); + tracingParameters.Add("watchlist", watchlist); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", 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/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/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("{dataConnectorId}", System.Uri.EscapeDataString(dataConnectorId)); + _url = _url.Replace("{watchlistAlias}", System.Uri.EscapeDataString(watchlistAlias)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -892,7 +916,7 @@ internal DataConnectorsOperations(SecurityInsightsClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -923,6 +947,12 @@ internal DataConnectorsOperations(SecurityInsightsClient client) // 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) { @@ -943,16 +973,15 @@ internal DataConnectorsOperations(SecurityInsightsClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 204) + if ((int)_statusCode != 200 && (int)_statusCode != 201) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -962,10 +991,6 @@ internal DataConnectorsOperations(SecurityInsightsClient client) } 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); @@ -978,13 +1003,49 @@ internal DataConnectorsOperations(SecurityInsightsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + 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); @@ -993,7 +1054,7 @@ internal DataConnectorsOperations(SecurityInsightsClient client) } /// - /// Gets all data connectors. + /// Get all watchlists, without watchlist items. /// /// /// The NextLink from the previous successful call to List operation. @@ -1004,7 +1065,7 @@ internal DataConnectorsOperations(SecurityInsightsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1019,7 +1080,7 @@ internal DataConnectorsOperations(SecurityInsightsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListNextWithHttpMessagesAsync(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) { @@ -1100,14 +1161,13 @@ internal DataConnectorsOperations(SecurityInsightsClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1117,10 +1177,6 @@ internal DataConnectorsOperations(SecurityInsightsClient client) } 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); @@ -1133,7 +1189,7 @@ internal DataConnectorsOperations(SecurityInsightsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1146,7 +1202,7 @@ internal DataConnectorsOperations(SecurityInsightsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { 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..27d3f70eaa474 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/WatchlistsOperationsExtensions.cs @@ -0,0 +1,288 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by 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 + { + /// + /// Get 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. + /// + /// + /// 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 IWatchlistsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string skipToken = default(string)) + { + return operations.ListAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, skipToken).GetAwaiter().GetResult(); + } + + /// + /// Get 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. + /// + /// + /// 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 IWatchlistsOperations operations, string resourceGroupName, string operationalInsightsResourceProvider, string workspaceName, string skipToken = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, operationalInsightsResourceProvider, workspaceName, skipToken, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get 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. + /// + /// + /// The 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(); + } + + /// + /// Get 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. + /// + /// + /// The 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. + /// + /// + /// The 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. + /// + /// + /// The 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(); + } + + /// + /// Create or update 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. + /// + /// + /// The 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(); + } + + /// + /// Create or update 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. + /// + /// + /// The 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; + } + } + + /// + /// Get 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(); + } + + /// + /// Get 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; + } + } + + } +}