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 238a3989183a..8c0055f2654d 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ActionsOperations.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ActionsOperations.cs @@ -285,6 +285,753 @@ internal ActionsOperations(SecurityInsightsClient client) return _result; } + /// + /// 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 workspace. + /// + /// + /// Alert rule ID + /// + /// + /// Action ID + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string ruleId, string actionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + 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}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + 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 (ruleId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ruleId"); + } + if (actionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "actionId"); + } + // 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("ruleId", ruleId); + tracingParameters.Add("actionId", actionId); + 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/alertRules/{ruleId}/actions/{actionId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{ruleId}", System.Uri.EscapeDataString(ruleId)); + _url = _url.Replace("{actionId}", System.Uri.EscapeDataString(actionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates the action of alert rule. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the workspace. + /// + /// + /// Alert rule ID + /// + /// + /// Action ID + /// + /// + /// The action + /// + /// + /// 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 workspaceName, string ruleId, string actionId, ActionRequest action, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + 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}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + 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 (ruleId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ruleId"); + } + if (actionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "actionId"); + } + if (action == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "action"); + } + if (action != null) + { + action.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("workspaceName", workspaceName); + tracingParameters.Add("ruleId", ruleId); + tracingParameters.Add("actionId", actionId); + tracingParameters.Add("action", action); + 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/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{ruleId}", System.Uri.EscapeDataString(ruleId)); + _url = _url.Replace("{actionId}", System.Uri.EscapeDataString(actionId)); + 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(action != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(action, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete the action of alert rule. + /// + /// + /// The name of the resource group within the user's subscription. The name is + /// case insensitive. + /// + /// + /// The name of the workspace. + /// + /// + /// Alert rule ID + /// + /// + /// Action ID + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string ruleId, string actionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + 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}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + 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 (ruleId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ruleId"); + } + if (actionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "actionId"); + } + // 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("ruleId", ruleId); + tracingParameters.Add("actionId", actionId); + 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/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _url = _url.Replace("{ruleId}", System.Uri.EscapeDataString(ruleId)); + _url = _url.Replace("{actionId}", System.Uri.EscapeDataString(actionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// Gets all actions of alert rule. /// 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 2132c2d1675e..2d58d876af27 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ActionsOperationsExtensions.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/ActionsOperationsExtensions.cs @@ -69,6 +69,171 @@ public static IPage ListByAlertRule(this IActionsOperations oper } } + /// + /// Gets the action of alert rule. + /// + /// + /// 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. + /// + /// + /// Alert rule ID + /// + /// + /// Action ID + /// + public static ActionResponse Get(this IActionsOperations operations, string resourceGroupName, string workspaceName, string ruleId, string actionId) + { + return operations.GetAsync(resourceGroupName, workspaceName, ruleId, actionId).GetAwaiter().GetResult(); + } + + /// + /// Gets the action of alert rule. + /// + /// + /// 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. + /// + /// + /// Alert rule ID + /// + /// + /// Action ID + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IActionsOperations operations, string resourceGroupName, string workspaceName, string ruleId, string actionId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, workspaceName, ruleId, actionId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates the action of alert rule. + /// + /// + /// 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. + /// + /// + /// Alert rule ID + /// + /// + /// Action ID + /// + /// + /// The action + /// + public static ActionResponse CreateOrUpdate(this IActionsOperations operations, string resourceGroupName, string workspaceName, string ruleId, string actionId, ActionRequest action) + { + return operations.CreateOrUpdateAsync(resourceGroupName, workspaceName, ruleId, actionId, action).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates the action of alert rule. + /// + /// + /// 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. + /// + /// + /// Alert rule ID + /// + /// + /// Action ID + /// + /// + /// The action + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IActionsOperations operations, string resourceGroupName, string workspaceName, string ruleId, string actionId, ActionRequest action, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, ruleId, actionId, action, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete the action of alert rule. + /// + /// + /// 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. + /// + /// + /// Alert rule ID + /// + /// + /// Action ID + /// + public static void Delete(this IActionsOperations operations, string resourceGroupName, string workspaceName, string ruleId, string actionId) + { + operations.DeleteAsync(resourceGroupName, workspaceName, ruleId, actionId).GetAwaiter().GetResult(); + } + + /// + /// Delete the action of alert rule. + /// + /// + /// 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. + /// + /// + /// Alert rule ID + /// + /// + /// Action ID + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IActionsOperations operations, string resourceGroupName, string workspaceName, string ruleId, string actionId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, ruleId, actionId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// Gets all actions of alert rule. /// 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 c8d2723f789a..81b3fcd83e96 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AlertRulesOperations.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AlertRulesOperations.cs @@ -992,753 +992,6 @@ internal AlertRulesOperations(SecurityInsightsClient client) return _result; } - /// - /// 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 workspace. - /// - /// - /// Alert rule ID - /// - /// - /// Action 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> GetActionWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string ruleId, string actionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - 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}$")) - { - throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); - } - } - 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); - } - } - 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 (ruleId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ruleId"); - } - if (actionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "actionId"); - } - // 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("ruleId", ruleId); - tracingParameters.Add("actionId", actionId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetAction", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}").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("{ruleId}", System.Uri.EscapeDataString(ruleId)); - _url = _url.Replace("{actionId}", System.Uri.EscapeDataString(actionId)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Creates or updates the action of alert rule. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The name of the workspace. - /// - /// - /// Alert rule ID - /// - /// - /// Action ID - /// - /// - /// The action - /// - /// - /// 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> CreateOrUpdateActionWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string ruleId, string actionId, ActionRequest action, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - 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}$")) - { - throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); - } - } - 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); - } - } - 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 (ruleId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ruleId"); - } - if (actionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "actionId"); - } - if (action == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "action"); - } - if (action != null) - { - action.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("workspaceName", workspaceName); - tracingParameters.Add("ruleId", ruleId); - tracingParameters.Add("actionId", actionId); - tracingParameters.Add("action", action); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdateAction", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}").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("{ruleId}", System.Uri.EscapeDataString(ruleId)); - _url = _url.Replace("{actionId}", System.Uri.EscapeDataString(actionId)); - 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(action != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(action, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - // Deserialize Response - if ((int)_statusCode == 201) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Delete the action of alert rule. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The name of the workspace. - /// - /// - /// Alert rule ID - /// - /// - /// Action 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 DeleteActionWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string ruleId, string actionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - 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}$")) - { - throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); - } - } - 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 (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); - } - } - 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 (ruleId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ruleId"); - } - if (actionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "actionId"); - } - // 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("ruleId", ruleId); - tracingParameters.Add("actionId", actionId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "DeleteAction", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/alertRules/{ruleId}/actions/{actionId}").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("{ruleId}", System.Uri.EscapeDataString(ruleId)); - _url = _url.Replace("{actionId}", System.Uri.EscapeDataString(actionId)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 204) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - /// /// Gets all alert rules. /// 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 2363f6a86ad8..9aa94cc42f9d 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AlertRulesOperationsExtensions.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/AlertRulesOperationsExtensions.cs @@ -210,171 +210,6 @@ public static void Delete(this IAlertRulesOperations operations, string resource (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, ruleId, null, cancellationToken).ConfigureAwait(false)).Dispose(); } - /// - /// Gets the action of alert rule. - /// - /// - /// 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. - /// - /// - /// Alert rule ID - /// - /// - /// Action ID - /// - public static ActionResponse GetAction(this IAlertRulesOperations operations, string resourceGroupName, string workspaceName, string ruleId, string actionId) - { - return operations.GetActionAsync(resourceGroupName, workspaceName, ruleId, actionId).GetAwaiter().GetResult(); - } - - /// - /// Gets the action of alert rule. - /// - /// - /// 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. - /// - /// - /// Alert rule ID - /// - /// - /// Action ID - /// - /// - /// The cancellation token. - /// - public static async Task GetActionAsync(this IAlertRulesOperations operations, string resourceGroupName, string workspaceName, string ruleId, string actionId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetActionWithHttpMessagesAsync(resourceGroupName, workspaceName, ruleId, actionId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Creates or updates the action of alert rule. - /// - /// - /// 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. - /// - /// - /// Alert rule ID - /// - /// - /// Action ID - /// - /// - /// The action - /// - public static ActionResponse CreateOrUpdateAction(this IAlertRulesOperations operations, string resourceGroupName, string workspaceName, string ruleId, string actionId, ActionRequest action) - { - return operations.CreateOrUpdateActionAsync(resourceGroupName, workspaceName, ruleId, actionId, action).GetAwaiter().GetResult(); - } - - /// - /// Creates or updates the action of alert rule. - /// - /// - /// 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. - /// - /// - /// Alert rule ID - /// - /// - /// Action ID - /// - /// - /// The action - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateActionAsync(this IAlertRulesOperations operations, string resourceGroupName, string workspaceName, string ruleId, string actionId, ActionRequest action, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateActionWithHttpMessagesAsync(resourceGroupName, workspaceName, ruleId, actionId, action, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Delete the action of alert rule. - /// - /// - /// 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. - /// - /// - /// Alert rule ID - /// - /// - /// Action ID - /// - public static void DeleteAction(this IAlertRulesOperations operations, string resourceGroupName, string workspaceName, string ruleId, string actionId) - { - operations.DeleteActionAsync(resourceGroupName, workspaceName, ruleId, actionId).GetAwaiter().GetResult(); - } - - /// - /// Delete the action of alert rule. - /// - /// - /// 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. - /// - /// - /// Alert rule ID - /// - /// - /// Action ID - /// - /// - /// The cancellation token. - /// - public static async Task DeleteActionAsync(this IAlertRulesOperations operations, string resourceGroupName, string workspaceName, string ruleId, string actionId, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteActionWithHttpMessagesAsync(resourceGroupName, workspaceName, ruleId, actionId, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - /// /// Gets all alert rules. /// 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 9216d19c5b42..f42d11eaf67f 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IActionsOperations.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IActionsOperations.cs @@ -53,6 +53,102 @@ public partial interface IActionsOperations /// Task>> ListByAlertRuleWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string ruleId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Gets the action of alert rule. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the workspace. + /// + /// + /// Alert rule ID + /// + /// + /// Action ID + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string ruleId, string actionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates the action of alert rule. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the workspace. + /// + /// + /// Alert rule ID + /// + /// + /// Action ID + /// + /// + /// The action + /// + /// + /// 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 workspaceName, string ruleId, string actionId, ActionRequest action, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete the action of alert rule. + /// + /// + /// The name of the resource group within the user's subscription. The + /// name is case insensitive. + /// + /// + /// The name of the workspace. + /// + /// + /// Alert rule ID + /// + /// + /// Action ID + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string ruleId, string actionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Gets all actions of alert rule. /// /// diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IAlertRulesOperations.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IAlertRulesOperations.cs index b670f0f2bfa0..cf07ca8d976f 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IAlertRulesOperations.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/IAlertRulesOperations.cs @@ -137,102 +137,6 @@ public partial interface IAlertRulesOperations /// Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string ruleId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets the action of alert rule. - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// The name of the workspace. - /// - /// - /// Alert rule ID - /// - /// - /// Action 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> GetActionWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string ruleId, string actionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Creates or updates the action of alert rule. - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// The name of the workspace. - /// - /// - /// Alert rule ID - /// - /// - /// Action ID - /// - /// - /// The action - /// - /// - /// 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> CreateOrUpdateActionWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string ruleId, string actionId, ActionRequest action, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Delete the action of alert rule. - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// The name of the workspace. - /// - /// - /// Alert rule ID - /// - /// - /// Action 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 DeleteActionWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string ruleId, string actionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// /// Gets all alert rules. /// /// 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 2f80a2a756d8..66598dd90292 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 @@ -10,13 +10,11 @@ namespace Microsoft.Azure.Management.SecurityInsights.Models { - using Newtonsoft.Json; using System.Linq; /// /// Alert rule. /// - [Newtonsoft.Json.JsonObject("AlertRule")] public partial class AlertRule : ResourceWithEtag { /// 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 d17dfede4ed1..5fd7734c55bc 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 @@ -10,13 +10,11 @@ namespace Microsoft.Azure.Management.SecurityInsights.Models { - using Newtonsoft.Json; using System.Linq; /// /// Alert rule template. /// - [Newtonsoft.Json.JsonObject("AlertRuleTemplate")] public partial class AlertRuleTemplate : Resource { /// diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Bookmark.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Bookmark.cs index 7d62eebd04e4..24573b469b66 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Bookmark.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Bookmark.cs @@ -51,9 +51,12 @@ 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), IncidentInfo incidentInfo = default(IncidentInfo)) + 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) { Created = created; @@ -65,6 +68,9 @@ public Bookmark() QueryResult = queryResult; Updated = updated; UpdatedBy = updatedBy; + EventTime = eventTime; + QueryStartTime = queryStartTime; + QueryEndTime = queryEndTime; IncidentInfo = incidentInfo; CustomInit(); } @@ -128,6 +134,24 @@ 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 /// @@ -158,10 +182,6 @@ public virtual void Validate() { UpdatedBy.Validate(); } - if (IncidentInfo != null) - { - IncidentInfo.Validate(); - } } } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnector.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnector.cs index 374f876b556c..41ea4bba92e3 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnector.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/DataConnector.cs @@ -10,13 +10,11 @@ namespace Microsoft.Azure.Management.SecurityInsights.Models { - using Newtonsoft.Json; using System.Linq; /// /// Data connector. /// - [Newtonsoft.Json.JsonObject("DataConnector")] public partial class DataConnector : ResourceWithEtag { /// 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 d0db8e86d96a..a60cf8324174 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 @@ -16,8 +16,13 @@ namespace Microsoft.Azure.Management.SecurityInsights.Models using System.Linq; /// - /// The resource management 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.) + /// public partial class ErrorResponse { /// diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IncidentInfo.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IncidentInfo.cs index 20fb058fc188..ad9298165dfd 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IncidentInfo.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/IncidentInfo.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Management.SecurityInsights.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -36,7 +35,7 @@ public IncidentInfo() /// 'Informational' /// The title of the incident /// Relation Name - public IncidentInfo(string incidentId, string severity, string title, string relationName) + public IncidentInfo(string incidentId = default(string), string severity = default(string), string title = default(string), string relationName = default(string)) { IncidentId = incidentId; Severity = severity; @@ -75,30 +74,5 @@ public IncidentInfo(string incidentId, string severity, string title, string rel [JsonProperty(PropertyName = "relationName")] public string RelationName { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (IncidentId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "IncidentId"); - } - if (Severity == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Severity"); - } - if (Title == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Title"); - } - if (RelationName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "RelationName"); - } - } } } diff --git a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnectorDataTypes.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnectorDataTypes.cs index bef6879e2668..278bc09539aa 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnectorDataTypes.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnectorDataTypes.cs @@ -33,10 +33,12 @@ public OfficeDataConnectorDataTypes() /// /// Exchange data type connection. /// SharePoint data type connection. - public OfficeDataConnectorDataTypes(OfficeDataConnectorDataTypesExchange exchange = default(OfficeDataConnectorDataTypesExchange), OfficeDataConnectorDataTypesSharePoint sharePoint = default(OfficeDataConnectorDataTypesSharePoint)) + /// 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(); } @@ -57,5 +59,11 @@ public OfficeDataConnectorDataTypes() [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/OfficeDataConnectorDataTypesTeams.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnectorDataTypesTeams.cs new file mode 100644 index 000000000000..583503a8e8e4 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/OfficeDataConnectorDataTypesTeams.cs @@ -0,0 +1,48 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) 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; + + /// + /// Teams data type connection. + /// + public partial class OfficeDataConnectorDataTypesTeams : DataConnectorDataTypeCommon + { + /// + /// Initializes a new instance of the OfficeDataConnectorDataTypesTeams + /// class. + /// + public OfficeDataConnectorDataTypesTeams() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OfficeDataConnectorDataTypesTeams + /// class. + /// + /// Describe whether this data type connection is + /// enabled or not. Possible values include: 'Enabled', + /// 'Disabled' + public OfficeDataConnectorDataTypesTeams(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/Settings.cs b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Settings.cs index 4809548a8f3f..8c278ec9b2f5 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Settings.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/Settings.cs @@ -10,13 +10,11 @@ namespace Microsoft.Azure.Management.SecurityInsights.Models { - using Newtonsoft.Json; using System.Linq; /// /// The Settings. /// - [Newtonsoft.Json.JsonObject("Settings")] public partial class Settings : ResourceWithEtag { /// 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 index 4a837739a0a7..076630967b68 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ToggleSettings.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/ToggleSettings.cs @@ -18,7 +18,6 @@ namespace Microsoft.Azure.Management.SecurityInsights.Models /// /// Settings with single toggle. /// - [Newtonsoft.Json.JsonObject("ToggleSettings")] [Rest.Serialization.JsonTransformation] public partial class ToggleSettings : Settings { 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 index be44093fb468..840992edae71 100644 --- a/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/UebaSettings.cs +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/Models/UebaSettings.cs @@ -18,7 +18,6 @@ namespace Microsoft.Azure.Management.SecurityInsights.Models /// /// Represents settings for User and Entity Behavior Analytics enablement. /// - [Newtonsoft.Json.JsonObject("UebaSettings")] [Rest.Serialization.JsonTransformation] public partial class UebaSettings : Settings { 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 new file mode 100644 index 000000000000..64ffa0f18fb7 --- /dev/null +++ b/sdk/securityinsights/Microsoft.Azure.Management.SecurityInsights/src/Generated/SdkInfo_SecurityInsights.cs @@ -0,0 +1,34 @@ + +// +// Code generated by 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 System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_SecurityInsights + { + get + { + 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"), + }.AsEnumerable(); + } + } + } +}