diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AdaptiveApplicationControlsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AdaptiveApplicationControlsOperations.cs deleted file mode 100644 index 524870971a85..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AdaptiveApplicationControlsOperations.cs +++ /dev/null @@ -1,836 +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.Security -{ - 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; - - /// - /// AdaptiveApplicationControlsOperations operations. - /// - internal partial class AdaptiveApplicationControlsOperations : IServiceOperations, IAdaptiveApplicationControlsOperations - { - /// - /// Initializes a new instance of the AdaptiveApplicationControlsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal AdaptiveApplicationControlsOperations(SecurityCenterClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SecurityCenterClient - /// - public SecurityCenterClient Client { get; private set; } - - /// - /// Gets a list of application control machine groups for the subscription. - /// - /// - /// Include the policy rules - /// - /// - /// Return output in a summarized form - /// - /// - /// 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(bool? includePathRecommendations = default(bool?), bool? summary = default(bool?), 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}$"); - } - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("includePathRecommendations", includePathRecommendations); - tracingParameters.Add("summary", summary); - 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}/providers/Microsoft.Security/applicationWhitelistings").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (includePathRecommendations != null) - { - _queryParameters.Add(string.Format("includePathRecommendations={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(includePathRecommendations, Client.SerializationSettings).Trim('"')))); - } - if (summary != null) - { - _queryParameters.Add(string.Format("summary={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(summary, Client.SerializationSettings).Trim('"')))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets an application control VM/server group. - /// - /// - /// Name of an application control machine group - /// - /// - /// 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 groupName, 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 (Client.AscLocation == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.AscLocation"); - } - if (groupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "groupName"); - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("groupName", groupName); - tracingParameters.Add("apiVersion", apiVersion); - 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}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{ascLocation}", System.Uri.EscapeDataString(Client.AscLocation)); - _url = _url.Replace("{groupName}", System.Uri.EscapeDataString(groupName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Update an application control machine group - /// - /// - /// Name of an application control machine group - /// - /// - /// - /// - /// 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> PutWithHttpMessagesAsync(string groupName, AdaptiveApplicationControlGroup body, 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 (Client.AscLocation == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.AscLocation"); - } - if (groupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "groupName"); - } - if (body == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "body"); - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("groupName", groupName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("body", body); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Put", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{ascLocation}", System.Uri.EscapeDataString(Client.AscLocation)); - _url = _url.Replace("{groupName}", System.Uri.EscapeDataString(groupName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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(body != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Delete an application control machine group - /// - /// - /// Name of an application control machine group - /// - /// - /// 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 groupName, 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 (Client.AscLocation == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.AscLocation"); - } - if (groupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "groupName"); - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("groupName", groupName); - tracingParameters.Add("apiVersion", apiVersion); - 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}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{ascLocation}", System.Uri.EscapeDataString(Client.AscLocation)); - _url = _url.Replace("{groupName}", System.Uri.EscapeDataString(groupName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 != 202 && (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; - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AdaptiveApplicationControlsOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AdaptiveApplicationControlsOperationsExtensions.cs deleted file mode 100644 index d43ddfb37085..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AdaptiveApplicationControlsOperationsExtensions.cs +++ /dev/null @@ -1,168 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for AdaptiveApplicationControlsOperations. - /// - public static partial class AdaptiveApplicationControlsOperationsExtensions - { - /// - /// Gets a list of application control machine groups for the subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Include the policy rules - /// - /// - /// Return output in a summarized form - /// - public static AdaptiveApplicationControlGroups List(this IAdaptiveApplicationControlsOperations operations, bool? includePathRecommendations = default(bool?), bool? summary = default(bool?)) - { - return operations.ListAsync(includePathRecommendations, summary).GetAwaiter().GetResult(); - } - - /// - /// Gets a list of application control machine groups for the subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Include the policy rules - /// - /// - /// Return output in a summarized form - /// - /// - /// The cancellation token. - /// - public static async Task ListAsync(this IAdaptiveApplicationControlsOperations operations, bool? includePathRecommendations = default(bool?), bool? summary = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(includePathRecommendations, summary, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets an application control VM/server group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of an application control machine group - /// - public static AdaptiveApplicationControlGroup Get(this IAdaptiveApplicationControlsOperations operations, string groupName) - { - return operations.GetAsync(groupName).GetAwaiter().GetResult(); - } - - /// - /// Gets an application control VM/server group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of an application control machine group - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IAdaptiveApplicationControlsOperations operations, string groupName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(groupName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Update an application control machine group - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of an application control machine group - /// - /// - /// - public static AdaptiveApplicationControlGroup Put(this IAdaptiveApplicationControlsOperations operations, string groupName, AdaptiveApplicationControlGroup body) - { - return operations.PutAsync(groupName, body).GetAwaiter().GetResult(); - } - - /// - /// Update an application control machine group - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of an application control machine group - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task PutAsync(this IAdaptiveApplicationControlsOperations operations, string groupName, AdaptiveApplicationControlGroup body, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.PutWithHttpMessagesAsync(groupName, body, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Delete an application control machine group - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of an application control machine group - /// - public static void Delete(this IAdaptiveApplicationControlsOperations operations, string groupName) - { - operations.DeleteAsync(groupName).GetAwaiter().GetResult(); - } - - /// - /// Delete an application control machine group - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of an application control machine group - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IAdaptiveApplicationControlsOperations operations, string groupName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(groupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AdaptiveNetworkHardeningsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AdaptiveNetworkHardeningsOperations.cs deleted file mode 100644 index b40d5fa63f44..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AdaptiveNetworkHardeningsOperations.cs +++ /dev/null @@ -1,1003 +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.Security -{ - 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; - - /// - /// AdaptiveNetworkHardeningsOperations operations. - /// - internal partial class AdaptiveNetworkHardeningsOperations : IServiceOperations, IAdaptiveNetworkHardeningsOperations - { - /// - /// Initializes a new instance of the AdaptiveNetworkHardeningsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal AdaptiveNetworkHardeningsOperations(SecurityCenterClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SecurityCenterClient - /// - public SecurityCenterClient Client { get; private set; } - - /// - /// Gets a list of Adaptive Network Hardenings resources in scope of an - /// extended resource. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The Namespace of the resource. - /// - /// - /// The type of the resource. - /// - /// - /// Name of the resource. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListByExtendedResourceWithHttpMessagesAsync(string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, 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 (resourceNamespace == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceNamespace"); - } - if (resourceType == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceType"); - } - if (resourceName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("resourceNamespace", resourceNamespace); - tracingParameters.Add("resourceType", resourceType); - tracingParameters.Add("resourceName", resourceName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByExtendedResource", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{resourceNamespace}", System.Uri.EscapeDataString(resourceNamespace)); - _url = _url.Replace("{resourceType}", System.Uri.EscapeDataString(resourceType)); - _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets a single Adaptive Network Hardening resource - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The Namespace of the resource. - /// - /// - /// The type of the resource. - /// - /// - /// Name of the resource. - /// - /// - /// The name of the Adaptive Network Hardening resource. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, string adaptiveNetworkHardeningResourceName, 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 (resourceNamespace == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceNamespace"); - } - if (resourceType == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceType"); - } - if (resourceName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); - } - if (adaptiveNetworkHardeningResourceName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "adaptiveNetworkHardeningResourceName"); - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("resourceNamespace", resourceNamespace); - tracingParameters.Add("resourceType", resourceType); - tracingParameters.Add("resourceName", resourceName); - tracingParameters.Add("adaptiveNetworkHardeningResourceName", adaptiveNetworkHardeningResourceName); - tracingParameters.Add("apiVersion", apiVersion); - 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/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{resourceNamespace}", System.Uri.EscapeDataString(resourceNamespace)); - _url = _url.Replace("{resourceType}", System.Uri.EscapeDataString(resourceType)); - _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); - _url = _url.Replace("{adaptiveNetworkHardeningResourceName}", System.Uri.EscapeDataString(adaptiveNetworkHardeningResourceName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Enforces the given rules on the NSG(s) listed in the request - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The Namespace of the resource. - /// - /// - /// The type of the resource. - /// - /// - /// Name of the resource. - /// - /// - /// The name of the Adaptive Network Hardening resource. - /// - /// - /// The rules to enforce - /// - /// - /// The Azure resource IDs of the effective network security groups that will - /// be updated with the created security rules from the Adaptive Network - /// Hardening rules - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task EnforceWithHttpMessagesAsync(string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, string adaptiveNetworkHardeningResourceName, IList rules, IList networkSecurityGroups, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginEnforceWithHttpMessagesAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, adaptiveNetworkHardeningResourceName, rules, networkSecurityGroups, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Enforces the given rules on the NSG(s) listed in the request - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The Namespace of the resource. - /// - /// - /// The type of the resource. - /// - /// - /// Name of the resource. - /// - /// - /// The name of the Adaptive Network Hardening resource. - /// - /// - /// The rules to enforce - /// - /// - /// The Azure resource IDs of the effective network security groups that will - /// be updated with the created security rules from the Adaptive Network - /// Hardening rules - /// - /// - /// 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 BeginEnforceWithHttpMessagesAsync(string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, string adaptiveNetworkHardeningResourceName, IList rules, IList networkSecurityGroups, 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 (resourceNamespace == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceNamespace"); - } - if (resourceType == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceType"); - } - if (resourceName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); - } - if (adaptiveNetworkHardeningResourceName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "adaptiveNetworkHardeningResourceName"); - } - if (rules == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "rules"); - } - if (networkSecurityGroups == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "networkSecurityGroups"); - } - string adaptiveNetworkHardeningEnforceAction = "enforce"; - string apiVersion = "2020-01-01"; - AdaptiveNetworkHardeningEnforceRequest body = new AdaptiveNetworkHardeningEnforceRequest(); - if (rules != null || networkSecurityGroups != null) - { - body.Rules = rules; - body.NetworkSecurityGroups = networkSecurityGroups; - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("resourceNamespace", resourceNamespace); - tracingParameters.Add("resourceType", resourceType); - tracingParameters.Add("resourceName", resourceName); - tracingParameters.Add("adaptiveNetworkHardeningResourceName", adaptiveNetworkHardeningResourceName); - tracingParameters.Add("adaptiveNetworkHardeningEnforceAction", adaptiveNetworkHardeningEnforceAction); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("body", body); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginEnforce", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName}/{adaptiveNetworkHardeningEnforceAction}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{resourceNamespace}", System.Uri.EscapeDataString(resourceNamespace)); - _url = _url.Replace("{resourceType}", System.Uri.EscapeDataString(resourceType)); - _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); - _url = _url.Replace("{adaptiveNetworkHardeningResourceName}", System.Uri.EscapeDataString(adaptiveNetworkHardeningResourceName)); - _url = _url.Replace("{adaptiveNetworkHardeningEnforceAction}", System.Uri.EscapeDataString(adaptiveNetworkHardeningEnforceAction)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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(body != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, 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 != 202) - { - 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 a list of Adaptive Network Hardenings resources in scope of an - /// extended resource. - /// - /// - /// 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>> ListByExtendedResourceNextWithHttpMessagesAsync(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, "ListByExtendedResourceNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AdaptiveNetworkHardeningsOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AdaptiveNetworkHardeningsOperationsExtensions.cs deleted file mode 100644 index 1f698f88bf8a..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AdaptiveNetworkHardeningsOperationsExtensions.cs +++ /dev/null @@ -1,325 +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.Security -{ - 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 AdaptiveNetworkHardeningsOperations. - /// - public static partial class AdaptiveNetworkHardeningsOperationsExtensions - { - /// - /// Gets a list of Adaptive Network Hardenings resources in scope of an - /// extended 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 Namespace of the resource. - /// - /// - /// The type of the resource. - /// - /// - /// Name of the resource. - /// - public static IPage ListByExtendedResource(this IAdaptiveNetworkHardeningsOperations operations, string resourceGroupName, string resourceNamespace, string resourceType, string resourceName) - { - return operations.ListByExtendedResourceAsync(resourceGroupName, resourceNamespace, resourceType, resourceName).GetAwaiter().GetResult(); - } - - /// - /// Gets a list of Adaptive Network Hardenings resources in scope of an - /// extended 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 Namespace of the resource. - /// - /// - /// The type of the resource. - /// - /// - /// Name of the resource. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByExtendedResourceAsync(this IAdaptiveNetworkHardeningsOperations operations, string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByExtendedResourceWithHttpMessagesAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets a single Adaptive Network Hardening 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 Namespace of the resource. - /// - /// - /// The type of the resource. - /// - /// - /// Name of the resource. - /// - /// - /// The name of the Adaptive Network Hardening resource. - /// - public static AdaptiveNetworkHardening Get(this IAdaptiveNetworkHardeningsOperations operations, string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, string adaptiveNetworkHardeningResourceName) - { - return operations.GetAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, adaptiveNetworkHardeningResourceName).GetAwaiter().GetResult(); - } - - /// - /// Gets a single Adaptive Network Hardening 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 Namespace of the resource. - /// - /// - /// The type of the resource. - /// - /// - /// Name of the resource. - /// - /// - /// The name of the Adaptive Network Hardening resource. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IAdaptiveNetworkHardeningsOperations operations, string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, string adaptiveNetworkHardeningResourceName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, adaptiveNetworkHardeningResourceName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Enforces the given rules on the NSG(s) listed in the request - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The Namespace of the resource. - /// - /// - /// The type of the resource. - /// - /// - /// Name of the resource. - /// - /// - /// The name of the Adaptive Network Hardening resource. - /// - /// - /// The rules to enforce - /// - /// - /// The Azure resource IDs of the effective network security groups that will - /// be updated with the created security rules from the Adaptive Network - /// Hardening rules - /// - public static void Enforce(this IAdaptiveNetworkHardeningsOperations operations, string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, string adaptiveNetworkHardeningResourceName, IList rules, IList networkSecurityGroups) - { - operations.EnforceAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, adaptiveNetworkHardeningResourceName, rules, networkSecurityGroups).GetAwaiter().GetResult(); - } - - /// - /// Enforces the given rules on the NSG(s) listed in the request - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The Namespace of the resource. - /// - /// - /// The type of the resource. - /// - /// - /// Name of the resource. - /// - /// - /// The name of the Adaptive Network Hardening resource. - /// - /// - /// The rules to enforce - /// - /// - /// The Azure resource IDs of the effective network security groups that will - /// be updated with the created security rules from the Adaptive Network - /// Hardening rules - /// - /// - /// The cancellation token. - /// - public static async Task EnforceAsync(this IAdaptiveNetworkHardeningsOperations operations, string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, string adaptiveNetworkHardeningResourceName, IList rules, IList networkSecurityGroups, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.EnforceWithHttpMessagesAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, adaptiveNetworkHardeningResourceName, rules, networkSecurityGroups, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Enforces the given rules on the NSG(s) listed in the request - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The Namespace of the resource. - /// - /// - /// The type of the resource. - /// - /// - /// Name of the resource. - /// - /// - /// The name of the Adaptive Network Hardening resource. - /// - /// - /// The rules to enforce - /// - /// - /// The Azure resource IDs of the effective network security groups that will - /// be updated with the created security rules from the Adaptive Network - /// Hardening rules - /// - public static void BeginEnforce(this IAdaptiveNetworkHardeningsOperations operations, string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, string adaptiveNetworkHardeningResourceName, IList rules, IList networkSecurityGroups) - { - operations.BeginEnforceAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, adaptiveNetworkHardeningResourceName, rules, networkSecurityGroups).GetAwaiter().GetResult(); - } - - /// - /// Enforces the given rules on the NSG(s) listed in the request - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The Namespace of the resource. - /// - /// - /// The type of the resource. - /// - /// - /// Name of the resource. - /// - /// - /// The name of the Adaptive Network Hardening resource. - /// - /// - /// The rules to enforce - /// - /// - /// The Azure resource IDs of the effective network security groups that will - /// be updated with the created security rules from the Adaptive Network - /// Hardening rules - /// - /// - /// The cancellation token. - /// - public static async Task BeginEnforceAsync(this IAdaptiveNetworkHardeningsOperations operations, string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, string adaptiveNetworkHardeningResourceName, IList rules, IList networkSecurityGroups, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginEnforceWithHttpMessagesAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, adaptiveNetworkHardeningResourceName, rules, networkSecurityGroups, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Gets a list of Adaptive Network Hardenings resources in scope of an - /// extended resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByExtendedResourceNext(this IAdaptiveNetworkHardeningsOperations operations, string nextPageLink) - { - return operations.ListByExtendedResourceNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Gets a list of Adaptive Network Hardenings resources in scope of an - /// extended resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByExtendedResourceNextAsync(this IAdaptiveNetworkHardeningsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByExtendedResourceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AdvancedThreatProtectionOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AdvancedThreatProtectionOperations.cs deleted file mode 100644 index 13a4681b3563..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AdvancedThreatProtectionOperations.cs +++ /dev/null @@ -1,436 +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.Security -{ - 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; - - /// - /// AdvancedThreatProtectionOperations operations. - /// - internal partial class AdvancedThreatProtectionOperations : IServiceOperations, IAdvancedThreatProtectionOperations - { - /// - /// Initializes a new instance of the AdvancedThreatProtectionOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal AdvancedThreatProtectionOperations(SecurityCenterClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SecurityCenterClient - /// - public SecurityCenterClient Client { get; private set; } - - /// - /// Gets the Advanced Threat Protection settings for the specified resource. - /// - /// - /// The identifier of the resource. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetWithHttpMessagesAsync(string resourceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceId"); - } - string apiVersion = "2019-01-01"; - string settingName = "current"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceId", resourceId); - tracingParameters.Add("settingName", settingName); - 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("/") ? "" : "/")), "{resourceId}/providers/Microsoft.Security/advancedThreatProtectionSettings/{settingName}").ToString(); - _url = _url.Replace("{resourceId}", resourceId); - _url = _url.Replace("{settingName}", System.Uri.EscapeDataString(settingName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 Advanced Threat Protection settings on a specified - /// resource. - /// - /// - /// The identifier of the resource. - /// - /// - /// Indicates whether Advanced Threat Protection is enabled. - /// - /// - /// 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 resourceId, bool? isEnabled = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceId"); - } - string apiVersion = "2019-01-01"; - string settingName = "current"; - AdvancedThreatProtectionSetting advancedThreatProtectionSetting = new AdvancedThreatProtectionSetting(); - if (isEnabled != null) - { - advancedThreatProtectionSetting.IsEnabled = isEnabled; - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceId", resourceId); - tracingParameters.Add("settingName", settingName); - tracingParameters.Add("advancedThreatProtectionSetting", advancedThreatProtectionSetting); - 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("/") ? "" : "/")), "{resourceId}/providers/Microsoft.Security/advancedThreatProtectionSettings/{settingName}").ToString(); - _url = _url.Replace("{resourceId}", resourceId); - _url = _url.Replace("{settingName}", System.Uri.EscapeDataString(settingName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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(advancedThreatProtectionSetting != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(advancedThreatProtectionSetting, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AdvancedThreatProtectionOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AdvancedThreatProtectionOperationsExtensions.cs deleted file mode 100644 index 6781f07eda08..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AdvancedThreatProtectionOperationsExtensions.cs +++ /dev/null @@ -1,101 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for AdvancedThreatProtectionOperations. - /// - public static partial class AdvancedThreatProtectionOperationsExtensions - { - /// - /// Gets the Advanced Threat Protection settings for the specified resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - public static AdvancedThreatProtectionSetting Get(this IAdvancedThreatProtectionOperations operations, string resourceId) - { - return operations.GetAsync(resourceId).GetAwaiter().GetResult(); - } - - /// - /// Gets the Advanced Threat Protection settings for the specified resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IAdvancedThreatProtectionOperations operations, string resourceId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Creates or updates the Advanced Threat Protection settings on a specified - /// resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// Indicates whether Advanced Threat Protection is enabled. - /// - public static AdvancedThreatProtectionSetting Create(this IAdvancedThreatProtectionOperations operations, string resourceId, bool? isEnabled = default(bool?)) - { - return operations.CreateAsync(resourceId, isEnabled).GetAwaiter().GetResult(); - } - - /// - /// Creates or updates the Advanced Threat Protection settings on a specified - /// resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// Indicates whether Advanced Threat Protection is enabled. - /// - /// - /// The cancellation token. - /// - public static async Task CreateAsync(this IAdvancedThreatProtectionOperations operations, string resourceId, bool? isEnabled = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateWithHttpMessagesAsync(resourceId, isEnabled, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AlertsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AlertsOperations.cs deleted file mode 100644 index 1bc78bd210d0..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AlertsOperations.cs +++ /dev/null @@ -1,3294 +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.Security -{ - 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; - - /// - /// AlertsOperations operations. - /// - internal partial class AlertsOperations : IServiceOperations, IAlertsOperations - { - /// - /// Initializes a new instance of the AlertsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal AlertsOperations(SecurityCenterClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SecurityCenterClient - /// - public SecurityCenterClient Client { get; private set; } - - /// - /// List all the alerts that are associated with the subscription - /// - /// - /// 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(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}$"); - } - } - string apiVersion = "2021-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - 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}/providers/Microsoft.Security/alerts").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// List all the alerts that are associated with the resource group - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, 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\\._\\(\\)]+$"); - } - } - string apiVersion = "2021-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", 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.Security/alerts").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// List all the alerts that are associated with the subscription that are - /// stored in a specific location - /// - /// - /// 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>> ListSubscriptionLevelByRegionWithHttpMessagesAsync(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 (Client.AscLocation == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.AscLocation"); - } - string apiVersion = "2021-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListSubscriptionLevelByRegion", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{ascLocation}", System.Uri.EscapeDataString(Client.AscLocation)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// List all the alerts that are associated with the resource group that are - /// stored in a specific location - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// 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>> ListResourceGroupLevelByRegionWithHttpMessagesAsync(string resourceGroupName, 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 (Client.AscLocation == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.AscLocation"); - } - 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\\._\\(\\)]+$"); - } - } - string apiVersion = "2021-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListResourceGroupLevelByRegion", 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.Security/locations/{ascLocation}/alerts").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{ascLocation}", System.Uri.EscapeDataString(Client.AscLocation)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Get an alert that is associated with a subscription - /// - /// - /// Name of the alert object - /// - /// - /// 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> GetSubscriptionLevelWithHttpMessagesAsync(string alertName, 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 (Client.AscLocation == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.AscLocation"); - } - if (alertName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "alertName"); - } - string apiVersion = "2021-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("alertName", alertName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetSubscriptionLevel", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{ascLocation}", System.Uri.EscapeDataString(Client.AscLocation)); - _url = _url.Replace("{alertName}", System.Uri.EscapeDataString(alertName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Get an alert that is associated a resource group or a resource in a - /// resource group - /// - /// - /// Name of the alert object - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// 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> GetResourceGroupLevelWithHttpMessagesAsync(string alertName, string resourceGroupName, 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 (Client.AscLocation == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.AscLocation"); - } - if (alertName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "alertName"); - } - 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\\._\\(\\)]+$"); - } - } - string apiVersion = "2021-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("alertName", alertName); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetResourceGroupLevel", 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.Security/locations/{ascLocation}/alerts/{alertName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{ascLocation}", System.Uri.EscapeDataString(Client.AscLocation)); - _url = _url.Replace("{alertName}", System.Uri.EscapeDataString(alertName)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Update the alert's state - /// - /// - /// Name of the alert object - /// - /// - /// 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 UpdateSubscriptionLevelStateToDismissWithHttpMessagesAsync(string alertName, 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 (Client.AscLocation == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.AscLocation"); - } - if (alertName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "alertName"); - } - string apiVersion = "2021-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("alertName", alertName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "UpdateSubscriptionLevelStateToDismiss", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{ascLocation}", System.Uri.EscapeDataString(Client.AscLocation)); - _url = _url.Replace("{alertName}", System.Uri.EscapeDataString(alertName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 != 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; - } - - /// - /// Update the alert's state - /// - /// - /// Name of the alert object - /// - /// - /// 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 UpdateSubscriptionLevelStateToResolveWithHttpMessagesAsync(string alertName, 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 (Client.AscLocation == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.AscLocation"); - } - if (alertName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "alertName"); - } - string apiVersion = "2021-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("alertName", alertName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "UpdateSubscriptionLevelStateToResolve", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/resolve").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{ascLocation}", System.Uri.EscapeDataString(Client.AscLocation)); - _url = _url.Replace("{alertName}", System.Uri.EscapeDataString(alertName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 != 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; - } - - /// - /// Update the alert's state - /// - /// - /// Name of the alert object - /// - /// - /// 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 UpdateSubscriptionLevelStateToActivateWithHttpMessagesAsync(string alertName, 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 (Client.AscLocation == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.AscLocation"); - } - if (alertName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "alertName"); - } - string apiVersion = "2021-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("alertName", alertName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "UpdateSubscriptionLevelStateToActivate", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{ascLocation}", System.Uri.EscapeDataString(Client.AscLocation)); - _url = _url.Replace("{alertName}", System.Uri.EscapeDataString(alertName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 != 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; - } - - /// - /// Update the alert's state - /// - /// - /// Name of the alert object - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// 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 UpdateResourceGroupLevelStateToResolveWithHttpMessagesAsync(string alertName, string resourceGroupName, 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 (Client.AscLocation == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.AscLocation"); - } - if (alertName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "alertName"); - } - 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\\._\\(\\)]+$"); - } - } - string apiVersion = "2021-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("alertName", alertName); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "UpdateResourceGroupLevelStateToResolve", 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.Security/locations/{ascLocation}/alerts/{alertName}/resolve").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{ascLocation}", System.Uri.EscapeDataString(Client.AscLocation)); - _url = _url.Replace("{alertName}", System.Uri.EscapeDataString(alertName)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 != 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; - } - - /// - /// Update the alert's state - /// - /// - /// Name of the alert object - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// 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 UpdateResourceGroupLevelStateToDismissWithHttpMessagesAsync(string alertName, string resourceGroupName, 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 (Client.AscLocation == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.AscLocation"); - } - if (alertName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "alertName"); - } - 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\\._\\(\\)]+$"); - } - } - string apiVersion = "2021-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("alertName", alertName); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "UpdateResourceGroupLevelStateToDismiss", 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.Security/locations/{ascLocation}/alerts/{alertName}/dismiss").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{ascLocation}", System.Uri.EscapeDataString(Client.AscLocation)); - _url = _url.Replace("{alertName}", System.Uri.EscapeDataString(alertName)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 != 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; - } - - /// - /// Update the alert's state - /// - /// - /// Name of the alert object - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// 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 UpdateResourceGroupLevelStateToActivateWithHttpMessagesAsync(string alertName, string resourceGroupName, 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 (Client.AscLocation == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.AscLocation"); - } - if (alertName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "alertName"); - } - 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\\._\\(\\)]+$"); - } - } - string apiVersion = "2021-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("alertName", alertName); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "UpdateResourceGroupLevelStateToActivate", 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.Security/locations/{ascLocation}/alerts/{alertName}/activate").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{ascLocation}", System.Uri.EscapeDataString(Client.AscLocation)); - _url = _url.Replace("{alertName}", System.Uri.EscapeDataString(alertName)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 != 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; - } - - /// - /// Simulate security alerts - /// - /// - /// Alert Simulator request body data. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task SimulateWithHttpMessagesAsync(AlertSimulatorRequestProperties properties = default(AlertSimulatorRequestProperties), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginSimulateWithHttpMessagesAsync(properties, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Simulate security alerts - /// - /// - /// Alert Simulator request body data. - /// - /// - /// 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 BeginSimulateWithHttpMessagesAsync(AlertSimulatorRequestProperties properties = default(AlertSimulatorRequestProperties), 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 (Client.AscLocation == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.AscLocation"); - } - string apiVersion = "2021-01-01"; - AlertSimulatorRequestBody alertSimulatorRequestBody = new AlertSimulatorRequestBody(); - if (properties != null) - { - alertSimulatorRequestBody.Properties = properties; - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("alertSimulatorRequestBody", alertSimulatorRequestBody); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginSimulate", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/default/simulate").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{ascLocation}", System.Uri.EscapeDataString(Client.AscLocation)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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(alertSimulatorRequestBody != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(alertSimulatorRequestBody, 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 != 202) - { - 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; - } - - /// - /// List all the alerts that are associated with the subscription - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// List all the alerts that are associated with the resource group - /// - /// - /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(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, "ListByResourceGroupNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// List all the alerts that are associated with the subscription that are - /// stored in a specific location - /// - /// - /// 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>> ListSubscriptionLevelByRegionNextWithHttpMessagesAsync(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, "ListSubscriptionLevelByRegionNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// List all the alerts that are associated with the resource group that are - /// stored in a specific location - /// - /// - /// 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>> ListResourceGroupLevelByRegionNextWithHttpMessagesAsync(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, "ListResourceGroupLevelByRegionNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AlertsOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AlertsOperationsExtensions.cs deleted file mode 100644 index df7eed486658..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AlertsOperationsExtensions.cs +++ /dev/null @@ -1,647 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for AlertsOperations. - /// - public static partial class AlertsOperationsExtensions - { - /// - /// List all the alerts that are associated with the subscription - /// - /// - /// The operations group for this extension method. - /// - public static IPage List(this IAlertsOperations operations) - { - return operations.ListAsync().GetAwaiter().GetResult(); - } - - /// - /// List all the alerts that are associated with the subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IAlertsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// List all the alerts that are associated with the resource group - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - public static IPage ListByResourceGroup(this IAlertsOperations operations, string resourceGroupName) - { - return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); - } - - /// - /// List all the alerts that are associated with the resource group - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByResourceGroupAsync(this IAlertsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// List all the alerts that are associated with the subscription that are - /// stored in a specific location - /// - /// - /// The operations group for this extension method. - /// - public static IPage ListSubscriptionLevelByRegion(this IAlertsOperations operations) - { - return operations.ListSubscriptionLevelByRegionAsync().GetAwaiter().GetResult(); - } - - /// - /// List all the alerts that are associated with the subscription that are - /// stored in a specific location - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListSubscriptionLevelByRegionAsync(this IAlertsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListSubscriptionLevelByRegionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// List all the alerts that are associated with the resource group that are - /// stored in a specific location - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - public static IPage ListResourceGroupLevelByRegion(this IAlertsOperations operations, string resourceGroupName) - { - return operations.ListResourceGroupLevelByRegionAsync(resourceGroupName).GetAwaiter().GetResult(); - } - - /// - /// List all the alerts that are associated with the resource group that are - /// stored in a specific location - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The cancellation token. - /// - public static async Task> ListResourceGroupLevelByRegionAsync(this IAlertsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListResourceGroupLevelByRegionWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get an alert that is associated with a subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the alert object - /// - public static Alert GetSubscriptionLevel(this IAlertsOperations operations, string alertName) - { - return operations.GetSubscriptionLevelAsync(alertName).GetAwaiter().GetResult(); - } - - /// - /// Get an alert that is associated with a subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the alert object - /// - /// - /// The cancellation token. - /// - public static async Task GetSubscriptionLevelAsync(this IAlertsOperations operations, string alertName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetSubscriptionLevelWithHttpMessagesAsync(alertName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get an alert that is associated a resource group or a resource in a - /// resource group - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the alert object - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - public static Alert GetResourceGroupLevel(this IAlertsOperations operations, string alertName, string resourceGroupName) - { - return operations.GetResourceGroupLevelAsync(alertName, resourceGroupName).GetAwaiter().GetResult(); - } - - /// - /// Get an alert that is associated a resource group or a resource in a - /// resource group - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the alert object - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The cancellation token. - /// - public static async Task GetResourceGroupLevelAsync(this IAlertsOperations operations, string alertName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetResourceGroupLevelWithHttpMessagesAsync(alertName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Update the alert's state - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the alert object - /// - public static void UpdateSubscriptionLevelStateToDismiss(this IAlertsOperations operations, string alertName) - { - operations.UpdateSubscriptionLevelStateToDismissAsync(alertName).GetAwaiter().GetResult(); - } - - /// - /// Update the alert's state - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the alert object - /// - /// - /// The cancellation token. - /// - public static async Task UpdateSubscriptionLevelStateToDismissAsync(this IAlertsOperations operations, string alertName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.UpdateSubscriptionLevelStateToDismissWithHttpMessagesAsync(alertName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Update the alert's state - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the alert object - /// - public static void UpdateSubscriptionLevelStateToResolve(this IAlertsOperations operations, string alertName) - { - operations.UpdateSubscriptionLevelStateToResolveAsync(alertName).GetAwaiter().GetResult(); - } - - /// - /// Update the alert's state - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the alert object - /// - /// - /// The cancellation token. - /// - public static async Task UpdateSubscriptionLevelStateToResolveAsync(this IAlertsOperations operations, string alertName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.UpdateSubscriptionLevelStateToResolveWithHttpMessagesAsync(alertName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Update the alert's state - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the alert object - /// - public static void UpdateSubscriptionLevelStateToActivate(this IAlertsOperations operations, string alertName) - { - operations.UpdateSubscriptionLevelStateToActivateAsync(alertName).GetAwaiter().GetResult(); - } - - /// - /// Update the alert's state - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the alert object - /// - /// - /// The cancellation token. - /// - public static async Task UpdateSubscriptionLevelStateToActivateAsync(this IAlertsOperations operations, string alertName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.UpdateSubscriptionLevelStateToActivateWithHttpMessagesAsync(alertName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Update the alert's state - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the alert object - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - public static void UpdateResourceGroupLevelStateToResolve(this IAlertsOperations operations, string alertName, string resourceGroupName) - { - operations.UpdateResourceGroupLevelStateToResolveAsync(alertName, resourceGroupName).GetAwaiter().GetResult(); - } - - /// - /// Update the alert's state - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the alert object - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The cancellation token. - /// - public static async Task UpdateResourceGroupLevelStateToResolveAsync(this IAlertsOperations operations, string alertName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.UpdateResourceGroupLevelStateToResolveWithHttpMessagesAsync(alertName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Update the alert's state - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the alert object - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - public static void UpdateResourceGroupLevelStateToDismiss(this IAlertsOperations operations, string alertName, string resourceGroupName) - { - operations.UpdateResourceGroupLevelStateToDismissAsync(alertName, resourceGroupName).GetAwaiter().GetResult(); - } - - /// - /// Update the alert's state - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the alert object - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The cancellation token. - /// - public static async Task UpdateResourceGroupLevelStateToDismissAsync(this IAlertsOperations operations, string alertName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.UpdateResourceGroupLevelStateToDismissWithHttpMessagesAsync(alertName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Update the alert's state - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the alert object - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - public static void UpdateResourceGroupLevelStateToActivate(this IAlertsOperations operations, string alertName, string resourceGroupName) - { - operations.UpdateResourceGroupLevelStateToActivateAsync(alertName, resourceGroupName).GetAwaiter().GetResult(); - } - - /// - /// Update the alert's state - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the alert object - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The cancellation token. - /// - public static async Task UpdateResourceGroupLevelStateToActivateAsync(this IAlertsOperations operations, string alertName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.UpdateResourceGroupLevelStateToActivateWithHttpMessagesAsync(alertName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Simulate security alerts - /// - /// - /// The operations group for this extension method. - /// - /// - /// Alert Simulator request body data. - /// - public static void Simulate(this IAlertsOperations operations, AlertSimulatorRequestProperties properties = default(AlertSimulatorRequestProperties)) - { - operations.SimulateAsync(properties).GetAwaiter().GetResult(); - } - - /// - /// Simulate security alerts - /// - /// - /// The operations group for this extension method. - /// - /// - /// Alert Simulator request body data. - /// - /// - /// The cancellation token. - /// - public static async Task SimulateAsync(this IAlertsOperations operations, AlertSimulatorRequestProperties properties = default(AlertSimulatorRequestProperties), CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.SimulateWithHttpMessagesAsync(properties, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Simulate security alerts - /// - /// - /// The operations group for this extension method. - /// - /// - /// Alert Simulator request body data. - /// - public static void BeginSimulate(this IAlertsOperations operations, AlertSimulatorRequestProperties properties = default(AlertSimulatorRequestProperties)) - { - operations.BeginSimulateAsync(properties).GetAwaiter().GetResult(); - } - - /// - /// Simulate security alerts - /// - /// - /// The operations group for this extension method. - /// - /// - /// Alert Simulator request body data. - /// - /// - /// The cancellation token. - /// - public static async Task BeginSimulateAsync(this IAlertsOperations operations, AlertSimulatorRequestProperties properties = default(AlertSimulatorRequestProperties), CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginSimulateWithHttpMessagesAsync(properties, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// List all the alerts that are associated with the subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IAlertsOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// List all the alerts that are associated with the subscription - /// - /// - /// 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 IAlertsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// List all the alerts that are associated with the resource group - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByResourceGroupNext(this IAlertsOperations operations, string nextPageLink) - { - return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// List all the alerts that are associated with the resource group - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByResourceGroupNextAsync(this IAlertsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// List all the alerts that are associated with the subscription that are - /// stored in a specific location - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListSubscriptionLevelByRegionNext(this IAlertsOperations operations, string nextPageLink) - { - return operations.ListSubscriptionLevelByRegionNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// List all the alerts that are associated with the subscription that are - /// stored in a specific location - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListSubscriptionLevelByRegionNextAsync(this IAlertsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListSubscriptionLevelByRegionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// List all the alerts that are associated with the resource group that are - /// stored in a specific location - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListResourceGroupLevelByRegionNext(this IAlertsOperations operations, string nextPageLink) - { - return operations.ListResourceGroupLevelByRegionNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// List all the alerts that are associated with the resource group that are - /// stored in a specific location - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListResourceGroupLevelByRegionNextAsync(this IAlertsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListResourceGroupLevelByRegionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AlertsSuppressionRulesOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AlertsSuppressionRulesOperations.cs deleted file mode 100644 index 218a659c1e10..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AlertsSuppressionRulesOperations.cs +++ /dev/null @@ -1,992 +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.Security -{ - 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; - - /// - /// AlertsSuppressionRulesOperations operations. - /// - internal partial class AlertsSuppressionRulesOperations : IServiceOperations, IAlertsSuppressionRulesOperations - { - /// - /// Initializes a new instance of the AlertsSuppressionRulesOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal AlertsSuppressionRulesOperations(SecurityCenterClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SecurityCenterClient - /// - public SecurityCenterClient Client { get; private set; } - - /// - /// List of all the dismiss rules for the given subscription - /// - /// - /// Type of the alert to get rules for - /// - /// - /// 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 alertType = default(string), 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}$"); - } - } - string apiVersion = "2019-01-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("alertType", alertType); - 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}/providers/Microsoft.Security/alertsSuppressionRules").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (alertType != null) - { - _queryParameters.Add(string.Format("AlertType={0}", System.Uri.EscapeDataString(alertType))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Get dismiss rule, with name: {alertsSuppressionRuleName}, for the given - /// subscription - /// - /// - /// The unique name of the suppression alert rule - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetWithHttpMessagesAsync(string alertsSuppressionRuleName, 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 (alertsSuppressionRuleName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "alertsSuppressionRuleName"); - } - string apiVersion = "2019-01-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("alertsSuppressionRuleName", alertsSuppressionRuleName); - 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}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{alertsSuppressionRuleName}", System.Uri.EscapeDataString(alertsSuppressionRuleName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Update existing rule or create new rule if it doesn't exist - /// - /// - /// The unique name of the suppression alert rule - /// - /// - /// Suppression rule object - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> UpdateWithHttpMessagesAsync(string alertsSuppressionRuleName, AlertsSuppressionRule alertsSuppressionRule, 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 (alertsSuppressionRuleName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "alertsSuppressionRuleName"); - } - if (alertsSuppressionRule == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "alertsSuppressionRule"); - } - if (alertsSuppressionRule != null) - { - alertsSuppressionRule.Validate(); - } - string apiVersion = "2019-01-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("alertsSuppressionRuleName", alertsSuppressionRuleName); - tracingParameters.Add("alertsSuppressionRule", alertsSuppressionRule); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{alertsSuppressionRuleName}", System.Uri.EscapeDataString(alertsSuppressionRuleName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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(alertsSuppressionRule != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(alertsSuppressionRule, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Delete dismiss alert rule for this subscription. - /// - /// - /// The unique name of the suppression alert rule - /// - /// - /// 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 alertsSuppressionRuleName, 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 (alertsSuppressionRuleName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "alertsSuppressionRuleName"); - } - string apiVersion = "2019-01-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("alertsSuppressionRuleName", alertsSuppressionRuleName); - 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}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{alertsSuppressionRuleName}", System.Uri.EscapeDataString(alertsSuppressionRuleName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 != 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; - } - - /// - /// List of all the dismiss rules for the given subscription - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AlertsSuppressionRulesOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AlertsSuppressionRulesOperationsExtensions.cs deleted file mode 100644 index d1d174bcfe3a..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AlertsSuppressionRulesOperationsExtensions.cs +++ /dev/null @@ -1,200 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for AlertsSuppressionRulesOperations. - /// - public static partial class AlertsSuppressionRulesOperationsExtensions - { - /// - /// List of all the dismiss rules for the given subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// Type of the alert to get rules for - /// - public static IPage List(this IAlertsSuppressionRulesOperations operations, string alertType = default(string)) - { - return operations.ListAsync(alertType).GetAwaiter().GetResult(); - } - - /// - /// List of all the dismiss rules for the given subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// Type of the alert to get rules for - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IAlertsSuppressionRulesOperations operations, string alertType = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(alertType, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get dismiss rule, with name: {alertsSuppressionRuleName}, for the given - /// subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// The unique name of the suppression alert rule - /// - public static AlertsSuppressionRule Get(this IAlertsSuppressionRulesOperations operations, string alertsSuppressionRuleName) - { - return operations.GetAsync(alertsSuppressionRuleName).GetAwaiter().GetResult(); - } - - /// - /// Get dismiss rule, with name: {alertsSuppressionRuleName}, for the given - /// subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// The unique name of the suppression alert rule - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IAlertsSuppressionRulesOperations operations, string alertsSuppressionRuleName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(alertsSuppressionRuleName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Update existing rule or create new rule if it doesn't exist - /// - /// - /// The operations group for this extension method. - /// - /// - /// The unique name of the suppression alert rule - /// - /// - /// Suppression rule object - /// - public static AlertsSuppressionRule Update(this IAlertsSuppressionRulesOperations operations, string alertsSuppressionRuleName, AlertsSuppressionRule alertsSuppressionRule) - { - return operations.UpdateAsync(alertsSuppressionRuleName, alertsSuppressionRule).GetAwaiter().GetResult(); - } - - /// - /// Update existing rule or create new rule if it doesn't exist - /// - /// - /// The operations group for this extension method. - /// - /// - /// The unique name of the suppression alert rule - /// - /// - /// Suppression rule object - /// - /// - /// The cancellation token. - /// - public static async Task UpdateAsync(this IAlertsSuppressionRulesOperations operations, string alertsSuppressionRuleName, AlertsSuppressionRule alertsSuppressionRule, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.UpdateWithHttpMessagesAsync(alertsSuppressionRuleName, alertsSuppressionRule, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Delete dismiss alert rule for this subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The unique name of the suppression alert rule - /// - public static void Delete(this IAlertsSuppressionRulesOperations operations, string alertsSuppressionRuleName) - { - operations.DeleteAsync(alertsSuppressionRuleName).GetAwaiter().GetResult(); - } - - /// - /// Delete dismiss alert rule for this subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The unique name of the suppression alert rule - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IAlertsSuppressionRulesOperations operations, string alertsSuppressionRuleName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(alertsSuppressionRuleName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// List of all the dismiss rules for the given subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IAlertsSuppressionRulesOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// List of all the dismiss rules for the given subscription - /// - /// - /// 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 IAlertsSuppressionRulesOperations 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AllowedConnectionsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AllowedConnectionsOperations.cs deleted file mode 100644 index 683054249d40..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AllowedConnectionsOperations.cs +++ /dev/null @@ -1,999 +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.Security -{ - 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; - - /// - /// AllowedConnectionsOperations operations. - /// - internal partial class AllowedConnectionsOperations : IServiceOperations, IAllowedConnectionsOperations - { - /// - /// Initializes a new instance of the AllowedConnectionsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal AllowedConnectionsOperations(SecurityCenterClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SecurityCenterClient - /// - public SecurityCenterClient Client { get; private set; } - - /// - /// Gets the list of all possible traffic between resources for the - /// subscription - /// - /// - /// 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(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}$"); - } - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - 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}/providers/Microsoft.Security/allowedConnections").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets the list of all possible traffic between resources for the - /// subscription and location. - /// - /// - /// 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>> ListByHomeRegionWithHttpMessagesAsync(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 (Client.AscLocation == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.AscLocation"); - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByHomeRegion", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/allowedConnections").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{ascLocation}", System.Uri.EscapeDataString(Client.AscLocation)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets the list of all possible traffic between resources for the - /// subscription and location, based on connection type. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The type of allowed connections (Internal, External). Possible values - /// include: 'Internal', 'External' - /// - /// - /// 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 connectionType, 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 (Client.AscLocation == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.AscLocation"); - } - if (connectionType == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "connectionType"); - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("connectionType", connectionType); - tracingParameters.Add("apiVersion", apiVersion); - 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.Security/locations/{ascLocation}/allowedConnections/{connectionType}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{ascLocation}", System.Uri.EscapeDataString(Client.AscLocation)); - _url = _url.Replace("{connectionType}", System.Uri.EscapeDataString(connectionType)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets the list of all possible traffic between resources for the - /// subscription - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets the list of all possible traffic between resources for the - /// subscription and location. - /// - /// - /// 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>> ListByHomeRegionNextWithHttpMessagesAsync(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, "ListByHomeRegionNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AllowedConnectionsOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AllowedConnectionsOperationsExtensions.cs deleted file mode 100644 index e28c1214a53d..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AllowedConnectionsOperationsExtensions.cs +++ /dev/null @@ -1,203 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for AllowedConnectionsOperations. - /// - public static partial class AllowedConnectionsOperationsExtensions - { - /// - /// Gets the list of all possible traffic between resources for the - /// subscription - /// - /// - /// The operations group for this extension method. - /// - public static IPage List(this IAllowedConnectionsOperations operations) - { - return operations.ListAsync().GetAwaiter().GetResult(); - } - - /// - /// Gets the list of all possible traffic between resources for the - /// subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IAllowedConnectionsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets the list of all possible traffic between resources for the - /// subscription and location. - /// - /// - /// The operations group for this extension method. - /// - public static IPage ListByHomeRegion(this IAllowedConnectionsOperations operations) - { - return operations.ListByHomeRegionAsync().GetAwaiter().GetResult(); - } - - /// - /// Gets the list of all possible traffic between resources for the - /// subscription and location. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByHomeRegionAsync(this IAllowedConnectionsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByHomeRegionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets the list of all possible traffic between resources for the - /// subscription and location, based on connection type. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The type of allowed connections (Internal, External). Possible values - /// include: 'Internal', 'External' - /// - public static AllowedConnectionsResource Get(this IAllowedConnectionsOperations operations, string resourceGroupName, string connectionType) - { - return operations.GetAsync(resourceGroupName, connectionType).GetAwaiter().GetResult(); - } - - /// - /// Gets the list of all possible traffic between resources for the - /// subscription and location, based on connection type. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The type of allowed connections (Internal, External). Possible values - /// include: 'Internal', 'External' - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IAllowedConnectionsOperations operations, string resourceGroupName, string connectionType, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, connectionType, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets the list of all possible traffic between resources for the - /// subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IAllowedConnectionsOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Gets the list of all possible traffic between resources for the - /// subscription - /// - /// - /// 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 IAllowedConnectionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets the list of all possible traffic between resources for the - /// subscription and location. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByHomeRegionNext(this IAllowedConnectionsOperations operations, string nextPageLink) - { - return operations.ListByHomeRegionNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Gets the list of all possible traffic between resources for the - /// subscription and location. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByHomeRegionNextAsync(this IAllowedConnectionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByHomeRegionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AssessmentsMetadataOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AssessmentsMetadataOperations.cs deleted file mode 100644 index b757fa445559..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AssessmentsMetadataOperations.cs +++ /dev/null @@ -1,1504 +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.Security -{ - 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; - - /// - /// AssessmentsMetadataOperations operations. - /// - internal partial class AssessmentsMetadataOperations : IServiceOperations, IAssessmentsMetadataOperations - { - /// - /// Initializes a new instance of the AssessmentsMetadataOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal AssessmentsMetadataOperations(SecurityCenterClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SecurityCenterClient - /// - public SecurityCenterClient Client { get; private set; } - - /// - /// Get metadata information on all assessment types - /// - /// - /// 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 - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - 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("/") ? "" : "/")), "providers/Microsoft.Security/assessmentMetadata").ToString(); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Get metadata information on an assessment type - /// - /// - /// The Assessment Key - Unique key for the assessment type - /// - /// - /// 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 assessmentMetadataName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (assessmentMetadataName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "assessmentMetadataName"); - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("assessmentMetadataName", assessmentMetadataName); - 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("/") ? "" : "/")), "providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}").ToString(); - _url = _url.Replace("{assessmentMetadataName}", System.Uri.EscapeDataString(assessmentMetadataName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Get metadata information on all assessment types in a specific subscription - /// - /// - /// 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>> ListBySubscriptionWithHttpMessagesAsync(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}$"); - } - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Get metadata information on an assessment type in a specific subscription - /// - /// - /// The Assessment Key - Unique key for the assessment type - /// - /// - /// 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> GetInSubscriptionWithHttpMessagesAsync(string assessmentMetadataName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (assessmentMetadataName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "assessmentMetadataName"); - } - 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}$"); - } - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("assessmentMetadataName", assessmentMetadataName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetInSubscription", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}").ToString(); - _url = _url.Replace("{assessmentMetadataName}", System.Uri.EscapeDataString(assessmentMetadataName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Create metadata information on an assessment type in a specific - /// subscription - /// - /// - /// The Assessment Key - Unique key for the assessment type - /// - /// - /// AssessmentMetadata object - /// - /// - /// 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> CreateInSubscriptionWithHttpMessagesAsync(string assessmentMetadataName, SecurityAssessmentMetadata assessmentMetadata, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (assessmentMetadataName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "assessmentMetadataName"); - } - 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 (assessmentMetadata == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "assessmentMetadata"); - } - if (assessmentMetadata != null) - { - assessmentMetadata.Validate(); - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("assessmentMetadataName", assessmentMetadataName); - tracingParameters.Add("assessmentMetadata", assessmentMetadata); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateInSubscription", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}").ToString(); - _url = _url.Replace("{assessmentMetadataName}", System.Uri.EscapeDataString(assessmentMetadataName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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(assessmentMetadata != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(assessmentMetadata, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Delete metadata information on an assessment type in a specific - /// subscription, will cause the deletion of all the assessments of that type - /// in that subscription - /// - /// - /// The Assessment Key - Unique key for the assessment type - /// - /// - /// 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 DeleteInSubscriptionWithHttpMessagesAsync(string assessmentMetadataName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (assessmentMetadataName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "assessmentMetadataName"); - } - 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}$"); - } - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("assessmentMetadataName", assessmentMetadataName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "DeleteInSubscription", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}").ToString(); - _url = _url.Replace("{assessmentMetadataName}", System.Uri.EscapeDataString(assessmentMetadataName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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) - { - 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; - } - - /// - /// Get metadata information on all assessment types - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Get metadata information on all assessment types in a specific subscription - /// - /// - /// 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>> ListBySubscriptionNextWithHttpMessagesAsync(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, "ListBySubscriptionNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AssessmentsMetadataOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AssessmentsMetadataOperationsExtensions.cs deleted file mode 100644 index 107d2e3b56ae..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AssessmentsMetadataOperationsExtensions.cs +++ /dev/null @@ -1,294 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for AssessmentsMetadataOperations. - /// - public static partial class AssessmentsMetadataOperationsExtensions - { - /// - /// Get metadata information on all assessment types - /// - /// - /// The operations group for this extension method. - /// - public static IPage List(this IAssessmentsMetadataOperations operations) - { - return operations.ListAsync().GetAwaiter().GetResult(); - } - - /// - /// Get metadata information on all assessment types - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IAssessmentsMetadataOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get metadata information on an assessment type - /// - /// - /// The operations group for this extension method. - /// - /// - /// The Assessment Key - Unique key for the assessment type - /// - public static SecurityAssessmentMetadata Get(this IAssessmentsMetadataOperations operations, string assessmentMetadataName) - { - return operations.GetAsync(assessmentMetadataName).GetAwaiter().GetResult(); - } - - /// - /// Get metadata information on an assessment type - /// - /// - /// The operations group for this extension method. - /// - /// - /// The Assessment Key - Unique key for the assessment type - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IAssessmentsMetadataOperations operations, string assessmentMetadataName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(assessmentMetadataName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get metadata information on all assessment types in a specific subscription - /// - /// - /// The operations group for this extension method. - /// - public static IPage ListBySubscription(this IAssessmentsMetadataOperations operations) - { - return operations.ListBySubscriptionAsync().GetAwaiter().GetResult(); - } - - /// - /// Get metadata information on all assessment types in a specific subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListBySubscriptionAsync(this IAssessmentsMetadataOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get metadata information on an assessment type in a specific subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// The Assessment Key - Unique key for the assessment type - /// - public static SecurityAssessmentMetadata GetInSubscription(this IAssessmentsMetadataOperations operations, string assessmentMetadataName) - { - return operations.GetInSubscriptionAsync(assessmentMetadataName).GetAwaiter().GetResult(); - } - - /// - /// Get metadata information on an assessment type in a specific subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// The Assessment Key - Unique key for the assessment type - /// - /// - /// The cancellation token. - /// - public static async Task GetInSubscriptionAsync(this IAssessmentsMetadataOperations operations, string assessmentMetadataName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetInSubscriptionWithHttpMessagesAsync(assessmentMetadataName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Create metadata information on an assessment type in a specific - /// subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// The Assessment Key - Unique key for the assessment type - /// - /// - /// AssessmentMetadata object - /// - public static SecurityAssessmentMetadata CreateInSubscription(this IAssessmentsMetadataOperations operations, string assessmentMetadataName, SecurityAssessmentMetadata assessmentMetadata) - { - return operations.CreateInSubscriptionAsync(assessmentMetadataName, assessmentMetadata).GetAwaiter().GetResult(); - } - - /// - /// Create metadata information on an assessment type in a specific - /// subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// The Assessment Key - Unique key for the assessment type - /// - /// - /// AssessmentMetadata object - /// - /// - /// The cancellation token. - /// - public static async Task CreateInSubscriptionAsync(this IAssessmentsMetadataOperations operations, string assessmentMetadataName, SecurityAssessmentMetadata assessmentMetadata, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateInSubscriptionWithHttpMessagesAsync(assessmentMetadataName, assessmentMetadata, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Delete metadata information on an assessment type in a specific - /// subscription, will cause the deletion of all the assessments of that type - /// in that subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// The Assessment Key - Unique key for the assessment type - /// - public static void DeleteInSubscription(this IAssessmentsMetadataOperations operations, string assessmentMetadataName) - { - operations.DeleteInSubscriptionAsync(assessmentMetadataName).GetAwaiter().GetResult(); - } - - /// - /// Delete metadata information on an assessment type in a specific - /// subscription, will cause the deletion of all the assessments of that type - /// in that subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// The Assessment Key - Unique key for the assessment type - /// - /// - /// The cancellation token. - /// - public static async Task DeleteInSubscriptionAsync(this IAssessmentsMetadataOperations operations, string assessmentMetadataName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteInSubscriptionWithHttpMessagesAsync(assessmentMetadataName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Get metadata information on all assessment types - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IAssessmentsMetadataOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Get metadata information on all assessment types - /// - /// - /// 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 IAssessmentsMetadataOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get metadata information on all assessment types in a specific subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListBySubscriptionNext(this IAssessmentsMetadataOperations operations, string nextPageLink) - { - return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Get metadata information on all assessment types in a specific subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListBySubscriptionNextAsync(this IAssessmentsMetadataOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AssessmentsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AssessmentsOperations.cs deleted file mode 100644 index 1c5f938d1b19..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AssessmentsOperations.cs +++ /dev/null @@ -1,1003 +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.Security -{ - 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; - - /// - /// AssessmentsOperations operations. - /// - internal partial class AssessmentsOperations : IServiceOperations, IAssessmentsOperations - { - /// - /// Initializes a new instance of the AssessmentsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal AssessmentsOperations(SecurityCenterClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SecurityCenterClient - /// - public SecurityCenterClient Client { get; private set; } - - /// - /// Get security assessments on all your scanned resources inside a scope - /// - /// - /// Scope of the query, can be subscription - /// (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - /// (/providers/Microsoft.Management/managementGroups/mgName). - /// - /// - /// 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 scope, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (scope == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scope"); - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("scope", scope); - 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("/") ? "" : "/")), "{scope}/providers/Microsoft.Security/assessments").ToString(); - _url = _url.Replace("{scope}", scope); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Get a security assessment on your scanned resource - /// - /// - /// The identifier of the resource. - /// - /// - /// The Assessment Key - Unique key for the assessment type - /// - /// - /// OData expand. Optional. Possible values include: 'links', 'metadata' - /// - /// - /// 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 resourceId, string assessmentName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceId"); - } - if (assessmentName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "assessmentName"); - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceId", resourceId); - tracingParameters.Add("assessmentName", assessmentName); - tracingParameters.Add("expand", expand); - 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("/") ? "" : "/")), "{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}").ToString(); - _url = _url.Replace("{resourceId}", resourceId); - _url = _url.Replace("{assessmentName}", System.Uri.EscapeDataString(assessmentName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (expand != null) - { - _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Create a security assessment on your resource. An assessment metadata that - /// describes this assessment must be predefined with the same name before - /// inserting the assessment result - /// - /// - /// The identifier of the resource. - /// - /// - /// The Assessment Key - Unique key for the assessment type - /// - /// - /// Calculated assessment on a pre-defined assessment metadata - /// - /// - /// 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 resourceId, string assessmentName, SecurityAssessment assessment, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceId"); - } - if (assessmentName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "assessmentName"); - } - if (assessment == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "assessment"); - } - if (assessment != null) - { - assessment.Validate(); - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceId", resourceId); - tracingParameters.Add("assessmentName", assessmentName); - tracingParameters.Add("assessment", assessment); - 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("/") ? "" : "/")), "{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}").ToString(); - _url = _url.Replace("{resourceId}", resourceId); - _url = _url.Replace("{assessmentName}", System.Uri.EscapeDataString(assessmentName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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(assessment != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(assessment, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - // Deserialize Response - if ((int)_statusCode == 201) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Delete a security assessment on your resource. An assessment metadata that - /// describes this assessment must be predefined with the same name before - /// inserting the assessment result - /// - /// - /// The identifier of the resource. - /// - /// - /// The Assessment Key - Unique key for the assessment type - /// - /// - /// 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 resourceId, string assessmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceId"); - } - if (assessmentName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "assessmentName"); - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceId", resourceId); - tracingParameters.Add("assessmentName", assessmentName); - 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("/") ? "" : "/")), "{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}").ToString(); - _url = _url.Replace("{resourceId}", resourceId); - _url = _url.Replace("{assessmentName}", System.Uri.EscapeDataString(assessmentName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Get security assessments on all your scanned resources inside a scope - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AssessmentsOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AssessmentsOperationsExtensions.cs deleted file mode 100644 index c2268da5ea28..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AssessmentsOperationsExtensions.cs +++ /dev/null @@ -1,234 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for AssessmentsOperations. - /// - public static partial class AssessmentsOperationsExtensions - { - /// - /// Get security assessments on all your scanned resources inside a scope - /// - /// - /// The operations group for this extension method. - /// - /// - /// Scope of the query, can be subscription - /// (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - /// (/providers/Microsoft.Management/managementGroups/mgName). - /// - public static IPage List(this IAssessmentsOperations operations, string scope) - { - return operations.ListAsync(scope).GetAwaiter().GetResult(); - } - - /// - /// Get security assessments on all your scanned resources inside a scope - /// - /// - /// The operations group for this extension method. - /// - /// - /// Scope of the query, can be subscription - /// (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - /// (/providers/Microsoft.Management/managementGroups/mgName). - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IAssessmentsOperations operations, string scope, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(scope, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get a security assessment on your scanned resource - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// The Assessment Key - Unique key for the assessment type - /// - /// - /// OData expand. Optional. Possible values include: 'links', 'metadata' - /// - public static SecurityAssessment Get(this IAssessmentsOperations operations, string resourceId, string assessmentName, string expand = default(string)) - { - return operations.GetAsync(resourceId, assessmentName, expand).GetAwaiter().GetResult(); - } - - /// - /// Get a security assessment on your scanned resource - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// The Assessment Key - Unique key for the assessment type - /// - /// - /// OData expand. Optional. Possible values include: 'links', 'metadata' - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IAssessmentsOperations operations, string resourceId, string assessmentName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceId, assessmentName, expand, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Create a security assessment on your resource. An assessment metadata that - /// describes this assessment must be predefined with the same name before - /// inserting the assessment result - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// The Assessment Key - Unique key for the assessment type - /// - /// - /// Calculated assessment on a pre-defined assessment metadata - /// - public static SecurityAssessment CreateOrUpdate(this IAssessmentsOperations operations, string resourceId, string assessmentName, SecurityAssessment assessment) - { - return operations.CreateOrUpdateAsync(resourceId, assessmentName, assessment).GetAwaiter().GetResult(); - } - - /// - /// Create a security assessment on your resource. An assessment metadata that - /// describes this assessment must be predefined with the same name before - /// inserting the assessment result - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// The Assessment Key - Unique key for the assessment type - /// - /// - /// Calculated assessment on a pre-defined assessment metadata - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IAssessmentsOperations operations, string resourceId, string assessmentName, SecurityAssessment assessment, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceId, assessmentName, assessment, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Delete a security assessment on your resource. An assessment metadata that - /// describes this assessment must be predefined with the same name before - /// inserting the assessment result - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// The Assessment Key - Unique key for the assessment type - /// - public static void Delete(this IAssessmentsOperations operations, string resourceId, string assessmentName) - { - operations.DeleteAsync(resourceId, assessmentName).GetAwaiter().GetResult(); - } - - /// - /// Delete a security assessment on your resource. An assessment metadata that - /// describes this assessment must be predefined with the same name before - /// inserting the assessment result - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// The Assessment Key - Unique key for the assessment type - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IAssessmentsOperations operations, string resourceId, string assessmentName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(resourceId, assessmentName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Get security assessments on all your scanned resources inside a scope - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IAssessmentsOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Get security assessments on all your scanned resources inside a scope - /// - /// - /// 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 IAssessmentsOperations 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AutoProvisioningSettingsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AutoProvisioningSettingsOperations.cs deleted file mode 100644 index bac4d7455e1c..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AutoProvisioningSettingsOperations.cs +++ /dev/null @@ -1,814 +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.Security -{ - 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; - - /// - /// AutoProvisioningSettingsOperations operations. - /// - internal partial class AutoProvisioningSettingsOperations : IServiceOperations, IAutoProvisioningSettingsOperations - { - /// - /// Initializes a new instance of the AutoProvisioningSettingsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal AutoProvisioningSettingsOperations(SecurityCenterClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SecurityCenterClient - /// - public SecurityCenterClient Client { get; private set; } - - /// - /// Exposes the auto provisioning settings of the subscriptions - /// - /// - /// 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(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}$"); - } - } - string apiVersion = "2017-08-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - 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}/providers/Microsoft.Security/autoProvisioningSettings").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Details of a specific setting - /// - /// - /// Auto provisioning setting key - /// - /// - /// 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 settingName, 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 (settingName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "settingName"); - } - string apiVersion = "2017-08-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("settingName", settingName); - 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}/providers/Microsoft.Security/autoProvisioningSettings/{settingName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{settingName}", System.Uri.EscapeDataString(settingName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Details of a specific setting - /// - /// - /// Auto provisioning setting key - /// - /// - /// Describes what kind of security agent provisioning action to take. Possible - /// values include: 'On', 'Off' - /// - /// - /// 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 settingName, string autoProvision, 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 (settingName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "settingName"); - } - if (autoProvision == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "autoProvision"); - } - string apiVersion = "2017-08-01-preview"; - AutoProvisioningSetting setting = new AutoProvisioningSetting(); - if (autoProvision != null) - { - setting.AutoProvision = autoProvision; - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("settingName", settingName); - tracingParameters.Add("setting", setting); - 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}/providers/Microsoft.Security/autoProvisioningSettings/{settingName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{settingName}", System.Uri.EscapeDataString(settingName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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(setting != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(setting, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Exposes the auto provisioning settings of the subscriptions - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AutoProvisioningSettingsOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AutoProvisioningSettingsOperationsExtensions.cs deleted file mode 100644 index 12b72c1a682c..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AutoProvisioningSettingsOperationsExtensions.cs +++ /dev/null @@ -1,163 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for AutoProvisioningSettingsOperations. - /// - public static partial class AutoProvisioningSettingsOperationsExtensions - { - /// - /// Exposes the auto provisioning settings of the subscriptions - /// - /// - /// The operations group for this extension method. - /// - public static IPage List(this IAutoProvisioningSettingsOperations operations) - { - return operations.ListAsync().GetAwaiter().GetResult(); - } - - /// - /// Exposes the auto provisioning settings of the subscriptions - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IAutoProvisioningSettingsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Details of a specific setting - /// - /// - /// The operations group for this extension method. - /// - /// - /// Auto provisioning setting key - /// - public static AutoProvisioningSetting Get(this IAutoProvisioningSettingsOperations operations, string settingName) - { - return operations.GetAsync(settingName).GetAwaiter().GetResult(); - } - - /// - /// Details of a specific setting - /// - /// - /// The operations group for this extension method. - /// - /// - /// Auto provisioning setting key - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IAutoProvisioningSettingsOperations operations, string settingName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(settingName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Details of a specific setting - /// - /// - /// The operations group for this extension method. - /// - /// - /// Auto provisioning setting key - /// - /// - /// Describes what kind of security agent provisioning action to take. Possible - /// values include: 'On', 'Off' - /// - public static AutoProvisioningSetting Create(this IAutoProvisioningSettingsOperations operations, string settingName, string autoProvision) - { - return operations.CreateAsync(settingName, autoProvision).GetAwaiter().GetResult(); - } - - /// - /// Details of a specific setting - /// - /// - /// The operations group for this extension method. - /// - /// - /// Auto provisioning setting key - /// - /// - /// Describes what kind of security agent provisioning action to take. Possible - /// values include: 'On', 'Off' - /// - /// - /// The cancellation token. - /// - public static async Task CreateAsync(this IAutoProvisioningSettingsOperations operations, string settingName, string autoProvision, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateWithHttpMessagesAsync(settingName, autoProvision, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Exposes the auto provisioning settings of the subscriptions - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IAutoProvisioningSettingsOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Exposes the auto provisioning settings of the subscriptions - /// - /// - /// 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 IAutoProvisioningSettingsOperations 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AutomationsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AutomationsOperations.cs deleted file mode 100644 index d60283944484..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AutomationsOperations.cs +++ /dev/null @@ -1,1695 +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.Security -{ - 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; - - /// - /// AutomationsOperations operations. - /// - internal partial class AutomationsOperations : IServiceOperations, IAutomationsOperations - { - /// - /// Initializes a new instance of the AutomationsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal AutomationsOperations(SecurityCenterClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SecurityCenterClient - /// - public SecurityCenterClient Client { get; private set; } - - /// - /// Lists all the security automations in the specified subscription. Use the - /// 'nextLink' property in the response to get the next page of security - /// automations for the specified subscription. - /// - /// - /// 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(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}$"); - } - } - string apiVersion = "2019-01-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - 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}/providers/Microsoft.Security/automations").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Lists all the security automations in the specified resource group. Use the - /// 'nextLink' property in the response to get the next page of security - /// automations for the specified resource group. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, 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\\._\\(\\)]+$"); - } - } - string apiVersion = "2019-01-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", 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.Security/automations").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Retrieves information about the model of a security automation. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The security automation name. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string automationName, 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 (automationName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "automationName"); - } - string apiVersion = "2019-01-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("automationName", automationName); - 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.Security/automations/{automationName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{automationName}", System.Uri.EscapeDataString(automationName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 a security automation. If a security automation is - /// already created and a subsequent request is issued for the same automation - /// id, then it will be updated. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The security automation name. - /// - /// - /// The security automation resource - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string automationName, Automation automation, 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 (automationName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "automationName"); - } - if (automation == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "automation"); - } - string apiVersion = "2019-01-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("automationName", automationName); - tracingParameters.Add("automation", automation); - 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.Security/automations/{automationName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{automationName}", System.Uri.EscapeDataString(automationName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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(automation != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(automation, 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; - } - - /// - /// Deletes a security automation. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The security automation name. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string automationName, 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 (automationName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "automationName"); - } - string apiVersion = "2019-01-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("automationName", automationName); - 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.Security/automations/{automationName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{automationName}", System.Uri.EscapeDataString(automationName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 != 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; - } - - /// - /// Validates the security automation model before create or update. Any - /// validation errors are returned to the client. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The security automation name. - /// - /// - /// The security automation resource - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> ValidateWithHttpMessagesAsync(string resourceGroupName, string automationName, Automation automation, 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 (automationName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "automationName"); - } - if (automation == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "automation"); - } - string apiVersion = "2019-01-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("automationName", automationName); - tracingParameters.Add("automation", automation); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Validate", 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.Security/automations/{automationName}/validate").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{automationName}", System.Uri.EscapeDataString(automationName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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(automation != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(automation, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Lists all the security automations in the specified subscription. Use the - /// 'nextLink' property in the response to get the next page of security - /// automations for the specified subscription. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Lists all the security automations in the specified resource group. Use the - /// 'nextLink' property in the response to get the next page of security - /// automations for the specified resource group. - /// - /// - /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(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, "ListByResourceGroupNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AutomationsOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AutomationsOperationsExtensions.cs deleted file mode 100644 index 95d9935049fd..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/AutomationsOperationsExtensions.cs +++ /dev/null @@ -1,356 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for AutomationsOperations. - /// - public static partial class AutomationsOperationsExtensions - { - /// - /// Lists all the security automations in the specified subscription. Use the - /// 'nextLink' property in the response to get the next page of security - /// automations for the specified subscription. - /// - /// - /// The operations group for this extension method. - /// - public static IPage List(this IAutomationsOperations operations) - { - return operations.ListAsync().GetAwaiter().GetResult(); - } - - /// - /// Lists all the security automations in the specified subscription. Use the - /// 'nextLink' property in the response to get the next page of security - /// automations for the specified subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IAutomationsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Lists all the security automations in the specified resource group. Use the - /// 'nextLink' property in the response to get the next page of security - /// automations for the specified resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - public static IPage ListByResourceGroup(this IAutomationsOperations operations, string resourceGroupName) - { - return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); - } - - /// - /// Lists all the security automations in the specified resource group. Use the - /// 'nextLink' property in the response to get the next page of security - /// automations for the specified resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByResourceGroupAsync(this IAutomationsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Retrieves information about the model of a security automation. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The security automation name. - /// - public static Automation Get(this IAutomationsOperations operations, string resourceGroupName, string automationName) - { - return operations.GetAsync(resourceGroupName, automationName).GetAwaiter().GetResult(); - } - - /// - /// Retrieves information about the model of a security automation. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The security automation name. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IAutomationsOperations operations, string resourceGroupName, string automationName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, automationName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Creates or updates a security automation. If a security automation is - /// already created and a subsequent request is issued for the same automation - /// id, then it will be updated. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The security automation name. - /// - /// - /// The security automation resource - /// - public static Automation CreateOrUpdate(this IAutomationsOperations operations, string resourceGroupName, string automationName, Automation automation) - { - return operations.CreateOrUpdateAsync(resourceGroupName, automationName, automation).GetAwaiter().GetResult(); - } - - /// - /// Creates or updates a security automation. If a security automation is - /// already created and a subsequent request is issued for the same automation - /// id, then it will be updated. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The security automation name. - /// - /// - /// The security automation resource - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IAutomationsOperations operations, string resourceGroupName, string automationName, Automation automation, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, automationName, automation, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Deletes a security automation. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The security automation name. - /// - public static void Delete(this IAutomationsOperations operations, string resourceGroupName, string automationName) - { - operations.DeleteAsync(resourceGroupName, automationName).GetAwaiter().GetResult(); - } - - /// - /// Deletes a security automation. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The security automation name. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IAutomationsOperations operations, string resourceGroupName, string automationName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, automationName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Validates the security automation model before create or update. Any - /// validation errors are returned to the client. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The security automation name. - /// - /// - /// The security automation resource - /// - public static AutomationValidationStatus Validate(this IAutomationsOperations operations, string resourceGroupName, string automationName, Automation automation) - { - return operations.ValidateAsync(resourceGroupName, automationName, automation).GetAwaiter().GetResult(); - } - - /// - /// Validates the security automation model before create or update. Any - /// validation errors are returned to the client. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The security automation name. - /// - /// - /// The security automation resource - /// - /// - /// The cancellation token. - /// - public static async Task ValidateAsync(this IAutomationsOperations operations, string resourceGroupName, string automationName, Automation automation, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ValidateWithHttpMessagesAsync(resourceGroupName, automationName, automation, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Lists all the security automations in the specified subscription. Use the - /// 'nextLink' property in the response to get the next page of security - /// automations for the specified subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IAutomationsOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Lists all the security automations in the specified subscription. Use the - /// 'nextLink' property in the response to get the next page of security - /// automations for the specified subscription. - /// - /// - /// 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 IAutomationsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Lists all the security automations in the specified resource group. Use the - /// 'nextLink' property in the response to get the next page of security - /// automations for the specified resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByResourceGroupNext(this IAutomationsOperations operations, string nextPageLink) - { - return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Lists all the security automations in the specified resource group. Use the - /// 'nextLink' property in the response to get the next page of security - /// automations for the specified resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByResourceGroupNextAsync(this IAutomationsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ComplianceResultsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ComplianceResultsOperations.cs deleted file mode 100644 index bcdd9739ba99..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ComplianceResultsOperations.cs +++ /dev/null @@ -1,598 +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.Security -{ - 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; - - /// - /// ComplianceResultsOperations operations. - /// - internal partial class ComplianceResultsOperations : IServiceOperations, IComplianceResultsOperations - { - /// - /// Initializes a new instance of the ComplianceResultsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal ComplianceResultsOperations(SecurityCenterClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SecurityCenterClient - /// - public SecurityCenterClient Client { get; private set; } - - /// - /// Security compliance results in the subscription - /// - /// - /// Scope of the query, can be subscription - /// (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - /// (/providers/Microsoft.Management/managementGroups/mgName). - /// - /// - /// 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 scope, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (scope == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scope"); - } - string apiVersion = "2017-08-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("scope", scope); - 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("/") ? "" : "/")), "{scope}/providers/Microsoft.Security/complianceResults").ToString(); - _url = _url.Replace("{scope}", scope); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Security Compliance Result - /// - /// - /// The identifier of the resource. - /// - /// - /// name of the desired assessment compliance result - /// - /// - /// 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 resourceId, string complianceResultName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceId"); - } - if (complianceResultName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "complianceResultName"); - } - string apiVersion = "2017-08-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceId", resourceId); - tracingParameters.Add("complianceResultName", complianceResultName); - 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("/") ? "" : "/")), "{resourceId}/providers/Microsoft.Security/complianceResults/{complianceResultName}").ToString(); - _url = _url.Replace("{resourceId}", resourceId); - _url = _url.Replace("{complianceResultName}", System.Uri.EscapeDataString(complianceResultName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Security compliance results in the subscription - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ComplianceResultsOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ComplianceResultsOperationsExtensions.cs deleted file mode 100644 index 974a102a3266..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ComplianceResultsOperationsExtensions.cs +++ /dev/null @@ -1,137 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for ComplianceResultsOperations. - /// - public static partial class ComplianceResultsOperationsExtensions - { - /// - /// Security compliance results in the subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// Scope of the query, can be subscription - /// (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - /// (/providers/Microsoft.Management/managementGroups/mgName). - /// - public static IPage List(this IComplianceResultsOperations operations, string scope) - { - return operations.ListAsync(scope).GetAwaiter().GetResult(); - } - - /// - /// Security compliance results in the subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// Scope of the query, can be subscription - /// (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - /// (/providers/Microsoft.Management/managementGroups/mgName). - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IComplianceResultsOperations operations, string scope, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(scope, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Security Compliance Result - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// name of the desired assessment compliance result - /// - public static ComplianceResult Get(this IComplianceResultsOperations operations, string resourceId, string complianceResultName) - { - return operations.GetAsync(resourceId, complianceResultName).GetAwaiter().GetResult(); - } - - /// - /// Security Compliance Result - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// name of the desired assessment compliance result - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IComplianceResultsOperations operations, string resourceId, string complianceResultName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceId, complianceResultName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Security compliance results in the subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IComplianceResultsOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Security compliance results in the subscription - /// - /// - /// 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 IComplianceResultsOperations 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/CompliancesOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/CompliancesOperations.cs deleted file mode 100644 index 307faa6dcacc..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/CompliancesOperations.cs +++ /dev/null @@ -1,600 +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.Security -{ - 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; - - /// - /// CompliancesOperations operations. - /// - internal partial class CompliancesOperations : IServiceOperations, ICompliancesOperations - { - /// - /// Initializes a new instance of the CompliancesOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal CompliancesOperations(SecurityCenterClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SecurityCenterClient - /// - public SecurityCenterClient Client { get; private set; } - - /// - /// The Compliance scores of the specific management group. - /// - /// - /// Scope of the query, can be subscription - /// (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - /// (/providers/Microsoft.Management/managementGroups/mgName). - /// - /// - /// 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 scope, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (scope == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scope"); - } - string apiVersion = "2017-08-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("scope", scope); - 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("/") ? "" : "/")), "{scope}/providers/Microsoft.Security/compliances").ToString(); - _url = _url.Replace("{scope}", scope); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Details of a specific Compliance. - /// - /// - /// Scope of the query, can be subscription - /// (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - /// (/providers/Microsoft.Management/managementGroups/mgName). - /// - /// - /// name of the Compliance - /// - /// - /// 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 scope, string complianceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (scope == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scope"); - } - if (complianceName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "complianceName"); - } - string apiVersion = "2017-08-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("scope", scope); - tracingParameters.Add("complianceName", complianceName); - 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("/") ? "" : "/")), "{scope}/providers/Microsoft.Security/compliances/{complianceName}").ToString(); - _url = _url.Replace("{scope}", scope); - _url = _url.Replace("{complianceName}", System.Uri.EscapeDataString(complianceName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// The Compliance scores of the specific management group. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/CompliancesOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/CompliancesOperationsExtensions.cs deleted file mode 100644 index 5221eb55ab00..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/CompliancesOperationsExtensions.cs +++ /dev/null @@ -1,141 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for CompliancesOperations. - /// - public static partial class CompliancesOperationsExtensions - { - /// - /// The Compliance scores of the specific management group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Scope of the query, can be subscription - /// (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - /// (/providers/Microsoft.Management/managementGroups/mgName). - /// - public static IPage List(this ICompliancesOperations operations, string scope) - { - return operations.ListAsync(scope).GetAwaiter().GetResult(); - } - - /// - /// The Compliance scores of the specific management group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Scope of the query, can be subscription - /// (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - /// (/providers/Microsoft.Management/managementGroups/mgName). - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this ICompliancesOperations operations, string scope, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(scope, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Details of a specific Compliance. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Scope of the query, can be subscription - /// (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - /// (/providers/Microsoft.Management/managementGroups/mgName). - /// - /// - /// name of the Compliance - /// - public static Compliance Get(this ICompliancesOperations operations, string scope, string complianceName) - { - return operations.GetAsync(scope, complianceName).GetAwaiter().GetResult(); - } - - /// - /// Details of a specific Compliance. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Scope of the query, can be subscription - /// (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - /// (/providers/Microsoft.Management/managementGroups/mgName). - /// - /// - /// name of the Compliance - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this ICompliancesOperations operations, string scope, string complianceName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(scope, complianceName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// The Compliance scores of the specific management group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this ICompliancesOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// The Compliance scores of the specific management group. - /// - /// - /// 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 ICompliancesOperations 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ConnectorsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ConnectorsOperations.cs deleted file mode 100644 index 0c991b90f231..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ConnectorsOperations.cs +++ /dev/null @@ -1,992 +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.Security -{ - 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; - - /// - /// ConnectorsOperations operations. - /// - internal partial class ConnectorsOperations : IServiceOperations, IConnectorsOperations - { - /// - /// Initializes a new instance of the ConnectorsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal ConnectorsOperations(SecurityCenterClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SecurityCenterClient - /// - public SecurityCenterClient Client { get; private set; } - - /// - /// Cloud accounts connectors of a subscription - /// - /// - /// 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(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}$"); - } - } - string apiVersion = "2020-01-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - 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}/providers/Microsoft.Security/connectors").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Details of a specific cloud account connector - /// - /// - /// Name of the cloud account connector - /// - /// - /// 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 connectorName, 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 (connectorName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "connectorName"); - } - string apiVersion = "2020-01-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("connectorName", connectorName); - 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}/providers/Microsoft.Security/connectors/{connectorName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{connectorName}", System.Uri.EscapeDataString(connectorName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Create a cloud account connector or update an existing one. Connect to your - /// cloud account. For AWS, use either account credentials or role-based - /// authentication. For GCP, use account organization credentials. - /// - /// - /// Name of the cloud account connector - /// - /// - /// Settings for hybrid compute management. These settings are relevant only - /// for Arc autoProvision (Hybrid Compute). - /// - /// - /// Settings for authentication management, these settings are relevant only - /// for the cloud connector. - /// - /// - /// 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 connectorName, HybridComputeSettingsProperties hybridComputeSettings = default(HybridComputeSettingsProperties), AuthenticationDetailsProperties authenticationDetails = default(AuthenticationDetailsProperties), 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 (connectorName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "connectorName"); - } - if (hybridComputeSettings != null) - { - hybridComputeSettings.Validate(); - } - string apiVersion = "2020-01-01-preview"; - ConnectorSetting connectorSetting = new ConnectorSetting(); - if (hybridComputeSettings != null || authenticationDetails != null) - { - connectorSetting.HybridComputeSettings = hybridComputeSettings; - connectorSetting.AuthenticationDetails = authenticationDetails; - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("connectorName", connectorName); - tracingParameters.Add("connectorSetting", connectorSetting); - 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}/providers/Microsoft.Security/connectors/{connectorName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{connectorName}", System.Uri.EscapeDataString(connectorName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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(connectorSetting != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(connectorSetting, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Delete a cloud account connector from a subscription - /// - /// - /// Name of the cloud account connector - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task DeleteWithHttpMessagesAsync(string connectorName, 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 (connectorName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "connectorName"); - } - string apiVersion = "2020-01-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("connectorName", connectorName); - 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}/providers/Microsoft.Security/connectors/{connectorName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{connectorName}", System.Uri.EscapeDataString(connectorName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Cloud accounts connectors of a subscription - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ConnectorsOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ConnectorsOperationsExtensions.cs deleted file mode 100644 index 448906574d71..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ConnectorsOperationsExtensions.cs +++ /dev/null @@ -1,206 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for ConnectorsOperations. - /// - public static partial class ConnectorsOperationsExtensions - { - /// - /// Cloud accounts connectors of a subscription - /// - /// - /// The operations group for this extension method. - /// - public static IPage List(this IConnectorsOperations operations) - { - return operations.ListAsync().GetAwaiter().GetResult(); - } - - /// - /// Cloud accounts connectors of a subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IConnectorsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Details of a specific cloud account connector - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the cloud account connector - /// - public static ConnectorSetting Get(this IConnectorsOperations operations, string connectorName) - { - return operations.GetAsync(connectorName).GetAwaiter().GetResult(); - } - - /// - /// Details of a specific cloud account connector - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the cloud account connector - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IConnectorsOperations operations, string connectorName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(connectorName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Create a cloud account connector or update an existing one. Connect to your - /// cloud account. For AWS, use either account credentials or role-based - /// authentication. For GCP, use account organization credentials. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the cloud account connector - /// - /// - /// Settings for hybrid compute management. These settings are relevant only - /// for Arc autoProvision (Hybrid Compute). - /// - /// - /// Settings for authentication management, these settings are relevant only - /// for the cloud connector. - /// - public static ConnectorSetting CreateOrUpdate(this IConnectorsOperations operations, string connectorName, HybridComputeSettingsProperties hybridComputeSettings = default(HybridComputeSettingsProperties), AuthenticationDetailsProperties authenticationDetails = default(AuthenticationDetailsProperties)) - { - return operations.CreateOrUpdateAsync(connectorName, hybridComputeSettings, authenticationDetails).GetAwaiter().GetResult(); - } - - /// - /// Create a cloud account connector or update an existing one. Connect to your - /// cloud account. For AWS, use either account credentials or role-based - /// authentication. For GCP, use account organization credentials. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the cloud account connector - /// - /// - /// Settings for hybrid compute management. These settings are relevant only - /// for Arc autoProvision (Hybrid Compute). - /// - /// - /// Settings for authentication management, these settings are relevant only - /// for the cloud connector. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IConnectorsOperations operations, string connectorName, HybridComputeSettingsProperties hybridComputeSettings = default(HybridComputeSettingsProperties), AuthenticationDetailsProperties authenticationDetails = default(AuthenticationDetailsProperties), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(connectorName, hybridComputeSettings, authenticationDetails, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Delete a cloud account connector from a subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the cloud account connector - /// - public static void Delete(this IConnectorsOperations operations, string connectorName) - { - operations.DeleteAsync(connectorName).GetAwaiter().GetResult(); - } - - /// - /// Delete a cloud account connector from a subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the cloud account connector - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IConnectorsOperations operations, string connectorName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(connectorName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Cloud accounts connectors of a subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IConnectorsOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Cloud accounts connectors of a subscription - /// - /// - /// 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 IConnectorsOperations 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/DeviceSecurityGroupsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/DeviceSecurityGroupsOperations.cs deleted file mode 100644 index 5b6b3778b606..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/DeviceSecurityGroupsOperations.cs +++ /dev/null @@ -1,992 +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.Security -{ - 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; - - /// - /// DeviceSecurityGroupsOperations operations. - /// - internal partial class DeviceSecurityGroupsOperations : IServiceOperations, IDeviceSecurityGroupsOperations - { - /// - /// Initializes a new instance of the DeviceSecurityGroupsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal DeviceSecurityGroupsOperations(SecurityCenterClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SecurityCenterClient - /// - public SecurityCenterClient Client { get; private set; } - - /// - /// Use this method get the list of device security groups for the specified - /// IoT Hub resource. - /// - /// - /// The identifier of the resource. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListWithHttpMessagesAsync(string resourceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceId"); - } - string apiVersion = "2019-08-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceId", resourceId); - 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("/") ? "" : "/")), "{resourceId}/providers/Microsoft.Security/deviceSecurityGroups").ToString(); - _url = _url.Replace("{resourceId}", resourceId); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Use this method to get the device security group for the specified IoT Hub - /// resource. - /// - /// - /// The identifier of the resource. - /// - /// - /// The name of the device security group. Note that the name of the device - /// security group is case insensitive. - /// - /// - /// 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 resourceId, string deviceSecurityGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceId"); - } - if (deviceSecurityGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "deviceSecurityGroupName"); - } - string apiVersion = "2019-08-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceId", resourceId); - tracingParameters.Add("deviceSecurityGroupName", deviceSecurityGroupName); - 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("/") ? "" : "/")), "{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}").ToString(); - _url = _url.Replace("{resourceId}", resourceId); - _url = _url.Replace("{deviceSecurityGroupName}", System.Uri.EscapeDataString(deviceSecurityGroupName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Use this method to creates or updates the device security group on a - /// specified IoT Hub resource. - /// - /// - /// The identifier of the resource. - /// - /// - /// The name of the device security group. Note that the name of the device - /// security group is case insensitive. - /// - /// - /// Security group object. - /// - /// - /// 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 resourceId, string deviceSecurityGroupName, DeviceSecurityGroup deviceSecurityGroup, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceId"); - } - if (deviceSecurityGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "deviceSecurityGroupName"); - } - if (deviceSecurityGroup == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "deviceSecurityGroup"); - } - string apiVersion = "2019-08-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceId", resourceId); - tracingParameters.Add("deviceSecurityGroupName", deviceSecurityGroupName); - tracingParameters.Add("deviceSecurityGroup", deviceSecurityGroup); - 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("/") ? "" : "/")), "{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}").ToString(); - _url = _url.Replace("{resourceId}", resourceId); - _url = _url.Replace("{deviceSecurityGroupName}", System.Uri.EscapeDataString(deviceSecurityGroupName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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(deviceSecurityGroup != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(deviceSecurityGroup, 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; - } - - /// - /// User this method to deletes the device security group. - /// - /// - /// The identifier of the resource. - /// - /// - /// The name of the device security group. Note that the name of the device - /// security group is case insensitive. - /// - /// - /// 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 resourceId, string deviceSecurityGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceId"); - } - if (deviceSecurityGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "deviceSecurityGroupName"); - } - string apiVersion = "2019-08-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceId", resourceId); - tracingParameters.Add("deviceSecurityGroupName", deviceSecurityGroupName); - 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("/") ? "" : "/")), "{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}").ToString(); - _url = _url.Replace("{resourceId}", resourceId); - _url = _url.Replace("{deviceSecurityGroupName}", System.Uri.EscapeDataString(deviceSecurityGroupName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Use this method get the list of device security groups for the specified - /// IoT Hub resource. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/DeviceSecurityGroupsOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/DeviceSecurityGroupsOperationsExtensions.cs deleted file mode 100644 index 455397ad11d5..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/DeviceSecurityGroupsOperationsExtensions.cs +++ /dev/null @@ -1,230 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for DeviceSecurityGroupsOperations. - /// - public static partial class DeviceSecurityGroupsOperationsExtensions - { - /// - /// Use this method get the list of device security groups for the specified - /// IoT Hub resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - public static IPage List(this IDeviceSecurityGroupsOperations operations, string resourceId) - { - return operations.ListAsync(resourceId).GetAwaiter().GetResult(); - } - - /// - /// Use this method get the list of device security groups for the specified - /// IoT Hub resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IDeviceSecurityGroupsOperations operations, string resourceId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Use this method to get the device security group for the specified IoT Hub - /// resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// The name of the device security group. Note that the name of the device - /// security group is case insensitive. - /// - public static DeviceSecurityGroup Get(this IDeviceSecurityGroupsOperations operations, string resourceId, string deviceSecurityGroupName) - { - return operations.GetAsync(resourceId, deviceSecurityGroupName).GetAwaiter().GetResult(); - } - - /// - /// Use this method to get the device security group for the specified IoT Hub - /// resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// The name of the device security group. Note that the name of the device - /// security group is case insensitive. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IDeviceSecurityGroupsOperations operations, string resourceId, string deviceSecurityGroupName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceId, deviceSecurityGroupName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Use this method to creates or updates the device security group on a - /// specified IoT Hub resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// The name of the device security group. Note that the name of the device - /// security group is case insensitive. - /// - /// - /// Security group object. - /// - public static DeviceSecurityGroup CreateOrUpdate(this IDeviceSecurityGroupsOperations operations, string resourceId, string deviceSecurityGroupName, DeviceSecurityGroup deviceSecurityGroup) - { - return operations.CreateOrUpdateAsync(resourceId, deviceSecurityGroupName, deviceSecurityGroup).GetAwaiter().GetResult(); - } - - /// - /// Use this method to creates or updates the device security group on a - /// specified IoT Hub resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// The name of the device security group. Note that the name of the device - /// security group is case insensitive. - /// - /// - /// Security group object. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IDeviceSecurityGroupsOperations operations, string resourceId, string deviceSecurityGroupName, DeviceSecurityGroup deviceSecurityGroup, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceId, deviceSecurityGroupName, deviceSecurityGroup, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// User this method to deletes the device security group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// The name of the device security group. Note that the name of the device - /// security group is case insensitive. - /// - public static void Delete(this IDeviceSecurityGroupsOperations operations, string resourceId, string deviceSecurityGroupName) - { - operations.DeleteAsync(resourceId, deviceSecurityGroupName).GetAwaiter().GetResult(); - } - - /// - /// User this method to deletes the device security group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// The name of the device security group. Note that the name of the device - /// security group is case insensitive. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IDeviceSecurityGroupsOperations operations, string resourceId, string deviceSecurityGroupName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(resourceId, deviceSecurityGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Use this method get the list of device security groups for the specified - /// IoT Hub resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IDeviceSecurityGroupsOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Use this method get the list of device security groups for the specified - /// IoT Hub resource. - /// - /// - /// 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 IDeviceSecurityGroupsOperations 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/DiscoveredSecuritySolutionsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/DiscoveredSecuritySolutionsOperations.cs deleted file mode 100644 index 986b60e872f0..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/DiscoveredSecuritySolutionsOperations.cs +++ /dev/null @@ -1,995 +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.Security -{ - 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; - - /// - /// DiscoveredSecuritySolutionsOperations operations. - /// - internal partial class DiscoveredSecuritySolutionsOperations : IServiceOperations, IDiscoveredSecuritySolutionsOperations - { - /// - /// Initializes a new instance of the DiscoveredSecuritySolutionsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal DiscoveredSecuritySolutionsOperations(SecurityCenterClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SecurityCenterClient - /// - public SecurityCenterClient Client { get; private set; } - - /// - /// Gets a list of discovered Security Solutions for the subscription. - /// - /// - /// 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(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}$"); - } - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - 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}/providers/Microsoft.Security/discoveredSecuritySolutions").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets a list of discovered Security Solutions for the subscription and - /// location. - /// - /// - /// 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>> ListByHomeRegionWithHttpMessagesAsync(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 (Client.AscLocation == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.AscLocation"); - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByHomeRegion", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/discoveredSecuritySolutions").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{ascLocation}", System.Uri.EscapeDataString(Client.AscLocation)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets a specific discovered Security Solution. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// Name of a discovered security solution. - /// - /// - /// 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 discoveredSecuritySolutionName, 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 (Client.AscLocation == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.AscLocation"); - } - if (discoveredSecuritySolutionName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "discoveredSecuritySolutionName"); - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("discoveredSecuritySolutionName", discoveredSecuritySolutionName); - tracingParameters.Add("apiVersion", apiVersion); - 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.Security/locations/{ascLocation}/discoveredSecuritySolutions/{discoveredSecuritySolutionName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{ascLocation}", System.Uri.EscapeDataString(Client.AscLocation)); - _url = _url.Replace("{discoveredSecuritySolutionName}", System.Uri.EscapeDataString(discoveredSecuritySolutionName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets a list of discovered Security Solutions for the subscription. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets a list of discovered Security Solutions for the subscription and - /// location. - /// - /// - /// 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>> ListByHomeRegionNextWithHttpMessagesAsync(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, "ListByHomeRegionNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/DiscoveredSecuritySolutionsOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/DiscoveredSecuritySolutionsOperationsExtensions.cs deleted file mode 100644 index 33eab088f695..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/DiscoveredSecuritySolutionsOperationsExtensions.cs +++ /dev/null @@ -1,195 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for DiscoveredSecuritySolutionsOperations. - /// - public static partial class DiscoveredSecuritySolutionsOperationsExtensions - { - /// - /// Gets a list of discovered Security Solutions for the subscription. - /// - /// - /// The operations group for this extension method. - /// - public static IPage List(this IDiscoveredSecuritySolutionsOperations operations) - { - return operations.ListAsync().GetAwaiter().GetResult(); - } - - /// - /// Gets a list of discovered Security Solutions for the subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IDiscoveredSecuritySolutionsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets a list of discovered Security Solutions for the subscription and - /// location. - /// - /// - /// The operations group for this extension method. - /// - public static IPage ListByHomeRegion(this IDiscoveredSecuritySolutionsOperations operations) - { - return operations.ListByHomeRegionAsync().GetAwaiter().GetResult(); - } - - /// - /// Gets a list of discovered Security Solutions for the subscription and - /// location. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByHomeRegionAsync(this IDiscoveredSecuritySolutionsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByHomeRegionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets a specific discovered Security Solution. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// Name of a discovered security solution. - /// - public static DiscoveredSecuritySolution Get(this IDiscoveredSecuritySolutionsOperations operations, string resourceGroupName, string discoveredSecuritySolutionName) - { - return operations.GetAsync(resourceGroupName, discoveredSecuritySolutionName).GetAwaiter().GetResult(); - } - - /// - /// Gets a specific discovered Security Solution. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// Name of a discovered security solution. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IDiscoveredSecuritySolutionsOperations operations, string resourceGroupName, string discoveredSecuritySolutionName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, discoveredSecuritySolutionName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets a list of discovered Security Solutions for the subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IDiscoveredSecuritySolutionsOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Gets a list of discovered Security Solutions for the subscription. - /// - /// - /// 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 IDiscoveredSecuritySolutionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets a list of discovered Security Solutions for the subscription and - /// location. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByHomeRegionNext(this IDiscoveredSecuritySolutionsOperations operations, string nextPageLink) - { - return operations.ListByHomeRegionNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Gets a list of discovered Security Solutions for the subscription and - /// location. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByHomeRegionNextAsync(this IDiscoveredSecuritySolutionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByHomeRegionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ExternalSecuritySolutionsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ExternalSecuritySolutionsOperations.cs deleted file mode 100644 index 436163ba715f..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ExternalSecuritySolutionsOperations.cs +++ /dev/null @@ -1,995 +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.Security -{ - 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; - - /// - /// ExternalSecuritySolutionsOperations operations. - /// - internal partial class ExternalSecuritySolutionsOperations : IServiceOperations, IExternalSecuritySolutionsOperations - { - /// - /// Initializes a new instance of the ExternalSecuritySolutionsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal ExternalSecuritySolutionsOperations(SecurityCenterClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SecurityCenterClient - /// - public SecurityCenterClient Client { get; private set; } - - /// - /// Gets a list of external security solutions for the subscription. - /// - /// - /// 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(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}$"); - } - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - 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}/providers/Microsoft.Security/externalSecuritySolutions").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets a list of external Security Solutions for the subscription and - /// location. - /// - /// - /// 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>> ListByHomeRegionWithHttpMessagesAsync(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 (Client.AscLocation == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.AscLocation"); - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByHomeRegion", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/ExternalSecuritySolutions").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{ascLocation}", System.Uri.EscapeDataString(Client.AscLocation)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets a specific external Security Solution. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// Name of an external security solution. - /// - /// - /// 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 externalSecuritySolutionsName, 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 (Client.AscLocation == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.AscLocation"); - } - if (externalSecuritySolutionsName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "externalSecuritySolutionsName"); - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("externalSecuritySolutionsName", externalSecuritySolutionsName); - tracingParameters.Add("apiVersion", apiVersion); - 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.Security/locations/{ascLocation}/ExternalSecuritySolutions/{externalSecuritySolutionsName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{ascLocation}", System.Uri.EscapeDataString(Client.AscLocation)); - _url = _url.Replace("{externalSecuritySolutionsName}", System.Uri.EscapeDataString(externalSecuritySolutionsName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets a list of external security solutions for the subscription. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets a list of external Security Solutions for the subscription and - /// location. - /// - /// - /// 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>> ListByHomeRegionNextWithHttpMessagesAsync(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, "ListByHomeRegionNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ExternalSecuritySolutionsOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ExternalSecuritySolutionsOperationsExtensions.cs deleted file mode 100644 index 49c9f429e7b9..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ExternalSecuritySolutionsOperationsExtensions.cs +++ /dev/null @@ -1,195 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for ExternalSecuritySolutionsOperations. - /// - public static partial class ExternalSecuritySolutionsOperationsExtensions - { - /// - /// Gets a list of external security solutions for the subscription. - /// - /// - /// The operations group for this extension method. - /// - public static IPage List(this IExternalSecuritySolutionsOperations operations) - { - return operations.ListAsync().GetAwaiter().GetResult(); - } - - /// - /// Gets a list of external security solutions for the subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IExternalSecuritySolutionsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets a list of external Security Solutions for the subscription and - /// location. - /// - /// - /// The operations group for this extension method. - /// - public static IPage ListByHomeRegion(this IExternalSecuritySolutionsOperations operations) - { - return operations.ListByHomeRegionAsync().GetAwaiter().GetResult(); - } - - /// - /// Gets a list of external Security Solutions for the subscription and - /// location. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByHomeRegionAsync(this IExternalSecuritySolutionsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByHomeRegionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets a specific external Security Solution. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// Name of an external security solution. - /// - public static ExternalSecuritySolution Get(this IExternalSecuritySolutionsOperations operations, string resourceGroupName, string externalSecuritySolutionsName) - { - return operations.GetAsync(resourceGroupName, externalSecuritySolutionsName).GetAwaiter().GetResult(); - } - - /// - /// Gets a specific external Security Solution. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// Name of an external security solution. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IExternalSecuritySolutionsOperations operations, string resourceGroupName, string externalSecuritySolutionsName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, externalSecuritySolutionsName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets a list of external security solutions for the subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IExternalSecuritySolutionsOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Gets a list of external security solutions for the subscription. - /// - /// - /// 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 IExternalSecuritySolutionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets a list of external Security Solutions for the subscription and - /// location. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByHomeRegionNext(this IExternalSecuritySolutionsOperations operations, string nextPageLink) - { - return operations.ListByHomeRegionNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Gets a list of external Security Solutions for the subscription and - /// location. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByHomeRegionNextAsync(this IExternalSecuritySolutionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByHomeRegionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IAdaptiveApplicationControlsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IAdaptiveApplicationControlsOperations.cs deleted file mode 100644 index 695e503a7b24..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IAdaptiveApplicationControlsOperations.cs +++ /dev/null @@ -1,118 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// AdaptiveApplicationControlsOperations operations. - /// - public partial interface IAdaptiveApplicationControlsOperations - { - /// - /// Gets a list of application control machine groups for the - /// subscription. - /// - /// - /// Include the policy rules - /// - /// - /// Return output in a summarized form - /// - /// - /// 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(bool? includePathRecommendations = default(bool?), bool? summary = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets an application control VM/server group. - /// - /// - /// Name of an application control machine group - /// - /// - /// 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 groupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Update an application control machine group - /// - /// - /// Name of an application control machine group - /// - /// - /// - /// - /// 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> PutWithHttpMessagesAsync(string groupName, AdaptiveApplicationControlGroup body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Delete an application control machine group - /// - /// - /// Name of an application control machine group - /// - /// - /// 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 groupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IAdaptiveNetworkHardeningsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IAdaptiveNetworkHardeningsOperations.cs deleted file mode 100644 index 4b9f355f44a6..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IAdaptiveNetworkHardeningsOperations.cs +++ /dev/null @@ -1,198 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// AdaptiveNetworkHardeningsOperations operations. - /// - public partial interface IAdaptiveNetworkHardeningsOperations - { - /// - /// Gets a list of Adaptive Network Hardenings resources in scope of an - /// extended resource. - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// The Namespace of the resource. - /// - /// - /// The type of the resource. - /// - /// - /// Name of the resource. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByExtendedResourceWithHttpMessagesAsync(string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets a single Adaptive Network Hardening resource - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// The Namespace of the resource. - /// - /// - /// The type of the resource. - /// - /// - /// Name of the resource. - /// - /// - /// The name of the Adaptive Network Hardening resource. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, string adaptiveNetworkHardeningResourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Enforces the given rules on the NSG(s) listed in the request - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// The Namespace of the resource. - /// - /// - /// The type of the resource. - /// - /// - /// Name of the resource. - /// - /// - /// The name of the Adaptive Network Hardening resource. - /// - /// - /// The rules to enforce - /// - /// - /// The Azure resource IDs of the effective network security groups - /// that will be updated with the created security rules from the - /// Adaptive Network Hardening rules - /// - /// - /// 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 EnforceWithHttpMessagesAsync(string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, string adaptiveNetworkHardeningResourceName, IList rules, IList networkSecurityGroups, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Enforces the given rules on the NSG(s) listed in the request - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// The Namespace of the resource. - /// - /// - /// The type of the resource. - /// - /// - /// Name of the resource. - /// - /// - /// The name of the Adaptive Network Hardening resource. - /// - /// - /// The rules to enforce - /// - /// - /// The Azure resource IDs of the effective network security groups - /// that will be updated with the created security rules from the - /// Adaptive Network Hardening rules - /// - /// - /// 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 BeginEnforceWithHttpMessagesAsync(string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, string adaptiveNetworkHardeningResourceName, IList rules, IList networkSecurityGroups, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets a list of Adaptive Network Hardenings resources in scope of an - /// extended resource. - /// - /// - /// 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>> ListByExtendedResourceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IAdvancedThreatProtectionOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IAdvancedThreatProtectionOperations.cs deleted file mode 100644 index c87519d2675f..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IAdvancedThreatProtectionOperations.cs +++ /dev/null @@ -1,76 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// AdvancedThreatProtectionOperations operations. - /// - public partial interface IAdvancedThreatProtectionOperations - { - /// - /// Gets the Advanced Threat Protection settings for the specified - /// resource. - /// - /// - /// The identifier of the resource. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string resourceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Creates or updates the Advanced Threat Protection settings on a - /// specified resource. - /// - /// - /// The identifier of the resource. - /// - /// - /// Indicates whether Advanced Threat Protection is enabled. - /// - /// - /// 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 resourceId, bool? isEnabled = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IAlertsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IAlertsOperations.cs deleted file mode 100644 index 2e56aeefc2b3..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IAlertsOperations.cs +++ /dev/null @@ -1,416 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// AlertsOperations operations. - /// - public partial interface IAlertsOperations - { - /// - /// List all the alerts that are associated with the subscription - /// - /// - /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// List all the alerts that are associated with the resource group - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// List all the alerts that are associated with the subscription that - /// are stored in a specific location - /// - /// - /// 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>> ListSubscriptionLevelByRegionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// List all the alerts that are associated with the resource group - /// that are stored in a specific location - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// 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>> ListResourceGroupLevelByRegionWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get an alert that is associated with a subscription - /// - /// - /// Name of the alert object - /// - /// - /// 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> GetSubscriptionLevelWithHttpMessagesAsync(string alertName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get an alert that is associated a resource group or a resource in a - /// resource group - /// - /// - /// Name of the alert object - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// 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> GetResourceGroupLevelWithHttpMessagesAsync(string alertName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Update the alert's state - /// - /// - /// Name of the alert object - /// - /// - /// 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 UpdateSubscriptionLevelStateToDismissWithHttpMessagesAsync(string alertName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Update the alert's state - /// - /// - /// Name of the alert object - /// - /// - /// 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 UpdateSubscriptionLevelStateToResolveWithHttpMessagesAsync(string alertName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Update the alert's state - /// - /// - /// Name of the alert object - /// - /// - /// 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 UpdateSubscriptionLevelStateToActivateWithHttpMessagesAsync(string alertName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Update the alert's state - /// - /// - /// Name of the alert object - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// 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 UpdateResourceGroupLevelStateToResolveWithHttpMessagesAsync(string alertName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Update the alert's state - /// - /// - /// Name of the alert object - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// 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 UpdateResourceGroupLevelStateToDismissWithHttpMessagesAsync(string alertName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Update the alert's state - /// - /// - /// Name of the alert object - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// 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 UpdateResourceGroupLevelStateToActivateWithHttpMessagesAsync(string alertName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Simulate security alerts - /// - /// - /// Alert Simulator request body data. - /// - /// - /// 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 SimulateWithHttpMessagesAsync(AlertSimulatorRequestProperties properties = default(AlertSimulatorRequestProperties), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Simulate security alerts - /// - /// - /// Alert Simulator request body data. - /// - /// - /// 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 BeginSimulateWithHttpMessagesAsync(AlertSimulatorRequestProperties properties = default(AlertSimulatorRequestProperties), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// List all the alerts that are associated with the subscription - /// - /// - /// 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)); - /// - /// List all the alerts that are associated with the resource group - /// - /// - /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// List all the alerts that are associated with the subscription that - /// are stored in a specific location - /// - /// - /// 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>> ListSubscriptionLevelByRegionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// List all the alerts that are associated with the resource group - /// that are stored in a specific location - /// - /// - /// 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>> ListResourceGroupLevelByRegionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IAlertsSuppressionRulesOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IAlertsSuppressionRulesOperations.cs deleted file mode 100644 index 41741b5ec51b..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IAlertsSuppressionRulesOperations.cs +++ /dev/null @@ -1,138 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// AlertsSuppressionRulesOperations operations. - /// - public partial interface IAlertsSuppressionRulesOperations - { - /// - /// List of all the dismiss rules for the given subscription - /// - /// - /// Type of the alert to get rules for - /// - /// - /// 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 alertType = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get dismiss rule, with name: {alertsSuppressionRuleName}, for the - /// given subscription - /// - /// - /// The unique name of the suppression alert rule - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string alertsSuppressionRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Update existing rule or create new rule if it doesn't exist - /// - /// - /// The unique name of the suppression alert rule - /// - /// - /// Suppression rule object - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> UpdateWithHttpMessagesAsync(string alertsSuppressionRuleName, AlertsSuppressionRule alertsSuppressionRule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Delete dismiss alert rule for this subscription. - /// - /// - /// The unique name of the suppression alert rule - /// - /// - /// 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 alertsSuppressionRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// List of all the dismiss rules for the given subscription - /// - /// - /// 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IAllowedConnectionsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IAllowedConnectionsOperations.cs deleted file mode 100644 index 3dbfd8bc6b6f..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IAllowedConnectionsOperations.cs +++ /dev/null @@ -1,141 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// AllowedConnectionsOperations operations. - /// - public partial interface IAllowedConnectionsOperations - { - /// - /// Gets the list of all possible traffic between resources for the - /// subscription - /// - /// - /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets the list of all possible traffic between resources for the - /// subscription and location. - /// - /// - /// 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>> ListByHomeRegionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets the list of all possible traffic between resources for the - /// subscription and location, based on connection type. - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// The type of allowed connections (Internal, External). Possible - /// values include: 'Internal', 'External' - /// - /// - /// 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 connectionType, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets the list of all possible traffic between resources for the - /// subscription - /// - /// - /// 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)); - /// - /// Gets the list of all possible traffic between resources for the - /// subscription and location. - /// - /// - /// 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>> ListByHomeRegionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IAssessmentsMetadataOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IAssessmentsMetadataOperations.cs deleted file mode 100644 index 36485bc2cfda..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IAssessmentsMetadataOperations.cs +++ /dev/null @@ -1,203 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// AssessmentsMetadataOperations operations. - /// - public partial interface IAssessmentsMetadataOperations - { - /// - /// Get metadata information on all assessment types - /// - /// - /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get metadata information on an assessment type - /// - /// - /// The Assessment Key - Unique key for the assessment type - /// - /// - /// 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 assessmentMetadataName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get metadata information on all assessment types in a specific - /// subscription - /// - /// - /// 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>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get metadata information on an assessment type in a specific - /// subscription - /// - /// - /// The Assessment Key - Unique key for the assessment type - /// - /// - /// 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> GetInSubscriptionWithHttpMessagesAsync(string assessmentMetadataName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Create metadata information on an assessment type in a specific - /// subscription - /// - /// - /// The Assessment Key - Unique key for the assessment type - /// - /// - /// AssessmentMetadata object - /// - /// - /// 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> CreateInSubscriptionWithHttpMessagesAsync(string assessmentMetadataName, SecurityAssessmentMetadata assessmentMetadata, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Delete metadata information on an assessment type in a specific - /// subscription, will cause the deletion of all the assessments of - /// that type in that subscription - /// - /// - /// The Assessment Key - Unique key for the assessment type - /// - /// - /// 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 DeleteInSubscriptionWithHttpMessagesAsync(string assessmentMetadataName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get metadata information on all assessment types - /// - /// - /// 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)); - /// - /// Get metadata information on all assessment types in a specific - /// subscription - /// - /// - /// 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>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IAssessmentsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IAssessmentsOperations.cs deleted file mode 100644 index fd75194c9865..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IAssessmentsOperations.cs +++ /dev/null @@ -1,158 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// AssessmentsOperations operations. - /// - public partial interface IAssessmentsOperations - { - /// - /// Get security assessments on all your scanned resources inside a - /// scope - /// - /// - /// Scope of the query, can be subscription - /// (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management - /// group (/providers/Microsoft.Management/managementGroups/mgName). - /// - /// - /// 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 scope, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get a security assessment on your scanned resource - /// - /// - /// The identifier of the resource. - /// - /// - /// The Assessment Key - Unique key for the assessment type - /// - /// - /// OData expand. Optional. Possible values include: 'links', - /// 'metadata' - /// - /// - /// 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 resourceId, string assessmentName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Create a security assessment on your resource. An assessment - /// metadata that describes this assessment must be predefined with the - /// same name before inserting the assessment result - /// - /// - /// The identifier of the resource. - /// - /// - /// The Assessment Key - Unique key for the assessment type - /// - /// - /// Calculated assessment on a pre-defined assessment metadata - /// - /// - /// 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 resourceId, string assessmentName, SecurityAssessment assessment, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Delete a security assessment on your resource. An assessment - /// metadata that describes this assessment must be predefined with the - /// same name before inserting the assessment result - /// - /// - /// The identifier of the resource. - /// - /// - /// The Assessment Key - Unique key for the assessment type - /// - /// - /// 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 resourceId, string assessmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get security assessments on all your scanned resources inside a - /// scope - /// - /// - /// 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IAutoProvisioningSettingsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IAutoProvisioningSettingsOperations.cs deleted file mode 100644 index 571b1fea820f..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IAutoProvisioningSettingsOperations.cs +++ /dev/null @@ -1,116 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// AutoProvisioningSettingsOperations operations. - /// - public partial interface IAutoProvisioningSettingsOperations - { - /// - /// Exposes the auto provisioning settings of the subscriptions - /// - /// - /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Details of a specific setting - /// - /// - /// Auto provisioning setting key - /// - /// - /// 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 settingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Details of a specific setting - /// - /// - /// Auto provisioning setting key - /// - /// - /// Describes what kind of security agent provisioning action to take. - /// Possible values include: 'On', 'Off' - /// - /// - /// 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 settingName, string autoProvision, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Exposes the auto provisioning settings of the subscriptions - /// - /// - /// 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IAutomationsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IAutomationsOperations.cs deleted file mode 100644 index a36ee0aad28a..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IAutomationsOperations.cs +++ /dev/null @@ -1,231 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// AutomationsOperations operations. - /// - public partial interface IAutomationsOperations - { - /// - /// Lists all the security automations in the specified subscription. - /// Use the 'nextLink' property in the response to get the next page of - /// security automations for the specified subscription. - /// - /// - /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Lists all the security automations in the specified resource group. - /// Use the 'nextLink' property in the response to get the next page of - /// security automations for the specified resource group. - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Retrieves information about the model of a security automation. - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// The security automation name. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string automationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Creates or updates a security automation. If a security automation - /// is already created and a subsequent request is issued for the same - /// automation id, then it will be updated. - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// The security automation name. - /// - /// - /// The security automation resource - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string automationName, Automation automation, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes a security automation. - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// The security automation name. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string automationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Validates the security automation model before create or update. - /// Any validation errors are returned to the client. - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// The security automation name. - /// - /// - /// The security automation resource - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> ValidateWithHttpMessagesAsync(string resourceGroupName, string automationName, Automation automation, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Lists all the security automations in the specified subscription. - /// Use the 'nextLink' property in the response to get the next page of - /// security automations for the specified subscription. - /// - /// - /// 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)); - /// - /// Lists all the security automations in the specified resource group. - /// Use the 'nextLink' property in the response to get the next page of - /// security automations for the specified resource group. - /// - /// - /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IComplianceResultsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IComplianceResultsOperations.cs deleted file mode 100644 index 4f5a7c6d91af..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IComplianceResultsOperations.cs +++ /dev/null @@ -1,98 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// ComplianceResultsOperations operations. - /// - public partial interface IComplianceResultsOperations - { - /// - /// Security compliance results in the subscription - /// - /// - /// Scope of the query, can be subscription - /// (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management - /// group (/providers/Microsoft.Management/managementGroups/mgName). - /// - /// - /// 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 scope, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Security Compliance Result - /// - /// - /// The identifier of the resource. - /// - /// - /// name of the desired assessment compliance result - /// - /// - /// 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 resourceId, string complianceResultName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Security compliance results in the subscription - /// - /// - /// 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ICompliancesOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ICompliancesOperations.cs deleted file mode 100644 index 7fe5b67bd1c7..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ICompliancesOperations.cs +++ /dev/null @@ -1,100 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// CompliancesOperations operations. - /// - public partial interface ICompliancesOperations - { - /// - /// The Compliance scores of the specific management group. - /// - /// - /// Scope of the query, can be subscription - /// (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management - /// group (/providers/Microsoft.Management/managementGroups/mgName). - /// - /// - /// 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 scope, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Details of a specific Compliance. - /// - /// - /// Scope of the query, can be subscription - /// (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management - /// group (/providers/Microsoft.Management/managementGroups/mgName). - /// - /// - /// name of the Compliance - /// - /// - /// 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 scope, string complianceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// The Compliance scores of the specific management group. - /// - /// - /// 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IConnectorsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IConnectorsOperations.cs deleted file mode 100644 index 864144851048..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IConnectorsOperations.cs +++ /dev/null @@ -1,142 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// ConnectorsOperations operations. - /// - public partial interface IConnectorsOperations - { - /// - /// Cloud accounts connectors of a subscription - /// - /// - /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Details of a specific cloud account connector - /// - /// - /// Name of the cloud account connector - /// - /// - /// 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 connectorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Create a cloud account connector or update an existing one. Connect - /// to your cloud account. For AWS, use either account credentials or - /// role-based authentication. For GCP, use account organization - /// credentials. - /// - /// - /// Name of the cloud account connector - /// - /// - /// Settings for hybrid compute management. These settings are relevant - /// only for Arc autoProvision (Hybrid Compute). - /// - /// - /// Settings for authentication management, these settings are relevant - /// only for the cloud connector. - /// - /// - /// 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 connectorName, HybridComputeSettingsProperties hybridComputeSettings = default(HybridComputeSettingsProperties), AuthenticationDetailsProperties authenticationDetails = default(AuthenticationDetailsProperties), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Delete a cloud account connector from a subscription - /// - /// - /// Name of the cloud account connector - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - Task DeleteWithHttpMessagesAsync(string connectorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Cloud accounts connectors of a subscription - /// - /// - /// 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IDeviceSecurityGroupsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IDeviceSecurityGroupsOperations.cs deleted file mode 100644 index b42dcc21b25c..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IDeviceSecurityGroupsOperations.cs +++ /dev/null @@ -1,153 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// DeviceSecurityGroupsOperations operations. - /// - public partial interface IDeviceSecurityGroupsOperations - { - /// - /// Use this method get the list of device security groups for the - /// specified IoT Hub resource. - /// - /// - /// The identifier of the resource. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListWithHttpMessagesAsync(string resourceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Use this method to get the device security group for the specified - /// IoT Hub resource. - /// - /// - /// The identifier of the resource. - /// - /// - /// The name of the device security group. Note that the name of the - /// device security group is case insensitive. - /// - /// - /// 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 resourceId, string deviceSecurityGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Use this method to creates or updates the device security group on - /// a specified IoT Hub resource. - /// - /// - /// The identifier of the resource. - /// - /// - /// The name of the device security group. Note that the name of the - /// device security group is case insensitive. - /// - /// - /// Security group object. - /// - /// - /// 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 resourceId, string deviceSecurityGroupName, DeviceSecurityGroup deviceSecurityGroup, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// User this method to deletes the device security group. - /// - /// - /// The identifier of the resource. - /// - /// - /// The name of the device security group. Note that the name of the - /// device security group is case insensitive. - /// - /// - /// 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 resourceId, string deviceSecurityGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Use this method get the list of device security groups for the - /// specified IoT Hub resource. - /// - /// - /// 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IDiscoveredSecuritySolutionsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IDiscoveredSecuritySolutionsOperations.cs deleted file mode 100644 index 729cbdd31541..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IDiscoveredSecuritySolutionsOperations.cs +++ /dev/null @@ -1,137 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// DiscoveredSecuritySolutionsOperations operations. - /// - public partial interface IDiscoveredSecuritySolutionsOperations - { - /// - /// Gets a list of discovered Security Solutions for the subscription. - /// - /// - /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets a list of discovered Security Solutions for the subscription - /// and location. - /// - /// - /// 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>> ListByHomeRegionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets a specific discovered Security Solution. - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// Name of a discovered security solution. - /// - /// - /// 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 discoveredSecuritySolutionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets a list of discovered Security Solutions for the subscription. - /// - /// - /// 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)); - /// - /// Gets a list of discovered Security Solutions for the subscription - /// and location. - /// - /// - /// 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>> ListByHomeRegionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IExternalSecuritySolutionsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IExternalSecuritySolutionsOperations.cs deleted file mode 100644 index f258aaadccdb..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IExternalSecuritySolutionsOperations.cs +++ /dev/null @@ -1,137 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// ExternalSecuritySolutionsOperations operations. - /// - public partial interface IExternalSecuritySolutionsOperations - { - /// - /// Gets a list of external security solutions for the subscription. - /// - /// - /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets a list of external Security Solutions for the subscription and - /// location. - /// - /// - /// 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>> ListByHomeRegionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets a specific external Security Solution. - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// Name of an external security solution. - /// - /// - /// 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 externalSecuritySolutionsName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets a list of external security solutions for the subscription. - /// - /// - /// 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)); - /// - /// Gets a list of external Security Solutions for the subscription and - /// location. - /// - /// - /// 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>> ListByHomeRegionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IInformationProtectionPoliciesOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IInformationProtectionPoliciesOperations.cs deleted file mode 100644 index 96cca84bafc9..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IInformationProtectionPoliciesOperations.cs +++ /dev/null @@ -1,135 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// InformationProtectionPoliciesOperations operations. - /// - public partial interface IInformationProtectionPoliciesOperations - { - /// - /// Details of the information protection policy. - /// - /// - /// Scope of the query, can be subscription - /// (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management - /// group (/providers/Microsoft.Management/managementGroups/mgName). - /// - /// - /// Name of the information protection policy. Possible values include: - /// 'effective', 'custom' - /// - /// - /// 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 scope, string informationProtectionPolicyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Details of the information protection policy. - /// - /// - /// Scope of the query, can be subscription - /// (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management - /// group (/providers/Microsoft.Management/managementGroups/mgName). - /// - /// - /// Name of the information protection policy. Possible values include: - /// 'effective', 'custom' - /// - /// - /// Dictionary of sensitivity labels. - /// - /// - /// The sensitivity information types. - /// - /// - /// 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 scope, string informationProtectionPolicyName, IDictionary labels = default(IDictionary), IDictionary informationTypes = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Information protection policies of a specific management group. - /// - /// - /// Scope of the query, can be subscription - /// (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management - /// group (/providers/Microsoft.Management/managementGroups/mgName). - /// - /// - /// 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 scope, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Information protection policies of a specific management group. - /// - /// - /// 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IIngestionSettingsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IIngestionSettingsOperations.cs deleted file mode 100644 index 04f385265d58..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IIngestionSettingsOperations.cs +++ /dev/null @@ -1,183 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// IngestionSettingsOperations operations. - /// - public partial interface IIngestionSettingsOperations - { - /// - /// Settings for ingesting security data and logs to correlate with - /// resources associated with the subscription. - /// - /// - /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Settings for ingesting security data and logs to correlate with - /// resources associated with the subscription. - /// - /// - /// Name of the ingestion setting - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string ingestionSettingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Create setting for ingesting security data and logs to correlate - /// with resources associated with the subscription. - /// - /// - /// Name of the ingestion setting - /// - /// - /// Ingestion setting data - /// - /// - /// 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 ingestionSettingName, object properties = default(object), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes the ingestion settings for this subscription. - /// - /// - /// Name of the ingestion setting - /// - /// - /// 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 ingestionSettingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Returns the token that is used for correlating ingested telemetry - /// with the resources in the subscription. - /// - /// - /// Name of the ingestion setting - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> ListTokensWithHttpMessagesAsync(string ingestionSettingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Connection strings for ingesting security scan logs and data. - /// - /// - /// Name of the ingestion setting - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> ListConnectionStringsWithHttpMessagesAsync(string ingestionSettingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Settings for ingesting security data and logs to correlate with - /// resources associated with the subscription. - /// - /// - /// 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IIotSecuritySolutionAnalyticsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IIotSecuritySolutionAnalyticsOperations.cs deleted file mode 100644 index 77bf28bc2fd7..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IIotSecuritySolutionAnalyticsOperations.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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// IotSecuritySolutionAnalyticsOperations operations. - /// - public partial interface IIotSecuritySolutionAnalyticsOperations - { - /// - /// Use this method to get IoT security Analytics metrics in an array. - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// The name of the IoT Security solution. - /// - /// - /// 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 solutionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Use this method to get IoT Security Analytics metrics. - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// The name of the IoT Security solution. - /// - /// - /// 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 solutionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IIotSecuritySolutionOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IIotSecuritySolutionOperations.cs deleted file mode 100644 index bed20a0e02df..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IIotSecuritySolutionOperations.cs +++ /dev/null @@ -1,235 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// IotSecuritySolutionOperations operations. - /// - public partial interface IIotSecuritySolutionOperations - { - /// - /// Use this method to get the list of IoT Security solutions by - /// subscription. - /// - /// - /// Filter the IoT Security solution with OData syntax. Supports - /// filtering by iotHubs. - /// - /// - /// 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>> ListBySubscriptionWithHttpMessagesAsync(string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Use this method to get the list IoT Security solutions organized by - /// resource group. - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// Filter the IoT Security solution with OData syntax. Supports - /// filtering by iotHubs. - /// - /// - /// 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// User this method to get details of a specific IoT Security solution - /// based on solution name - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// The name of the IoT Security solution. - /// - /// - /// 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 solutionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Use this method to create or update yours IoT Security solution - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// The name of the IoT Security solution. - /// - /// - /// The security solution data - /// - /// - /// 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 solutionName, IoTSecuritySolutionModel iotSecuritySolutionData, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Use this method to update existing IoT Security solution tags or - /// user defined resources. To update other fields use the - /// CreateOrUpdate method. - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// The name of the IoT Security solution. - /// - /// - /// The security solution data - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string solutionName, UpdateIotSecuritySolutionData updateIotSecuritySolutionData, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Use this method to delete yours IoT Security solution - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// The name of the IoT Security solution. - /// - /// - /// 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 solutionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Use this method to get the list of IoT Security solutions by - /// subscription. - /// - /// - /// 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>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Use this method to get the list IoT Security solutions organized by - /// resource group. - /// - /// - /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IIotSecuritySolutionsAnalyticsAggregatedAlertOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IIotSecuritySolutionsAnalyticsAggregatedAlertOperations.cs deleted file mode 100644 index 00fba045b9ba..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IIotSecuritySolutionsAnalyticsAggregatedAlertOperations.cs +++ /dev/null @@ -1,137 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// IotSecuritySolutionsAnalyticsAggregatedAlertOperations operations. - /// - public partial interface IIotSecuritySolutionsAnalyticsAggregatedAlertOperations - { - /// - /// Use this method to get the aggregated alert list of yours IoT - /// Security solution. - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// The name of the IoT Security solution. - /// - /// - /// Number of results to retrieve. - /// - /// - /// 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 solutionName, int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Use this method to get a single the aggregated alert of yours IoT - /// Security solution. This aggregation is performed by alert name. - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// The name of the IoT Security solution. - /// - /// - /// Identifier of the aggregated alert. - /// - /// - /// 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 solutionName, string aggregatedAlertName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Use this method to dismiss an aggregated IoT Security Solution - /// Alert. - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// The name of the IoT Security solution. - /// - /// - /// Identifier of the aggregated alert. - /// - /// - /// 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 DismissWithHttpMessagesAsync(string resourceGroupName, string solutionName, string aggregatedAlertName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Use this method to get the aggregated alert list of yours IoT - /// Security solution. - /// - /// - /// 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IIotSecuritySolutionsAnalyticsRecommendationOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IIotSecuritySolutionsAnalyticsRecommendationOperations.cs deleted file mode 100644 index ef803c0beac5..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IIotSecuritySolutionsAnalyticsRecommendationOperations.cs +++ /dev/null @@ -1,111 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// IotSecuritySolutionsAnalyticsRecommendationOperations operations. - /// - public partial interface IIotSecuritySolutionsAnalyticsRecommendationOperations - { - /// - /// Use this method to get the aggregated security analytics - /// recommendation of yours IoT Security solution. This aggregation is - /// performed by recommendation name. - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// The name of the IoT Security solution. - /// - /// - /// Name of the recommendation aggregated for this query. - /// - /// - /// 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 solutionName, string aggregatedRecommendationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Use this method to get the list of aggregated security analytics - /// recommendations of yours IoT Security solution. - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// The name of the IoT Security solution. - /// - /// - /// Number of results to retrieve. - /// - /// - /// 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 solutionName, int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Use this method to get the list of aggregated security analytics - /// recommendations of yours IoT Security solution. - /// - /// - /// 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IJitNetworkAccessPoliciesOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IJitNetworkAccessPoliciesOperations.cs deleted file mode 100644 index 189cf30a96de..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IJitNetworkAccessPoliciesOperations.cs +++ /dev/null @@ -1,319 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// JitNetworkAccessPoliciesOperations operations. - /// - public partial interface IJitNetworkAccessPoliciesOperations - { - /// - /// Policies for protecting resources using Just-in-Time access - /// control. - /// - /// - /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Policies for protecting resources using Just-in-Time access control - /// for the subscription, location - /// - /// - /// 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>> ListByRegionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Policies for protecting resources using Just-in-Time access control - /// for the subscription, location - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Policies for protecting resources using Just-in-Time access control - /// for the subscription, location - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// 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>> ListByResourceGroupAndRegionWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Policies for protecting resources using Just-in-Time access control - /// for the subscription, location - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// Name of a Just-in-Time access configuration policy. - /// - /// - /// 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 jitNetworkAccessPolicyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Create a policy for protecting resources using Just-in-Time access - /// control - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// Name of a Just-in-Time access configuration policy. - /// - /// - /// - /// - /// 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 jitNetworkAccessPolicyName, JitNetworkAccessPolicy body, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Delete a Just-in-Time access control policy. - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// Name of a Just-in-Time access configuration policy. - /// - /// - /// 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 jitNetworkAccessPolicyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Initiate a JIT access from a specific Just-in-Time policy - /// configuration. - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// Name of a Just-in-Time access configuration policy. - /// - /// - /// A list of virtual machines & ports to open access for - /// - /// - /// The justification for making the initiate request - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> InitiateWithHttpMessagesAsync(string resourceGroupName, string jitNetworkAccessPolicyName, IList virtualMachines, string justification = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Policies for protecting resources using Just-in-Time access - /// control. - /// - /// - /// 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)); - /// - /// Policies for protecting resources using Just-in-Time access control - /// for the subscription, location - /// - /// - /// 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>> ListByRegionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Policies for protecting resources using Just-in-Time access control - /// for the subscription, location - /// - /// - /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Policies for protecting resources using Just-in-Time access control - /// for the subscription, location - /// - /// - /// 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>> ListByResourceGroupAndRegionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ILocationsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ILocationsOperations.cs deleted file mode 100644 index f8aa5ec2d81e..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ILocationsOperations.cs +++ /dev/null @@ -1,93 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// LocationsOperations operations. - /// - public partial interface ILocationsOperations - { - /// - /// The location of the responsible ASC of the specific subscription - /// (home region). For each subscription there is only one responsible - /// location. The location in the response should be used to read or - /// write other resources in ASC according to their 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>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Details of a specific location - /// - /// - /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// The location of the responsible ASC of the specific subscription - /// (home region). For each subscription there is only one responsible - /// location. The location in the response should be used to read or - /// write other resources in ASC according to their ID. - /// - /// - /// 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IOperations.cs deleted file mode 100644 index dff12f4f27ac..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IOperations.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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Operations operations. - /// - public partial interface IOperations - { - /// - /// Exposes all available operations for discovery purposes. - /// - /// - /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Exposes all available operations for discovery purposes. - /// - /// - /// 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IPricingsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IPricingsOperations.cs index a243ffff64a8..9197985da499 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IPricingsOperations.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IPricingsOperations.cs @@ -79,6 +79,11 @@ public partial interface IPricingsOperations /// capabilities, while the free tier offers basic security features. /// Possible values include: 'Free', 'Standard' /// + /// + /// The sub-plan selected for a Standard pricing configuration, when + /// more than one sub-plan is available. Each sub-plan enables a set of + /// security features. When not specified, full plan is applied. + /// /// /// The headers that will be added to request. /// @@ -94,6 +99,6 @@ public partial interface IPricingsOperations /// /// Thrown when a required parameter is null /// - Task> UpdateWithHttpMessagesAsync(string pricingName, string pricingTier, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string pricingName, string pricingTier, string subPlan = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IRegulatoryComplianceAssessmentsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IRegulatoryComplianceAssessmentsOperations.cs deleted file mode 100644 index 255632c381ca..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IRegulatoryComplianceAssessmentsOperations.cs +++ /dev/null @@ -1,108 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// RegulatoryComplianceAssessmentsOperations operations. - /// - public partial interface IRegulatoryComplianceAssessmentsOperations - { - /// - /// Details and state of assessments mapped to selected regulatory - /// compliance control - /// - /// - /// Name of the regulatory compliance standard object - /// - /// - /// Name of the regulatory compliance control object - /// - /// - /// OData filter. 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 regulatoryComplianceStandardName, string regulatoryComplianceControlName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Supported regulatory compliance details and state for selected - /// assessment - /// - /// - /// Name of the regulatory compliance standard object - /// - /// - /// Name of the regulatory compliance control object - /// - /// - /// Name of the regulatory compliance assessment object - /// - /// - /// 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 regulatoryComplianceStandardName, string regulatoryComplianceControlName, string regulatoryComplianceAssessmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Details and state of assessments mapped to selected regulatory - /// compliance control - /// - /// - /// 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IRegulatoryComplianceControlsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IRegulatoryComplianceControlsOperations.cs deleted file mode 100644 index e9d53899aae0..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IRegulatoryComplianceControlsOperations.cs +++ /dev/null @@ -1,101 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// RegulatoryComplianceControlsOperations operations. - /// - public partial interface IRegulatoryComplianceControlsOperations - { - /// - /// All supported regulatory compliance controls details and state for - /// selected standard - /// - /// - /// Name of the regulatory compliance standard object - /// - /// - /// OData filter. 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 regulatoryComplianceStandardName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Selected regulatory compliance control details and state - /// - /// - /// Name of the regulatory compliance standard object - /// - /// - /// Name of the regulatory compliance control object - /// - /// - /// 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 regulatoryComplianceStandardName, string regulatoryComplianceControlName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// All supported regulatory compliance controls details and state for - /// selected standard - /// - /// - /// 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IRegulatoryComplianceStandardsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IRegulatoryComplianceStandardsOperations.cs deleted file mode 100644 index b2d4e1e56d27..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IRegulatoryComplianceStandardsOperations.cs +++ /dev/null @@ -1,93 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// RegulatoryComplianceStandardsOperations operations. - /// - public partial interface IRegulatoryComplianceStandardsOperations - { - /// - /// Supported regulatory compliance standards details and state - /// - /// - /// OData filter. 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 filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Supported regulatory compliance details state for selected standard - /// - /// - /// Name of the regulatory compliance standard object - /// - /// - /// 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 regulatoryComplianceStandardName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Supported regulatory compliance standards details and state - /// - /// - /// 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISecureScoreControlDefinitionsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISecureScoreControlDefinitionsOperations.cs deleted file mode 100644 index 1d91735fd1e9..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISecureScoreControlDefinitionsOperations.cs +++ /dev/null @@ -1,113 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// SecureScoreControlDefinitionsOperations operations. - /// - public partial interface ISecureScoreControlDefinitionsOperations - { - /// - /// List the available security controls, their assessments, and the - /// max score - /// - /// - /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// For a specified subscription, list the available security controls, - /// their assessments, and the max score - /// - /// - /// 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>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// List the available security controls, their assessments, and the - /// max score - /// - /// - /// 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)); - /// - /// For a specified subscription, list the available security controls, - /// their assessments, and the max score - /// - /// - /// 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>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISecureScoreControlsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISecureScoreControlsOperations.cs deleted file mode 100644 index 48f818ae653f..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISecureScoreControlsOperations.cs +++ /dev/null @@ -1,119 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// SecureScoreControlsOperations operations. - /// - public partial interface ISecureScoreControlsOperations - { - /// - /// Get all security controls for a specific initiative within a scope - /// - /// - /// The initiative name. For the ASC Default initiative, use 'ascScore' - /// as in the sample request below. - /// - /// - /// OData expand. Optional. Possible values include: 'definition' - /// - /// - /// 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>> ListBySecureScoreWithHttpMessagesAsync(string secureScoreName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get all security controls within a scope - /// - /// - /// OData expand. Optional. Possible values include: 'definition' - /// - /// - /// 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 expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get all security controls for a specific initiative within a scope - /// - /// - /// 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>> ListBySecureScoreNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get all security controls within a scope - /// - /// - /// 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISecureScoresOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISecureScoresOperations.cs deleted file mode 100644 index 4602b8234f48..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISecureScoresOperations.cs +++ /dev/null @@ -1,94 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// SecureScoresOperations operations. - /// - public partial interface ISecureScoresOperations - { - /// - /// List secure scores for all your Security Center initiatives within - /// your current scope. - /// - /// - /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get secure score for a specific Security Center initiative within - /// your current scope. For the ASC Default initiative, use 'ascScore'. - /// - /// - /// The initiative name. For the ASC Default initiative, use 'ascScore' - /// as in the sample request below. - /// - /// - /// 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 secureScoreName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// List secure scores for all your Security Center initiatives within - /// your current scope. - /// - /// - /// 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISecurityCenterClient.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISecurityCenterClient.cs index 67c8d9b90101..5123145fd7fd 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISecurityCenterClient.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISecurityCenterClient.cs @@ -47,10 +47,9 @@ public partial interface ISecurityCenterClient : System.IDisposable string SubscriptionId { get; set; } /// - /// The location where ASC stores the data of the subscription. can be - /// retrieved from Get locations + /// API version for the operation /// - string AscLocation { get; set; } + string ApiVersion { get; } /// /// The preferred language for the response. @@ -71,230 +70,10 @@ public partial interface ISecurityCenterClient : System.IDisposable bool? GenerateClientRequestId { get; set; } - /// - /// Gets the IComplianceResultsOperations. - /// - IComplianceResultsOperations ComplianceResults { get; } - /// /// Gets the IPricingsOperations. /// IPricingsOperations Pricings { get; } - /// - /// Gets the IAdvancedThreatProtectionOperations. - /// - IAdvancedThreatProtectionOperations AdvancedThreatProtection { get; } - - /// - /// Gets the IDeviceSecurityGroupsOperations. - /// - IDeviceSecurityGroupsOperations DeviceSecurityGroups { get; } - - /// - /// Gets the IIotSecuritySolutionOperations. - /// - IIotSecuritySolutionOperations IotSecuritySolution { get; } - - /// - /// Gets the IIotSecuritySolutionAnalyticsOperations. - /// - IIotSecuritySolutionAnalyticsOperations IotSecuritySolutionAnalytics { get; } - - /// - /// Gets the IIotSecuritySolutionsAnalyticsAggregatedAlertOperations. - /// - IIotSecuritySolutionsAnalyticsAggregatedAlertOperations IotSecuritySolutionsAnalyticsAggregatedAlert { get; } - - /// - /// Gets the IIotSecuritySolutionsAnalyticsRecommendationOperations. - /// - IIotSecuritySolutionsAnalyticsRecommendationOperations IotSecuritySolutionsAnalyticsRecommendation { get; } - - /// - /// Gets the ILocationsOperations. - /// - ILocationsOperations Locations { get; } - - /// - /// Gets the IOperations. - /// - IOperations Operations { get; } - - /// - /// Gets the ITasksOperations. - /// - ITasksOperations Tasks { get; } - - /// - /// Gets the IAutoProvisioningSettingsOperations. - /// - IAutoProvisioningSettingsOperations AutoProvisioningSettings { get; } - - /// - /// Gets the ICompliancesOperations. - /// - ICompliancesOperations Compliances { get; } - - /// - /// Gets the IInformationProtectionPoliciesOperations. - /// - IInformationProtectionPoliciesOperations InformationProtectionPolicies { get; } - - /// - /// Gets the ISecurityContactsOperations. - /// - ISecurityContactsOperations SecurityContacts { get; } - - /// - /// Gets the IWorkspaceSettingsOperations. - /// - IWorkspaceSettingsOperations WorkspaceSettings { get; } - - /// - /// Gets the IRegulatoryComplianceStandardsOperations. - /// - IRegulatoryComplianceStandardsOperations RegulatoryComplianceStandards { get; } - - /// - /// Gets the IRegulatoryComplianceControlsOperations. - /// - IRegulatoryComplianceControlsOperations RegulatoryComplianceControls { get; } - - /// - /// Gets the IRegulatoryComplianceAssessmentsOperations. - /// - IRegulatoryComplianceAssessmentsOperations RegulatoryComplianceAssessments { get; } - - /// - /// Gets the ISubAssessmentsOperations. - /// - ISubAssessmentsOperations SubAssessments { get; } - - /// - /// Gets the IAutomationsOperations. - /// - IAutomationsOperations Automations { get; } - - /// - /// Gets the IAlertsSuppressionRulesOperations. - /// - IAlertsSuppressionRulesOperations AlertsSuppressionRules { get; } - - /// - /// Gets the IServerVulnerabilityAssessmentOperations. - /// - IServerVulnerabilityAssessmentOperations ServerVulnerabilityAssessment { get; } - - /// - /// Gets the IAssessmentsMetadataOperations. - /// - IAssessmentsMetadataOperations AssessmentsMetadata { get; } - - /// - /// Gets the IAssessmentsOperations. - /// - IAssessmentsOperations Assessments { get; } - - /// - /// Gets the IAdaptiveApplicationControlsOperations. - /// - IAdaptiveApplicationControlsOperations AdaptiveApplicationControls { get; } - - /// - /// Gets the IAdaptiveNetworkHardeningsOperations. - /// - IAdaptiveNetworkHardeningsOperations AdaptiveNetworkHardenings { get; } - - /// - /// Gets the IAllowedConnectionsOperations. - /// - IAllowedConnectionsOperations AllowedConnections { get; } - - /// - /// Gets the ITopologyOperations. - /// - ITopologyOperations Topology { get; } - - /// - /// Gets the IJitNetworkAccessPoliciesOperations. - /// - IJitNetworkAccessPoliciesOperations JitNetworkAccessPolicies { get; } - - /// - /// Gets the IDiscoveredSecuritySolutionsOperations. - /// - IDiscoveredSecuritySolutionsOperations DiscoveredSecuritySolutions { get; } - - /// - /// Gets the ISecuritySolutionsReferenceDataOperations. - /// - ISecuritySolutionsReferenceDataOperations SecuritySolutionsReferenceData { get; } - - /// - /// Gets the IExternalSecuritySolutionsOperations. - /// - IExternalSecuritySolutionsOperations ExternalSecuritySolutions { get; } - - /// - /// Gets the ISecureScoresOperations. - /// - ISecureScoresOperations SecureScores { get; } - - /// - /// Gets the ISecureScoreControlsOperations. - /// - ISecureScoreControlsOperations SecureScoreControls { get; } - - /// - /// Gets the ISecureScoreControlDefinitionsOperations. - /// - ISecureScoreControlDefinitionsOperations SecureScoreControlDefinitions { get; } - - /// - /// Gets the ISecuritySolutionsOperations. - /// - ISecuritySolutionsOperations SecuritySolutions { get; } - - /// - /// Gets the IConnectorsOperations. - /// - IConnectorsOperations Connectors { get; } - - /// - /// Gets the ISqlVulnerabilityAssessmentScansOperations. - /// - ISqlVulnerabilityAssessmentScansOperations SqlVulnerabilityAssessmentScans { get; } - - /// - /// Gets the ISqlVulnerabilityAssessmentScanResultsOperations. - /// - ISqlVulnerabilityAssessmentScanResultsOperations SqlVulnerabilityAssessmentScanResults { get; } - - /// - /// Gets the ISqlVulnerabilityAssessmentBaselineRulesOperations. - /// - ISqlVulnerabilityAssessmentBaselineRulesOperations SqlVulnerabilityAssessmentBaselineRules { get; } - - /// - /// Gets the IAlertsOperations. - /// - IAlertsOperations Alerts { get; } - - /// - /// Gets the ISettingsOperations. - /// - ISettingsOperations Settings { get; } - - /// - /// Gets the IIngestionSettingsOperations. - /// - IIngestionSettingsOperations IngestionSettings { get; } - - /// - /// Gets the ISoftwareInventoriesOperations. - /// - ISoftwareInventoriesOperations SoftwareInventories { get; } - } } diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISecurityContactsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISecurityContactsOperations.cs deleted file mode 100644 index 426343a00e3e..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISecurityContactsOperations.cs +++ /dev/null @@ -1,159 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// SecurityContactsOperations operations. - /// - public partial interface ISecurityContactsOperations - { - /// - /// Security contact configurations for the subscription - /// - /// - /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Security contact configurations for the subscription - /// - /// - /// Name of the security contact object - /// - /// - /// 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 securityContactName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Security contact configurations for the subscription - /// - /// - /// Name of the security contact object - /// - /// - /// Security contact object - /// - /// - /// 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 securityContactName, SecurityContact securityContact, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Security contact configurations for the subscription - /// - /// - /// Name of the security contact object - /// - /// - /// 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 securityContactName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Security contact configurations for the subscription - /// - /// - /// Name of the security contact object - /// - /// - /// Security contact object - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> UpdateWithHttpMessagesAsync(string securityContactName, SecurityContact securityContact, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Security contact configurations for the subscription - /// - /// - /// 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISecuritySolutionsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISecuritySolutionsOperations.cs deleted file mode 100644 index e59e818e3dc7..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISecuritySolutionsOperations.cs +++ /dev/null @@ -1,94 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// SecuritySolutionsOperations operations. - /// - public partial interface ISecuritySolutionsOperations - { - /// - /// Gets a list of Security Solutions for the subscription. - /// - /// - /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets a specific Security Solution. - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// Name of security solution. - /// - /// - /// 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 securitySolutionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets a list of Security Solutions for the subscription. - /// - /// - /// 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISecuritySolutionsReferenceDataOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISecuritySolutionsReferenceDataOperations.cs deleted file mode 100644 index 0d8b4e9c13ef..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISecuritySolutionsReferenceDataOperations.cs +++ /dev/null @@ -1,67 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// SecuritySolutionsReferenceDataOperations operations. - /// - public partial interface ISecuritySolutionsReferenceDataOperations - { - /// - /// Gets a list of all supported Security Solutions for the - /// subscription. - /// - /// - /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets list of all supported Security Solutions for subscription and - /// location. - /// - /// - /// 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> ListByHomeRegionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IServerVulnerabilityAssessmentOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IServerVulnerabilityAssessmentOperations.cs deleted file mode 100644 index 10e0d65f0c6c..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IServerVulnerabilityAssessmentOperations.cs +++ /dev/null @@ -1,184 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// ServerVulnerabilityAssessmentOperations operations. - /// - public partial interface IServerVulnerabilityAssessmentOperations - { - /// - /// Gets a list of server vulnerability assessment onboarding statuses - /// on a given resource. - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// The Namespace of the resource. - /// - /// - /// The type of the resource. - /// - /// - /// Name of the resource. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> ListByExtendedResourceWithHttpMessagesAsync(string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets a server vulnerability assessment onboarding statuses on a - /// given resource. - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// The Namespace of the resource. - /// - /// - /// The type of the resource. - /// - /// - /// Name of the resource. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Creating a server vulnerability assessment on a resource, which - /// will onboard a resource for having a vulnerability assessment on it - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// The Namespace of the resource. - /// - /// - /// The type of the resource. - /// - /// - /// Name of the resource. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Removing server vulnerability assessment from a resource. - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// The Namespace of the resource. - /// - /// - /// The type of the resource. - /// - /// - /// Name of the resource. - /// - /// - /// 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 resourceNamespace, string resourceType, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Removing server vulnerability assessment from a resource. - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// The Namespace of the resource. - /// - /// - /// The type of the resource. - /// - /// - /// Name of the resource. - /// - /// - /// 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 BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISettingsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISettingsOperations.cs deleted file mode 100644 index 54a44999707e..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISettingsOperations.cs +++ /dev/null @@ -1,117 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// SettingsOperations operations. - /// - public partial interface ISettingsOperations - { - /// - /// Settings about different configurations in security center - /// - /// - /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Settings of different configurations in security center - /// - /// - /// The name of the setting. Possible values include: 'MCAS', 'WDATP', - /// 'WDATP_EXCLUDE_LINUX_PUBLIC_PREVIEW', 'Sentinel' - /// - /// - /// 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 settingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// updating settings about different configurations in security center - /// - /// - /// The name of the setting. Possible values include: 'MCAS', 'WDATP', - /// 'WDATP_EXCLUDE_LINUX_PUBLIC_PREVIEW', 'Sentinel' - /// - /// - /// Setting object - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> UpdateWithHttpMessagesAsync(string settingName, Setting setting, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Settings about different configurations in security center - /// - /// - /// 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISoftwareInventoriesOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISoftwareInventoriesOperations.cs deleted file mode 100644 index fa4696b563ca..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISoftwareInventoriesOperations.cs +++ /dev/null @@ -1,159 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// SoftwareInventoriesOperations operations. - /// - public partial interface ISoftwareInventoriesOperations - { - /// - /// Gets the software inventory of the virtual machine. - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// The namespace of the resource. - /// - /// - /// The type of the resource. - /// - /// - /// Name of the resource. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListByExtendedResourceWithHttpMessagesAsync(string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets the software inventory of all virtual machines in the - /// subscriptions. - /// - /// - /// 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>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets a single software data of the virtual machine. - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// The namespace of the resource. - /// - /// - /// The type of the resource. - /// - /// - /// Name of the resource. - /// - /// - /// Name of the installed software. - /// - /// - /// 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 resourceNamespace, string resourceType, string resourceName, string softwareName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets the software inventory of the virtual machine. - /// - /// - /// 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>> ListByExtendedResourceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets the software inventory of all virtual machines in the - /// subscriptions. - /// - /// - /// 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>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISqlVulnerabilityAssessmentBaselineRulesOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISqlVulnerabilityAssessmentBaselineRulesOperations.cs deleted file mode 100644 index f0ee5c0b7086..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISqlVulnerabilityAssessmentBaselineRulesOperations.cs +++ /dev/null @@ -1,189 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// SqlVulnerabilityAssessmentBaselineRulesOperations operations. - /// - public partial interface ISqlVulnerabilityAssessmentBaselineRulesOperations - { - /// - /// Creates a Baseline for a rule in a database. Will overwrite any - /// previously existing results. - /// - /// - /// The rule Id. - /// - /// - /// The workspace Id. - /// - /// - /// The api version. - /// - /// - /// The identifier of the resource. - /// - /// - /// Take results from latest scan. - /// - /// - /// Expected results to be inserted into the baseline. - /// Leave this field empty it LatestScan == true. - /// - /// - /// 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 ruleId, string workspaceId, string apiVersion, string resourceId, bool? latestScan = default(bool?), IList> results = default(IList>), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets the results for a given rule in the Baseline. - /// - /// - /// The rule Id. - /// - /// - /// The workspace Id. - /// - /// - /// The api version. - /// - /// - /// The identifier of the resource. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string ruleId, string workspaceId, string apiVersion, string resourceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes a rule from the Baseline of a given database. - /// - /// - /// The rule Id. - /// - /// - /// The workspace Id. - /// - /// - /// The api version. - /// - /// - /// The identifier of the resource. - /// - /// - /// 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 ruleId, string workspaceId, string apiVersion, string resourceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets the results for all rules in the Baseline. - /// - /// - /// The workspace Id. - /// - /// - /// The api version. - /// - /// - /// The identifier of the resource. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> ListWithHttpMessagesAsync(string workspaceId, string apiVersion, string resourceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Add a list of baseline rules. Will overwrite any previously - /// existing results (for all rules). - /// - /// - /// The workspace Id. - /// - /// - /// The api version. - /// - /// - /// The identifier of the resource. - /// - /// - /// Take results from latest scan. - /// - /// - /// Expected results to be inserted into the baseline. - /// Leave this field empty it LatestScan == true. - /// - /// - /// 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> AddWithHttpMessagesAsync(string workspaceId, string apiVersion, string resourceId, bool? latestScan = default(bool?), IDictionary>> results = default(IDictionary>>), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISqlVulnerabilityAssessmentScanResultsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISqlVulnerabilityAssessmentScanResultsOperations.cs deleted file mode 100644 index 57f3455ec59f..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISqlVulnerabilityAssessmentScanResultsOperations.cs +++ /dev/null @@ -1,94 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// SqlVulnerabilityAssessmentScanResultsOperations operations. - /// - public partial interface ISqlVulnerabilityAssessmentScanResultsOperations - { - /// - /// Gets the scan results of a single rule in a scan record. - /// - /// - /// The scan Id. Type 'latest' to get the scan results for the latest - /// scan. - /// - /// - /// The rule Id of the results. - /// - /// - /// The workspace Id. - /// - /// - /// The api version. - /// - /// - /// The identifier of the resource. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string scanId, string scanResultId, string workspaceId, string apiVersion, string resourceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets a list of scan results for a single scan record. - /// - /// - /// The scan Id. Type 'latest' to get the scan results for the latest - /// scan. - /// - /// - /// The workspace Id. - /// - /// - /// The api version. - /// - /// - /// The identifier of the resource. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> ListWithHttpMessagesAsync(string scanId, string workspaceId, string apiVersion, string resourceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISqlVulnerabilityAssessmentScansOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISqlVulnerabilityAssessmentScansOperations.cs deleted file mode 100644 index f8e610d3c62e..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISqlVulnerabilityAssessmentScansOperations.cs +++ /dev/null @@ -1,87 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// SqlVulnerabilityAssessmentScansOperations operations. - /// - public partial interface ISqlVulnerabilityAssessmentScansOperations - { - /// - /// Gets the scan details of a single scan record. - /// - /// - /// The scan Id. Type 'latest' to get the scan record for the latest - /// scan. - /// - /// - /// The workspace Id. - /// - /// - /// The api version. - /// - /// - /// The identifier of the resource. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string scanId, string workspaceId, string apiVersion, string resourceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets a list of scan records. - /// - /// - /// The workspace Id. - /// - /// - /// The api version. - /// - /// - /// The identifier of the resource. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> ListWithHttpMessagesAsync(string workspaceId, string apiVersion, string resourceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISubAssessmentsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISubAssessmentsOperations.cs deleted file mode 100644 index 99b971666525..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISubAssessmentsOperations.cs +++ /dev/null @@ -1,156 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// SubAssessmentsOperations operations. - /// - public partial interface ISubAssessmentsOperations - { - /// - /// Get security sub-assessments on all your scanned resources inside a - /// subscription scope - /// - /// - /// Scope of the query, can be subscription - /// (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management - /// group (/providers/Microsoft.Management/managementGroups/mgName). - /// - /// - /// 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>> ListAllWithHttpMessagesAsync(string scope, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get security sub-assessments on all your scanned resources inside a - /// scope - /// - /// - /// Scope of the query, can be subscription - /// (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management - /// group (/providers/Microsoft.Management/managementGroups/mgName). - /// - /// - /// The Assessment Key - Unique key for the assessment type - /// - /// - /// 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 scope, string assessmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get a security sub-assessment on your scanned resource - /// - /// - /// Scope of the query, can be subscription - /// (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management - /// group (/providers/Microsoft.Management/managementGroups/mgName). - /// - /// - /// The Assessment Key - Unique key for the assessment type - /// - /// - /// The Sub-Assessment Key - Unique key for the sub-assessment type - /// - /// - /// 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 scope, string assessmentName, string subAssessmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get security sub-assessments on all your scanned resources inside a - /// subscription scope - /// - /// - /// 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>> ListAllNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get security sub-assessments on all your scanned resources inside a - /// scope - /// - /// - /// 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ITasksOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ITasksOperations.cs deleted file mode 100644 index ee472989bb53..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ITasksOperations.cs +++ /dev/null @@ -1,271 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// TasksOperations operations. - /// - public partial interface ITasksOperations - { - /// - /// Recommended tasks that will help improve the security of the - /// subscription proactively - /// - /// - /// OData filter. 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 filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Recommended tasks that will help improve the security of the - /// subscription proactively - /// - /// - /// OData filter. 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>> ListByHomeRegionWithHttpMessagesAsync(string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Recommended tasks that will help improve the security of the - /// subscription proactively - /// - /// - /// Name of the task object, will be a GUID - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetSubscriptionLevelTaskWithHttpMessagesAsync(string taskName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Recommended tasks that will help improve the security of the - /// subscription proactively - /// - /// - /// Name of the task object, will be a GUID - /// - /// - /// Type of the action to do on the task. Possible values include: - /// 'Activate', 'Dismiss', 'Start', 'Resolve', 'Close' - /// - /// - /// 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 UpdateSubscriptionLevelTaskStateWithHttpMessagesAsync(string taskName, string taskUpdateActionType, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Recommended tasks that will help improve the security of the - /// subscription proactively - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// OData filter. 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Recommended tasks that will help improve the security of the - /// subscription proactively - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// Name of the task object, will be a GUID - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetResourceGroupLevelTaskWithHttpMessagesAsync(string resourceGroupName, string taskName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Recommended tasks that will help improve the security of the - /// subscription proactively - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// Name of the task object, will be a GUID - /// - /// - /// Type of the action to do on the task. Possible values include: - /// 'Activate', 'Dismiss', 'Start', 'Resolve', 'Close' - /// - /// - /// 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 UpdateResourceGroupLevelTaskStateWithHttpMessagesAsync(string resourceGroupName, string taskName, string taskUpdateActionType, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Recommended tasks that will help improve the security of the - /// subscription proactively - /// - /// - /// 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)); - /// - /// Recommended tasks that will help improve the security of the - /// subscription proactively - /// - /// - /// 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>> ListByHomeRegionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Recommended tasks that will help improve the security of the - /// subscription proactively - /// - /// - /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ITopologyOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ITopologyOperations.cs deleted file mode 100644 index 064b65cd1f7e..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ITopologyOperations.cs +++ /dev/null @@ -1,137 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// TopologyOperations operations. - /// - public partial interface ITopologyOperations - { - /// - /// Gets a list that allows to build a topology view of a subscription. - /// - /// - /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets a list that allows to build a topology view of a subscription - /// and location. - /// - /// - /// 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>> ListByHomeRegionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets a specific topology component. - /// - /// - /// The name of the resource group within the user's subscription. The - /// name is case insensitive. - /// - /// - /// Name of a topology resources collection. - /// - /// - /// 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 topologyResourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets a list that allows to build a topology view of a subscription. - /// - /// - /// 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)); - /// - /// Gets a list that allows to build a topology view of a subscription - /// and location. - /// - /// - /// 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>> ListByHomeRegionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IWorkspaceSettingsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IWorkspaceSettingsOperations.cs deleted file mode 100644 index 709ebd03dce2..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IWorkspaceSettingsOperations.cs +++ /dev/null @@ -1,177 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// WorkspaceSettingsOperations operations. - /// - public partial interface IWorkspaceSettingsOperations - { - /// - /// Settings about where we should store your security data and logs. - /// If the result is empty, it means that no custom-workspace - /// configuration was set - /// - /// - /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Settings about where we should store your security data and logs. - /// If the result is empty, it means that no custom-workspace - /// configuration was set - /// - /// - /// Name of the security setting - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string workspaceSettingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// creating settings about where we should store your security data - /// and logs - /// - /// - /// Name of the security setting - /// - /// - /// The full Azure ID of the workspace to save the data in - /// - /// - /// All the VMs in this scope will send their security data to the - /// mentioned workspace unless overridden by a setting with more - /// specific scope - /// - /// - /// 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 workspaceSettingName, string workspaceId, string scope, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Settings about where we should store your security data and logs - /// - /// - /// Name of the security setting - /// - /// - /// The full Azure ID of the workspace to save the data in - /// - /// - /// All the VMs in this scope will send their security data to the - /// mentioned workspace unless overridden by a setting with more - /// specific scope - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> UpdateWithHttpMessagesAsync(string workspaceSettingName, string workspaceId, string scope, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes the custom workspace settings for this subscription. new - /// VMs will report to the default workspace - /// - /// - /// Name of the security setting - /// - /// - /// 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 workspaceSettingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Settings about where we should store your security data and logs. - /// If the result is empty, it means that no custom-workspace - /// configuration was set - /// - /// - /// 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/InformationProtectionPoliciesOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/InformationProtectionPoliciesOperations.cs deleted file mode 100644 index b0dd1523134d..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/InformationProtectionPoliciesOperations.cs +++ /dev/null @@ -1,830 +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.Security -{ - 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; - - /// - /// InformationProtectionPoliciesOperations operations. - /// - internal partial class InformationProtectionPoliciesOperations : IServiceOperations, IInformationProtectionPoliciesOperations - { - /// - /// Initializes a new instance of the InformationProtectionPoliciesOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal InformationProtectionPoliciesOperations(SecurityCenterClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SecurityCenterClient - /// - public SecurityCenterClient Client { get; private set; } - - /// - /// Details of the information protection policy. - /// - /// - /// Scope of the query, can be subscription - /// (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - /// (/providers/Microsoft.Management/managementGroups/mgName). - /// - /// - /// Name of the information protection policy. Possible values include: - /// 'effective', 'custom' - /// - /// - /// 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 scope, string informationProtectionPolicyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (scope == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scope"); - } - if (informationProtectionPolicyName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "informationProtectionPolicyName"); - } - string apiVersion = "2017-08-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("scope", scope); - tracingParameters.Add("informationProtectionPolicyName", informationProtectionPolicyName); - 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("/") ? "" : "/")), "{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName}").ToString(); - _url = _url.Replace("{scope}", scope); - _url = _url.Replace("{informationProtectionPolicyName}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(informationProtectionPolicyName, Client.SerializationSettings).Trim('"'))); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Details of the information protection policy. - /// - /// - /// Scope of the query, can be subscription - /// (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - /// (/providers/Microsoft.Management/managementGroups/mgName). - /// - /// - /// Name of the information protection policy. Possible values include: - /// 'effective', 'custom' - /// - /// - /// Dictionary of sensitivity labels. - /// - /// - /// The sensitivity information types. - /// - /// - /// 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 scope, string informationProtectionPolicyName, IDictionary labels = default(IDictionary), IDictionary informationTypes = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (scope == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scope"); - } - if (informationProtectionPolicyName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "informationProtectionPolicyName"); - } - string apiVersion = "2017-08-01-preview"; - InformationProtectionPolicy informationProtectionPolicy = new InformationProtectionPolicy(); - if (labels != null || informationTypes != null) - { - informationProtectionPolicy.Labels = labels; - informationProtectionPolicy.InformationTypes = informationTypes; - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("scope", scope); - tracingParameters.Add("informationProtectionPolicyName", informationProtectionPolicyName); - tracingParameters.Add("informationProtectionPolicy", informationProtectionPolicy); - 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("/") ? "" : "/")), "{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName}").ToString(); - _url = _url.Replace("{scope}", scope); - _url = _url.Replace("{informationProtectionPolicyName}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(informationProtectionPolicyName, Client.SerializationSettings).Trim('"'))); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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(informationProtectionPolicy != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(informationProtectionPolicy, 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; - } - - /// - /// Information protection policies of a specific management group. - /// - /// - /// Scope of the query, can be subscription - /// (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - /// (/providers/Microsoft.Management/managementGroups/mgName). - /// - /// - /// 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 scope, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (scope == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scope"); - } - string apiVersion = "2017-08-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("scope", scope); - 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("/") ? "" : "/")), "{scope}/providers/Microsoft.Security/informationProtectionPolicies").ToString(); - _url = _url.Replace("{scope}", scope); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Information protection policies of a specific management group. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/InformationProtectionPoliciesOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/InformationProtectionPoliciesOperationsExtensions.cs deleted file mode 100644 index ce2a37d655f9..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/InformationProtectionPoliciesOperationsExtensions.cs +++ /dev/null @@ -1,203 +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.Security -{ - 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 InformationProtectionPoliciesOperations. - /// - public static partial class InformationProtectionPoliciesOperationsExtensions - { - /// - /// Details of the information protection policy. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Scope of the query, can be subscription - /// (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - /// (/providers/Microsoft.Management/managementGroups/mgName). - /// - /// - /// Name of the information protection policy. Possible values include: - /// 'effective', 'custom' - /// - public static InformationProtectionPolicy Get(this IInformationProtectionPoliciesOperations operations, string scope, string informationProtectionPolicyName) - { - return operations.GetAsync(scope, informationProtectionPolicyName).GetAwaiter().GetResult(); - } - - /// - /// Details of the information protection policy. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Scope of the query, can be subscription - /// (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - /// (/providers/Microsoft.Management/managementGroups/mgName). - /// - /// - /// Name of the information protection policy. Possible values include: - /// 'effective', 'custom' - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IInformationProtectionPoliciesOperations operations, string scope, string informationProtectionPolicyName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(scope, informationProtectionPolicyName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Details of the information protection policy. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Scope of the query, can be subscription - /// (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - /// (/providers/Microsoft.Management/managementGroups/mgName). - /// - /// - /// Name of the information protection policy. Possible values include: - /// 'effective', 'custom' - /// - /// - /// Dictionary of sensitivity labels. - /// - /// - /// The sensitivity information types. - /// - public static InformationProtectionPolicy CreateOrUpdate(this IInformationProtectionPoliciesOperations operations, string scope, string informationProtectionPolicyName, IDictionary labels = default(IDictionary), IDictionary informationTypes = default(IDictionary)) - { - return operations.CreateOrUpdateAsync(scope, informationProtectionPolicyName, labels, informationTypes).GetAwaiter().GetResult(); - } - - /// - /// Details of the information protection policy. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Scope of the query, can be subscription - /// (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - /// (/providers/Microsoft.Management/managementGroups/mgName). - /// - /// - /// Name of the information protection policy. Possible values include: - /// 'effective', 'custom' - /// - /// - /// Dictionary of sensitivity labels. - /// - /// - /// The sensitivity information types. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IInformationProtectionPoliciesOperations operations, string scope, string informationProtectionPolicyName, IDictionary labels = default(IDictionary), IDictionary informationTypes = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(scope, informationProtectionPolicyName, labels, informationTypes, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Information protection policies of a specific management group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Scope of the query, can be subscription - /// (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - /// (/providers/Microsoft.Management/managementGroups/mgName). - /// - public static IPage List(this IInformationProtectionPoliciesOperations operations, string scope) - { - return operations.ListAsync(scope).GetAwaiter().GetResult(); - } - - /// - /// Information protection policies of a specific management group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Scope of the query, can be subscription - /// (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - /// (/providers/Microsoft.Management/managementGroups/mgName). - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IInformationProtectionPoliciesOperations operations, string scope, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(scope, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Information protection policies of a specific management group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IInformationProtectionPoliciesOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Information protection policies of a specific management group. - /// - /// - /// 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 IInformationProtectionPoliciesOperations 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IngestionSettingsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IngestionSettingsOperations.cs deleted file mode 100644 index 7da28345d980..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IngestionSettingsOperations.cs +++ /dev/null @@ -1,1369 +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.Security -{ - 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; - - /// - /// IngestionSettingsOperations operations. - /// - internal partial class IngestionSettingsOperations : IServiceOperations, IIngestionSettingsOperations - { - /// - /// Initializes a new instance of the IngestionSettingsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal IngestionSettingsOperations(SecurityCenterClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SecurityCenterClient - /// - public SecurityCenterClient Client { get; private set; } - - /// - /// Settings for ingesting security data and logs to correlate with resources - /// associated with the subscription. - /// - /// - /// 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(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}$"); - } - } - string apiVersion = "2021-01-15-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - 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}/providers/Microsoft.Security/ingestionSettings").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Settings for ingesting security data and logs to correlate with resources - /// associated with the subscription. - /// - /// - /// Name of the ingestion setting - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetWithHttpMessagesAsync(string ingestionSettingName, 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 (ingestionSettingName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ingestionSettingName"); - } - string apiVersion = "2021-01-15-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("ingestionSettingName", ingestionSettingName); - 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}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{ingestionSettingName}", System.Uri.EscapeDataString(ingestionSettingName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Create setting for ingesting security data and logs to correlate with - /// resources associated with the subscription. - /// - /// - /// Name of the ingestion setting - /// - /// - /// Ingestion setting data - /// - /// - /// 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 ingestionSettingName, object properties = default(object), 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 (ingestionSettingName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ingestionSettingName"); - } - string apiVersion = "2021-01-15-preview"; - IngestionSetting ingestionSetting = new IngestionSetting(); - if (properties != null) - { - ingestionSetting.Properties = properties; - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("ingestionSettingName", ingestionSettingName); - tracingParameters.Add("ingestionSetting", ingestionSetting); - 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}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{ingestionSettingName}", System.Uri.EscapeDataString(ingestionSettingName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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(ingestionSetting != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(ingestionSetting, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Deletes the ingestion settings for this subscription. - /// - /// - /// Name of the ingestion setting - /// - /// - /// 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 ingestionSettingName, 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 (ingestionSettingName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ingestionSettingName"); - } - string apiVersion = "2021-01-15-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("ingestionSettingName", ingestionSettingName); - 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}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{ingestionSettingName}", System.Uri.EscapeDataString(ingestionSettingName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Returns the token that is used for correlating ingested telemetry with the - /// resources in the subscription. - /// - /// - /// Name of the ingestion setting - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> ListTokensWithHttpMessagesAsync(string ingestionSettingName, 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 (ingestionSettingName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ingestionSettingName"); - } - string apiVersion = "2021-01-15-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("ingestionSettingName", ingestionSettingName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListTokens", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}/listTokens").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{ingestionSettingName}", System.Uri.EscapeDataString(ingestionSettingName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Connection strings for ingesting security scan logs and data. - /// - /// - /// Name of the ingestion setting - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> ListConnectionStringsWithHttpMessagesAsync(string ingestionSettingName, 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 (ingestionSettingName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ingestionSettingName"); - } - string apiVersion = "2021-01-15-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("ingestionSettingName", ingestionSettingName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListConnectionStrings", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/ingestionSettings/{ingestionSettingName}/listConnectionStrings").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{ingestionSettingName}", System.Uri.EscapeDataString(ingestionSettingName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Settings for ingesting security data and logs to correlate with resources - /// associated with the subscription. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IngestionSettingsOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IngestionSettingsOperationsExtensions.cs deleted file mode 100644 index d83ac2934e02..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IngestionSettingsOperationsExtensions.cs +++ /dev/null @@ -1,270 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for IngestionSettingsOperations. - /// - public static partial class IngestionSettingsOperationsExtensions - { - /// - /// Settings for ingesting security data and logs to correlate with resources - /// associated with the subscription. - /// - /// - /// The operations group for this extension method. - /// - public static IPage List(this IIngestionSettingsOperations operations) - { - return operations.ListAsync().GetAwaiter().GetResult(); - } - - /// - /// Settings for ingesting security data and logs to correlate with resources - /// associated with the subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IIngestionSettingsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Settings for ingesting security data and logs to correlate with resources - /// associated with the subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the ingestion setting - /// - public static IngestionSetting Get(this IIngestionSettingsOperations operations, string ingestionSettingName) - { - return operations.GetAsync(ingestionSettingName).GetAwaiter().GetResult(); - } - - /// - /// Settings for ingesting security data and logs to correlate with resources - /// associated with the subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the ingestion setting - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IIngestionSettingsOperations operations, string ingestionSettingName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(ingestionSettingName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Create setting for ingesting security data and logs to correlate with - /// resources associated with the subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the ingestion setting - /// - /// - /// Ingestion setting data - /// - public static IngestionSetting Create(this IIngestionSettingsOperations operations, string ingestionSettingName, object properties = default(object)) - { - return operations.CreateAsync(ingestionSettingName, properties).GetAwaiter().GetResult(); - } - - /// - /// Create setting for ingesting security data and logs to correlate with - /// resources associated with the subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the ingestion setting - /// - /// - /// Ingestion setting data - /// - /// - /// The cancellation token. - /// - public static async Task CreateAsync(this IIngestionSettingsOperations operations, string ingestionSettingName, object properties = default(object), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateWithHttpMessagesAsync(ingestionSettingName, properties, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Deletes the ingestion settings for this subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the ingestion setting - /// - public static void Delete(this IIngestionSettingsOperations operations, string ingestionSettingName) - { - operations.DeleteAsync(ingestionSettingName).GetAwaiter().GetResult(); - } - - /// - /// Deletes the ingestion settings for this subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the ingestion setting - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IIngestionSettingsOperations operations, string ingestionSettingName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(ingestionSettingName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Returns the token that is used for correlating ingested telemetry with the - /// resources in the subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the ingestion setting - /// - public static IngestionSettingToken ListTokens(this IIngestionSettingsOperations operations, string ingestionSettingName) - { - return operations.ListTokensAsync(ingestionSettingName).GetAwaiter().GetResult(); - } - - /// - /// Returns the token that is used for correlating ingested telemetry with the - /// resources in the subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the ingestion setting - /// - /// - /// The cancellation token. - /// - public static async Task ListTokensAsync(this IIngestionSettingsOperations operations, string ingestionSettingName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListTokensWithHttpMessagesAsync(ingestionSettingName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Connection strings for ingesting security scan logs and data. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the ingestion setting - /// - public static ConnectionStrings ListConnectionStrings(this IIngestionSettingsOperations operations, string ingestionSettingName) - { - return operations.ListConnectionStringsAsync(ingestionSettingName).GetAwaiter().GetResult(); - } - - /// - /// Connection strings for ingesting security scan logs and data. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the ingestion setting - /// - /// - /// The cancellation token. - /// - public static async Task ListConnectionStringsAsync(this IIngestionSettingsOperations operations, string ingestionSettingName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListConnectionStringsWithHttpMessagesAsync(ingestionSettingName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Settings for ingesting security data and logs to correlate with resources - /// associated with the subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IIngestionSettingsOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Settings for ingesting security data and logs to correlate with resources - /// associated with the subscription. - /// - /// - /// 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 IIngestionSettingsOperations 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionAnalyticsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionAnalyticsOperations.cs deleted file mode 100644 index 1df2267ad391..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionAnalyticsOperations.cs +++ /dev/null @@ -1,488 +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.Security -{ - 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; - - /// - /// IotSecuritySolutionAnalyticsOperations operations. - /// - internal partial class IotSecuritySolutionAnalyticsOperations : IServiceOperations, IIotSecuritySolutionAnalyticsOperations - { - /// - /// Initializes a new instance of the IotSecuritySolutionAnalyticsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal IotSecuritySolutionAnalyticsOperations(SecurityCenterClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SecurityCenterClient - /// - public SecurityCenterClient Client { get; private set; } - - /// - /// Use this method to get IoT security Analytics metrics in an array. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The name of the IoT Security solution. - /// - /// - /// 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 solutionName, 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 (solutionName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "solutionName"); - } - string apiVersion = "2019-08-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("solutionName", solutionName); - 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.Security/iotSecuritySolutions/{solutionName}/analyticsModels").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{solutionName}", System.Uri.EscapeDataString(solutionName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Use this method to get IoT Security Analytics metrics. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The name of the IoT Security solution. - /// - /// - /// 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 solutionName, 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 (solutionName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "solutionName"); - } - string apiVersion = "2019-08-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("solutionName", solutionName); - 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.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{solutionName}", System.Uri.EscapeDataString(solutionName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionAnalyticsOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionAnalyticsOperationsExtensions.cs deleted file mode 100644 index 2276e0e10c62..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionAnalyticsOperationsExtensions.cs +++ /dev/null @@ -1,109 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for IotSecuritySolutionAnalyticsOperations. - /// - public static partial class IotSecuritySolutionAnalyticsOperationsExtensions - { - /// - /// Use this method to get IoT security Analytics metrics in an array. - /// - /// - /// 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 IoT Security solution. - /// - public static IoTSecuritySolutionAnalyticsModelList List(this IIotSecuritySolutionAnalyticsOperations operations, string resourceGroupName, string solutionName) - { - return operations.ListAsync(resourceGroupName, solutionName).GetAwaiter().GetResult(); - } - - /// - /// Use this method to get IoT security Analytics metrics in an array. - /// - /// - /// 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 IoT Security solution. - /// - /// - /// The cancellation token. - /// - public static async Task ListAsync(this IIotSecuritySolutionAnalyticsOperations operations, string resourceGroupName, string solutionName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, solutionName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Use this method to get IoT Security Analytics metrics. - /// - /// - /// 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 IoT Security solution. - /// - public static IoTSecuritySolutionAnalyticsModel Get(this IIotSecuritySolutionAnalyticsOperations operations, string resourceGroupName, string solutionName) - { - return operations.GetAsync(resourceGroupName, solutionName).GetAwaiter().GetResult(); - } - - /// - /// Use this method to get IoT Security Analytics metrics. - /// - /// - /// 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 IoT Security solution. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IIotSecuritySolutionAnalyticsOperations operations, string resourceGroupName, string solutionName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, solutionName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionOperations.cs deleted file mode 100644 index 2cff9404992e..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionOperations.cs +++ /dev/null @@ -1,1710 +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.Security -{ - 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; - - /// - /// IotSecuritySolutionOperations operations. - /// - internal partial class IotSecuritySolutionOperations : IServiceOperations, IIotSecuritySolutionOperations - { - /// - /// Initializes a new instance of the IotSecuritySolutionOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal IotSecuritySolutionOperations(SecurityCenterClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SecurityCenterClient - /// - public SecurityCenterClient Client { get; private set; } - - /// - /// Use this method to get the list of IoT Security solutions by subscription. - /// - /// - /// Filter the IoT Security solution with OData syntax. Supports filtering by - /// iotHubs. - /// - /// - /// 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>> ListBySubscriptionWithHttpMessagesAsync(string filter = default(string), 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}$"); - } - } - string apiVersion = "2019-08-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("filter", filter); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/iotSecuritySolutions").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (filter != null) - { - _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); - } - 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; - } - - /// - /// Use this method to get the list IoT Security solutions organized by - /// resource group. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// Filter the IoT Security solution with OData syntax. Supports filtering by - /// iotHubs. - /// - /// - /// 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string filter = default(string), 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\\._\\(\\)]+$"); - } - } - string apiVersion = "2019-08-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("filter", filter); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", 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.Security/iotSecuritySolutions").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (filter != null) - { - _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); - } - 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; - } - - /// - /// User this method to get details of a specific IoT Security solution based - /// on solution name - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The name of the IoT Security solution. - /// - /// - /// 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 solutionName, 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 (solutionName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "solutionName"); - } - string apiVersion = "2019-08-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("solutionName", solutionName); - 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.Security/iotSecuritySolutions/{solutionName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{solutionName}", System.Uri.EscapeDataString(solutionName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Use this method to create or update yours IoT Security solution - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The name of the IoT Security solution. - /// - /// - /// The security solution data - /// - /// - /// 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 solutionName, IoTSecuritySolutionModel iotSecuritySolutionData, 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 (solutionName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "solutionName"); - } - if (iotSecuritySolutionData == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "iotSecuritySolutionData"); - } - if (iotSecuritySolutionData != null) - { - iotSecuritySolutionData.Validate(); - } - string apiVersion = "2019-08-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("solutionName", solutionName); - tracingParameters.Add("iotSecuritySolutionData", iotSecuritySolutionData); - 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.Security/iotSecuritySolutions/{solutionName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{solutionName}", System.Uri.EscapeDataString(solutionName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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(iotSecuritySolutionData != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(iotSecuritySolutionData, 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; - } - - /// - /// Use this method to update existing IoT Security solution tags or user - /// defined resources. To update other fields use the CreateOrUpdate method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The name of the IoT Security solution. - /// - /// - /// The security solution data - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string solutionName, UpdateIotSecuritySolutionData updateIotSecuritySolutionData, 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 (solutionName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "solutionName"); - } - if (updateIotSecuritySolutionData == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "updateIotSecuritySolutionData"); - } - string apiVersion = "2019-08-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("solutionName", solutionName); - tracingParameters.Add("updateIotSecuritySolutionData", updateIotSecuritySolutionData); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{solutionName}", System.Uri.EscapeDataString(solutionName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PATCH"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(updateIotSecuritySolutionData != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(updateIotSecuritySolutionData, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Use this method to delete yours IoT Security solution - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The name of the IoT Security solution. - /// - /// - /// 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 solutionName, 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 (solutionName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "solutionName"); - } - string apiVersion = "2019-08-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("solutionName", solutionName); - 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.Security/iotSecuritySolutions/{solutionName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{solutionName}", System.Uri.EscapeDataString(solutionName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Use this method to get the list of IoT Security solutions by subscription. - /// - /// - /// 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>> ListBySubscriptionNextWithHttpMessagesAsync(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, "ListBySubscriptionNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Use this method to get the list IoT Security solutions organized by - /// resource group. - /// - /// - /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(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, "ListByResourceGroupNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionOperationsExtensions.cs deleted file mode 100644 index b157f32c4211..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionOperationsExtensions.cs +++ /dev/null @@ -1,358 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for IotSecuritySolutionOperations. - /// - public static partial class IotSecuritySolutionOperationsExtensions - { - /// - /// Use this method to get the list of IoT Security solutions by subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Filter the IoT Security solution with OData syntax. Supports filtering by - /// iotHubs. - /// - public static IPage ListBySubscription(this IIotSecuritySolutionOperations operations, string filter = default(string)) - { - return operations.ListBySubscriptionAsync(filter).GetAwaiter().GetResult(); - } - - /// - /// Use this method to get the list of IoT Security solutions by subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Filter the IoT Security solution with OData syntax. Supports filtering by - /// iotHubs. - /// - /// - /// The cancellation token. - /// - public static async Task> ListBySubscriptionAsync(this IIotSecuritySolutionOperations operations, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(filter, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Use this method to get the list IoT Security solutions organized by - /// resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// Filter the IoT Security solution with OData syntax. Supports filtering by - /// iotHubs. - /// - public static IPage ListByResourceGroup(this IIotSecuritySolutionOperations operations, string resourceGroupName, string filter = default(string)) - { - return operations.ListByResourceGroupAsync(resourceGroupName, filter).GetAwaiter().GetResult(); - } - - /// - /// Use this method to get the list IoT Security solutions organized by - /// resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// Filter the IoT Security solution with OData syntax. Supports filtering by - /// iotHubs. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByResourceGroupAsync(this IIotSecuritySolutionOperations operations, string resourceGroupName, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, filter, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// User this method to get details of a specific IoT Security solution based - /// on solution name - /// - /// - /// 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 IoT Security solution. - /// - public static IoTSecuritySolutionModel Get(this IIotSecuritySolutionOperations operations, string resourceGroupName, string solutionName) - { - return operations.GetAsync(resourceGroupName, solutionName).GetAwaiter().GetResult(); - } - - /// - /// User this method to get details of a specific IoT Security solution based - /// on solution name - /// - /// - /// 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 IoT Security solution. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IIotSecuritySolutionOperations operations, string resourceGroupName, string solutionName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, solutionName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Use this method to create or update yours IoT Security solution - /// - /// - /// 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 IoT Security solution. - /// - /// - /// The security solution data - /// - public static IoTSecuritySolutionModel CreateOrUpdate(this IIotSecuritySolutionOperations operations, string resourceGroupName, string solutionName, IoTSecuritySolutionModel iotSecuritySolutionData) - { - return operations.CreateOrUpdateAsync(resourceGroupName, solutionName, iotSecuritySolutionData).GetAwaiter().GetResult(); - } - - /// - /// Use this method to create or update yours IoT Security solution - /// - /// - /// 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 IoT Security solution. - /// - /// - /// The security solution data - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IIotSecuritySolutionOperations operations, string resourceGroupName, string solutionName, IoTSecuritySolutionModel iotSecuritySolutionData, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, solutionName, iotSecuritySolutionData, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Use this method to update existing IoT Security solution tags or user - /// defined resources. To update other fields use the CreateOrUpdate method. - /// - /// - /// 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 IoT Security solution. - /// - /// - /// The security solution data - /// - public static IoTSecuritySolutionModel Update(this IIotSecuritySolutionOperations operations, string resourceGroupName, string solutionName, UpdateIotSecuritySolutionData updateIotSecuritySolutionData) - { - return operations.UpdateAsync(resourceGroupName, solutionName, updateIotSecuritySolutionData).GetAwaiter().GetResult(); - } - - /// - /// Use this method to update existing IoT Security solution tags or user - /// defined resources. To update other fields use the CreateOrUpdate method. - /// - /// - /// 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 IoT Security solution. - /// - /// - /// The security solution data - /// - /// - /// The cancellation token. - /// - public static async Task UpdateAsync(this IIotSecuritySolutionOperations operations, string resourceGroupName, string solutionName, UpdateIotSecuritySolutionData updateIotSecuritySolutionData, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, solutionName, updateIotSecuritySolutionData, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Use this method to delete yours IoT Security solution - /// - /// - /// 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 IoT Security solution. - /// - public static void Delete(this IIotSecuritySolutionOperations operations, string resourceGroupName, string solutionName) - { - operations.DeleteAsync(resourceGroupName, solutionName).GetAwaiter().GetResult(); - } - - /// - /// Use this method to delete yours IoT Security solution - /// - /// - /// 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 IoT Security solution. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IIotSecuritySolutionOperations operations, string resourceGroupName, string solutionName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, solutionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Use this method to get the list of IoT Security solutions by subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListBySubscriptionNext(this IIotSecuritySolutionOperations operations, string nextPageLink) - { - return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Use this method to get the list of IoT Security solutions by subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListBySubscriptionNextAsync(this IIotSecuritySolutionOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Use this method to get the list IoT Security solutions organized by - /// resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByResourceGroupNext(this IIotSecuritySolutionOperations operations, string nextPageLink) - { - return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Use this method to get the list IoT Security solutions organized by - /// resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByResourceGroupNextAsync(this IIotSecuritySolutionOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionsAnalyticsAggregatedAlertOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionsAnalyticsAggregatedAlertOperations.cs deleted file mode 100644 index 68740bdb4a13..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionsAnalyticsAggregatedAlertOperations.cs +++ /dev/null @@ -1,886 +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.Security -{ - 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; - - /// - /// IotSecuritySolutionsAnalyticsAggregatedAlertOperations operations. - /// - internal partial class IotSecuritySolutionsAnalyticsAggregatedAlertOperations : IServiceOperations, IIotSecuritySolutionsAnalyticsAggregatedAlertOperations - { - /// - /// Initializes a new instance of the IotSecuritySolutionsAnalyticsAggregatedAlertOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal IotSecuritySolutionsAnalyticsAggregatedAlertOperations(SecurityCenterClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SecurityCenterClient - /// - public SecurityCenterClient Client { get; private set; } - - /// - /// Use this method to get the aggregated alert list of yours IoT Security - /// solution. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The name of the IoT Security solution. - /// - /// - /// Number of results to retrieve. - /// - /// - /// 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 solutionName, int? top = default(int?), 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 (solutionName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "solutionName"); - } - string apiVersion = "2019-08-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("solutionName", solutionName); - tracingParameters.Add("top", top); - 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.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{solutionName}", System.Uri.EscapeDataString(solutionName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (top != null) - { - _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Use this method to get a single the aggregated alert of yours IoT Security - /// solution. This aggregation is performed by alert name. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The name of the IoT Security solution. - /// - /// - /// Identifier of the aggregated alert. - /// - /// - /// 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 solutionName, string aggregatedAlertName, 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 (solutionName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "solutionName"); - } - if (aggregatedAlertName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "aggregatedAlertName"); - } - string apiVersion = "2019-08-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("solutionName", solutionName); - tracingParameters.Add("aggregatedAlertName", aggregatedAlertName); - 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.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts/{aggregatedAlertName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{solutionName}", System.Uri.EscapeDataString(solutionName)); - _url = _url.Replace("{aggregatedAlertName}", System.Uri.EscapeDataString(aggregatedAlertName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Use this method to dismiss an aggregated IoT Security Solution Alert. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The name of the IoT Security solution. - /// - /// - /// Identifier of the aggregated alert. - /// - /// - /// 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 DismissWithHttpMessagesAsync(string resourceGroupName, string solutionName, string aggregatedAlertName, 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 (solutionName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "solutionName"); - } - if (aggregatedAlertName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "aggregatedAlertName"); - } - string apiVersion = "2019-08-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("solutionName", solutionName); - tracingParameters.Add("aggregatedAlertName", aggregatedAlertName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Dismiss", 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.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts/{aggregatedAlertName}/dismiss").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{solutionName}", System.Uri.EscapeDataString(solutionName)); - _url = _url.Replace("{aggregatedAlertName}", System.Uri.EscapeDataString(aggregatedAlertName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Use this method to get the aggregated alert list of yours IoT Security - /// solution. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionsAnalyticsAggregatedAlertOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionsAnalyticsAggregatedAlertOperationsExtensions.cs deleted file mode 100644 index bf6dfa202398..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionsAnalyticsAggregatedAlertOperationsExtensions.cs +++ /dev/null @@ -1,206 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for IotSecuritySolutionsAnalyticsAggregatedAlertOperations. - /// - public static partial class IotSecuritySolutionsAnalyticsAggregatedAlertOperationsExtensions - { - /// - /// Use this method to get the aggregated alert list of yours IoT Security - /// solution. - /// - /// - /// 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 IoT Security solution. - /// - /// - /// Number of results to retrieve. - /// - public static IPage List(this IIotSecuritySolutionsAnalyticsAggregatedAlertOperations operations, string resourceGroupName, string solutionName, int? top = default(int?)) - { - return operations.ListAsync(resourceGroupName, solutionName, top).GetAwaiter().GetResult(); - } - - /// - /// Use this method to get the aggregated alert list of yours IoT Security - /// solution. - /// - /// - /// 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 IoT Security solution. - /// - /// - /// Number of results to retrieve. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IIotSecuritySolutionsAnalyticsAggregatedAlertOperations operations, string resourceGroupName, string solutionName, int? top = default(int?), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, solutionName, top, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Use this method to get a single the aggregated alert of yours IoT Security - /// solution. This aggregation is performed by alert name. - /// - /// - /// 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 IoT Security solution. - /// - /// - /// Identifier of the aggregated alert. - /// - public static IoTSecurityAggregatedAlert Get(this IIotSecuritySolutionsAnalyticsAggregatedAlertOperations operations, string resourceGroupName, string solutionName, string aggregatedAlertName) - { - return operations.GetAsync(resourceGroupName, solutionName, aggregatedAlertName).GetAwaiter().GetResult(); - } - - /// - /// Use this method to get a single the aggregated alert of yours IoT Security - /// solution. This aggregation is performed by alert name. - /// - /// - /// 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 IoT Security solution. - /// - /// - /// Identifier of the aggregated alert. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IIotSecuritySolutionsAnalyticsAggregatedAlertOperations operations, string resourceGroupName, string solutionName, string aggregatedAlertName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, solutionName, aggregatedAlertName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Use this method to dismiss an aggregated IoT Security Solution Alert. - /// - /// - /// 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 IoT Security solution. - /// - /// - /// Identifier of the aggregated alert. - /// - public static void Dismiss(this IIotSecuritySolutionsAnalyticsAggregatedAlertOperations operations, string resourceGroupName, string solutionName, string aggregatedAlertName) - { - operations.DismissAsync(resourceGroupName, solutionName, aggregatedAlertName).GetAwaiter().GetResult(); - } - - /// - /// Use this method to dismiss an aggregated IoT Security Solution Alert. - /// - /// - /// 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 IoT Security solution. - /// - /// - /// Identifier of the aggregated alert. - /// - /// - /// The cancellation token. - /// - public static async Task DismissAsync(this IIotSecuritySolutionsAnalyticsAggregatedAlertOperations operations, string resourceGroupName, string solutionName, string aggregatedAlertName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DismissWithHttpMessagesAsync(resourceGroupName, solutionName, aggregatedAlertName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Use this method to get the aggregated alert list of yours IoT Security - /// solution. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IIotSecuritySolutionsAnalyticsAggregatedAlertOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Use this method to get the aggregated alert list of yours IoT Security - /// solution. - /// - /// - /// 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 IIotSecuritySolutionsAnalyticsAggregatedAlertOperations 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionsAnalyticsRecommendationOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionsAnalyticsRecommendationOperations.cs deleted file mode 100644 index b64b055e7625..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionsAnalyticsRecommendationOperations.cs +++ /dev/null @@ -1,682 +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.Security -{ - 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; - - /// - /// IotSecuritySolutionsAnalyticsRecommendationOperations operations. - /// - internal partial class IotSecuritySolutionsAnalyticsRecommendationOperations : IServiceOperations, IIotSecuritySolutionsAnalyticsRecommendationOperations - { - /// - /// Initializes a new instance of the IotSecuritySolutionsAnalyticsRecommendationOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal IotSecuritySolutionsAnalyticsRecommendationOperations(SecurityCenterClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SecurityCenterClient - /// - public SecurityCenterClient Client { get; private set; } - - /// - /// Use this method to get the aggregated security analytics recommendation of - /// yours IoT Security solution. This aggregation is performed by - /// recommendation name. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The name of the IoT Security solution. - /// - /// - /// Name of the recommendation aggregated for this query. - /// - /// - /// 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 solutionName, string aggregatedRecommendationName, 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 (solutionName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "solutionName"); - } - if (aggregatedRecommendationName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "aggregatedRecommendationName"); - } - string apiVersion = "2019-08-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("solutionName", solutionName); - tracingParameters.Add("aggregatedRecommendationName", aggregatedRecommendationName); - 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.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedRecommendations/{aggregatedRecommendationName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{solutionName}", System.Uri.EscapeDataString(solutionName)); - _url = _url.Replace("{aggregatedRecommendationName}", System.Uri.EscapeDataString(aggregatedRecommendationName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Use this method to get the list of aggregated security analytics - /// recommendations of yours IoT Security solution. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The name of the IoT Security solution. - /// - /// - /// Number of results to retrieve. - /// - /// - /// 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 solutionName, int? top = default(int?), 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 (solutionName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "solutionName"); - } - string apiVersion = "2019-08-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("solutionName", solutionName); - tracingParameters.Add("top", top); - 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.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedRecommendations").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{solutionName}", System.Uri.EscapeDataString(solutionName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (top != null) - { - _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Use this method to get the list of aggregated security analytics - /// recommendations of yours IoT Security solution. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionsAnalyticsRecommendationOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionsAnalyticsRecommendationOperationsExtensions.cs deleted file mode 100644 index 3fd8c6741346..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSecuritySolutionsAnalyticsRecommendationOperationsExtensions.cs +++ /dev/null @@ -1,163 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for IotSecuritySolutionsAnalyticsRecommendationOperations. - /// - public static partial class IotSecuritySolutionsAnalyticsRecommendationOperationsExtensions - { - /// - /// Use this method to get the aggregated security analytics recommendation of - /// yours IoT Security solution. This aggregation is performed by - /// recommendation name. - /// - /// - /// 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 IoT Security solution. - /// - /// - /// Name of the recommendation aggregated for this query. - /// - public static IoTSecurityAggregatedRecommendation Get(this IIotSecuritySolutionsAnalyticsRecommendationOperations operations, string resourceGroupName, string solutionName, string aggregatedRecommendationName) - { - return operations.GetAsync(resourceGroupName, solutionName, aggregatedRecommendationName).GetAwaiter().GetResult(); - } - - /// - /// Use this method to get the aggregated security analytics recommendation of - /// yours IoT Security solution. This aggregation is performed by - /// recommendation name. - /// - /// - /// 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 IoT Security solution. - /// - /// - /// Name of the recommendation aggregated for this query. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IIotSecuritySolutionsAnalyticsRecommendationOperations operations, string resourceGroupName, string solutionName, string aggregatedRecommendationName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, solutionName, aggregatedRecommendationName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Use this method to get the list of aggregated security analytics - /// recommendations of yours IoT Security solution. - /// - /// - /// 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 IoT Security solution. - /// - /// - /// Number of results to retrieve. - /// - public static IPage List(this IIotSecuritySolutionsAnalyticsRecommendationOperations operations, string resourceGroupName, string solutionName, int? top = default(int?)) - { - return operations.ListAsync(resourceGroupName, solutionName, top).GetAwaiter().GetResult(); - } - - /// - /// Use this method to get the list of aggregated security analytics - /// recommendations of yours IoT Security solution. - /// - /// - /// 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 IoT Security solution. - /// - /// - /// Number of results to retrieve. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IIotSecuritySolutionsAnalyticsRecommendationOperations operations, string resourceGroupName, string solutionName, int? top = default(int?), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, solutionName, top, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Use this method to get the list of aggregated security analytics - /// recommendations of yours IoT Security solution. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IIotSecuritySolutionsAnalyticsRecommendationOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Use this method to get the list of aggregated security analytics - /// recommendations of yours IoT Security solution. - /// - /// - /// 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 IIotSecuritySolutionsAnalyticsRecommendationOperations 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/JitNetworkAccessPoliciesOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/JitNetworkAccessPoliciesOperations.cs deleted file mode 100644 index e600a0970206..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/JitNetworkAccessPoliciesOperations.cs +++ /dev/null @@ -1,2465 +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.Security -{ - 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; - - /// - /// JitNetworkAccessPoliciesOperations operations. - /// - internal partial class JitNetworkAccessPoliciesOperations : IServiceOperations, IJitNetworkAccessPoliciesOperations - { - /// - /// Initializes a new instance of the JitNetworkAccessPoliciesOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal JitNetworkAccessPoliciesOperations(SecurityCenterClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SecurityCenterClient - /// - public SecurityCenterClient Client { get; private set; } - - /// - /// Policies for protecting resources using Just-in-Time access control. - /// - /// - /// 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(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}$"); - } - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - 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}/providers/Microsoft.Security/jitNetworkAccessPolicies").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Policies for protecting resources using Just-in-Time access control for the - /// subscription, location - /// - /// - /// 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>> ListByRegionWithHttpMessagesAsync(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 (Client.AscLocation == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.AscLocation"); - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByRegion", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{ascLocation}", System.Uri.EscapeDataString(Client.AscLocation)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Policies for protecting resources using Just-in-Time access control for the - /// subscription, location - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, 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\\._\\(\\)]+$"); - } - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", 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.Security/jitNetworkAccessPolicies").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Policies for protecting resources using Just-in-Time access control for the - /// subscription, location - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// 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>> ListByResourceGroupAndRegionWithHttpMessagesAsync(string resourceGroupName, 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 (Client.AscLocation == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.AscLocation"); - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupAndRegion", 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.Security/locations/{ascLocation}/jitNetworkAccessPolicies").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{ascLocation}", System.Uri.EscapeDataString(Client.AscLocation)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Policies for protecting resources using Just-in-Time access control for the - /// subscription, location - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// Name of a Just-in-Time access configuration policy. - /// - /// - /// 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 jitNetworkAccessPolicyName, 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 (Client.AscLocation == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.AscLocation"); - } - if (jitNetworkAccessPolicyName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "jitNetworkAccessPolicyName"); - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("jitNetworkAccessPolicyName", jitNetworkAccessPolicyName); - tracingParameters.Add("apiVersion", apiVersion); - 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.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{ascLocation}", System.Uri.EscapeDataString(Client.AscLocation)); - _url = _url.Replace("{jitNetworkAccessPolicyName}", System.Uri.EscapeDataString(jitNetworkAccessPolicyName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Create a policy for protecting resources using Just-in-Time access control - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// Name of a Just-in-Time access configuration policy. - /// - /// - /// - /// - /// 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 jitNetworkAccessPolicyName, JitNetworkAccessPolicy body, 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 (Client.AscLocation == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.AscLocation"); - } - if (jitNetworkAccessPolicyName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "jitNetworkAccessPolicyName"); - } - if (body == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "body"); - } - if (body != null) - { - body.Validate(); - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("jitNetworkAccessPolicyName", jitNetworkAccessPolicyName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("body", body); - 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.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{ascLocation}", System.Uri.EscapeDataString(Client.AscLocation)); - _url = _url.Replace("{jitNetworkAccessPolicyName}", System.Uri.EscapeDataString(jitNetworkAccessPolicyName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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(body != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Delete a Just-in-Time access control policy. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// Name of a Just-in-Time access configuration policy. - /// - /// - /// 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 jitNetworkAccessPolicyName, 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 (Client.AscLocation == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.AscLocation"); - } - if (jitNetworkAccessPolicyName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "jitNetworkAccessPolicyName"); - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("jitNetworkAccessPolicyName", jitNetworkAccessPolicyName); - tracingParameters.Add("apiVersion", apiVersion); - 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.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{ascLocation}", System.Uri.EscapeDataString(Client.AscLocation)); - _url = _url.Replace("{jitNetworkAccessPolicyName}", System.Uri.EscapeDataString(jitNetworkAccessPolicyName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Initiate a JIT access from a specific Just-in-Time policy configuration. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// Name of a Just-in-Time access configuration policy. - /// - /// - /// A list of virtual machines & ports to open access for - /// - /// - /// The justification for making the initiate request - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> InitiateWithHttpMessagesAsync(string resourceGroupName, string jitNetworkAccessPolicyName, IList virtualMachines, string justification = default(string), 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 (Client.AscLocation == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.AscLocation"); - } - if (jitNetworkAccessPolicyName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "jitNetworkAccessPolicyName"); - } - if (virtualMachines == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "virtualMachines"); - } - if (virtualMachines != null) - { - foreach (var element in virtualMachines) - { - if (element != null) - { - element.Validate(); - } - } - } - string jitNetworkAccessPolicyInitiateType = "initiate"; - string apiVersion = "2020-01-01"; - JitNetworkAccessPolicyInitiateRequest body = new JitNetworkAccessPolicyInitiateRequest(); - if (virtualMachines != null || justification != null) - { - body.VirtualMachines = virtualMachines; - body.Justification = justification; - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("jitNetworkAccessPolicyName", jitNetworkAccessPolicyName); - tracingParameters.Add("jitNetworkAccessPolicyInitiateType", jitNetworkAccessPolicyInitiateType); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("body", body); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Initiate", 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.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}/{jitNetworkAccessPolicyInitiateType}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{ascLocation}", System.Uri.EscapeDataString(Client.AscLocation)); - _url = _url.Replace("{jitNetworkAccessPolicyName}", System.Uri.EscapeDataString(jitNetworkAccessPolicyName)); - _url = _url.Replace("{jitNetworkAccessPolicyInitiateType}", System.Uri.EscapeDataString(jitNetworkAccessPolicyInitiateType)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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(body != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, 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 != 202) - { - 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 == 202) - { - _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; - } - - /// - /// Policies for protecting resources using Just-in-Time access control. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Policies for protecting resources using Just-in-Time access control for the - /// subscription, location - /// - /// - /// 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>> ListByRegionNextWithHttpMessagesAsync(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, "ListByRegionNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Policies for protecting resources using Just-in-Time access control for the - /// subscription, location - /// - /// - /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(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, "ListByResourceGroupNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Policies for protecting resources using Just-in-Time access control for the - /// subscription, location - /// - /// - /// 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>> ListByResourceGroupAndRegionNextWithHttpMessagesAsync(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, "ListByResourceGroupAndRegionNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/JitNetworkAccessPoliciesOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/JitNetworkAccessPoliciesOperationsExtensions.cs deleted file mode 100644 index d38cf804bfe6..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/JitNetworkAccessPoliciesOperationsExtensions.cs +++ /dev/null @@ -1,486 +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.Security -{ - 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 JitNetworkAccessPoliciesOperations. - /// - public static partial class JitNetworkAccessPoliciesOperationsExtensions - { - /// - /// Policies for protecting resources using Just-in-Time access control. - /// - /// - /// The operations group for this extension method. - /// - public static IPage List(this IJitNetworkAccessPoliciesOperations operations) - { - return operations.ListAsync().GetAwaiter().GetResult(); - } - - /// - /// Policies for protecting resources using Just-in-Time access control. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IJitNetworkAccessPoliciesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Policies for protecting resources using Just-in-Time access control for the - /// subscription, location - /// - /// - /// The operations group for this extension method. - /// - public static IPage ListByRegion(this IJitNetworkAccessPoliciesOperations operations) - { - return operations.ListByRegionAsync().GetAwaiter().GetResult(); - } - - /// - /// Policies for protecting resources using Just-in-Time access control for the - /// subscription, location - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByRegionAsync(this IJitNetworkAccessPoliciesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByRegionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Policies for protecting resources using Just-in-Time access control for the - /// subscription, location - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - public static IPage ListByResourceGroup(this IJitNetworkAccessPoliciesOperations operations, string resourceGroupName) - { - return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); - } - - /// - /// Policies for protecting resources using Just-in-Time access control for the - /// subscription, location - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByResourceGroupAsync(this IJitNetworkAccessPoliciesOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Policies for protecting resources using Just-in-Time access control for the - /// subscription, location - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - public static IPage ListByResourceGroupAndRegion(this IJitNetworkAccessPoliciesOperations operations, string resourceGroupName) - { - return operations.ListByResourceGroupAndRegionAsync(resourceGroupName).GetAwaiter().GetResult(); - } - - /// - /// Policies for protecting resources using Just-in-Time access control for the - /// subscription, location - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByResourceGroupAndRegionAsync(this IJitNetworkAccessPoliciesOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByResourceGroupAndRegionWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Policies for protecting resources using Just-in-Time access control for the - /// subscription, location - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// Name of a Just-in-Time access configuration policy. - /// - public static JitNetworkAccessPolicy Get(this IJitNetworkAccessPoliciesOperations operations, string resourceGroupName, string jitNetworkAccessPolicyName) - { - return operations.GetAsync(resourceGroupName, jitNetworkAccessPolicyName).GetAwaiter().GetResult(); - } - - /// - /// Policies for protecting resources using Just-in-Time access control for the - /// subscription, location - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// Name of a Just-in-Time access configuration policy. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IJitNetworkAccessPoliciesOperations operations, string resourceGroupName, string jitNetworkAccessPolicyName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, jitNetworkAccessPolicyName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Create a policy for protecting resources using Just-in-Time access control - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// Name of a Just-in-Time access configuration policy. - /// - /// - /// - public static JitNetworkAccessPolicy CreateOrUpdate(this IJitNetworkAccessPoliciesOperations operations, string resourceGroupName, string jitNetworkAccessPolicyName, JitNetworkAccessPolicy body) - { - return operations.CreateOrUpdateAsync(resourceGroupName, jitNetworkAccessPolicyName, body).GetAwaiter().GetResult(); - } - - /// - /// Create a policy for protecting resources using Just-in-Time access control - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// Name of a Just-in-Time access configuration policy. - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IJitNetworkAccessPoliciesOperations operations, string resourceGroupName, string jitNetworkAccessPolicyName, JitNetworkAccessPolicy body, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, jitNetworkAccessPolicyName, body, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Delete a Just-in-Time access control policy. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// Name of a Just-in-Time access configuration policy. - /// - public static void Delete(this IJitNetworkAccessPoliciesOperations operations, string resourceGroupName, string jitNetworkAccessPolicyName) - { - operations.DeleteAsync(resourceGroupName, jitNetworkAccessPolicyName).GetAwaiter().GetResult(); - } - - /// - /// Delete a Just-in-Time access control policy. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// Name of a Just-in-Time access configuration policy. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IJitNetworkAccessPoliciesOperations operations, string resourceGroupName, string jitNetworkAccessPolicyName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, jitNetworkAccessPolicyName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Initiate a JIT access from a specific Just-in-Time policy configuration. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// Name of a Just-in-Time access configuration policy. - /// - /// - /// A list of virtual machines & ports to open access for - /// - /// - /// The justification for making the initiate request - /// - public static JitNetworkAccessRequest Initiate(this IJitNetworkAccessPoliciesOperations operations, string resourceGroupName, string jitNetworkAccessPolicyName, IList virtualMachines, string justification = default(string)) - { - return operations.InitiateAsync(resourceGroupName, jitNetworkAccessPolicyName, virtualMachines, justification).GetAwaiter().GetResult(); - } - - /// - /// Initiate a JIT access from a specific Just-in-Time policy configuration. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// Name of a Just-in-Time access configuration policy. - /// - /// - /// A list of virtual machines & ports to open access for - /// - /// - /// The justification for making the initiate request - /// - /// - /// The cancellation token. - /// - public static async Task InitiateAsync(this IJitNetworkAccessPoliciesOperations operations, string resourceGroupName, string jitNetworkAccessPolicyName, IList virtualMachines, string justification = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.InitiateWithHttpMessagesAsync(resourceGroupName, jitNetworkAccessPolicyName, virtualMachines, justification, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Policies for protecting resources using Just-in-Time access control. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IJitNetworkAccessPoliciesOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Policies for protecting resources using Just-in-Time access control. - /// - /// - /// 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 IJitNetworkAccessPoliciesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Policies for protecting resources using Just-in-Time access control for the - /// subscription, location - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByRegionNext(this IJitNetworkAccessPoliciesOperations operations, string nextPageLink) - { - return operations.ListByRegionNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Policies for protecting resources using Just-in-Time access control for the - /// subscription, location - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByRegionNextAsync(this IJitNetworkAccessPoliciesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByRegionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Policies for protecting resources using Just-in-Time access control for the - /// subscription, location - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByResourceGroupNext(this IJitNetworkAccessPoliciesOperations operations, string nextPageLink) - { - return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Policies for protecting resources using Just-in-Time access control for the - /// subscription, location - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByResourceGroupNextAsync(this IJitNetworkAccessPoliciesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Policies for protecting resources using Just-in-Time access control for the - /// subscription, location - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByResourceGroupAndRegionNext(this IJitNetworkAccessPoliciesOperations operations, string nextPageLink) - { - return operations.ListByResourceGroupAndRegionNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Policies for protecting resources using Just-in-Time access control for the - /// subscription, location - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByResourceGroupAndRegionNextAsync(this IJitNetworkAccessPoliciesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByResourceGroupAndRegionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/LocationsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/LocationsOperations.cs deleted file mode 100644 index 456e5d1aa5a0..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/LocationsOperations.cs +++ /dev/null @@ -1,604 +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.Security -{ - 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; - - /// - /// LocationsOperations operations. - /// - internal partial class LocationsOperations : IServiceOperations, ILocationsOperations - { - /// - /// Initializes a new instance of the LocationsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal LocationsOperations(SecurityCenterClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SecurityCenterClient - /// - public SecurityCenterClient Client { get; private set; } - - /// - /// The location of the responsible ASC of the specific subscription (home - /// region). For each subscription there is only one responsible location. The - /// location in the response should be used to read or write other resources in - /// ASC according to their 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>> ListWithHttpMessagesAsync(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}$"); - } - } - string apiVersion = "2015-06-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - 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}/providers/Microsoft.Security/locations").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Details of a specific location - /// - /// - /// 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(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 (Client.AscLocation == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.AscLocation"); - } - string apiVersion = "2015-06-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - 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}/providers/Microsoft.Security/locations/{ascLocation}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{ascLocation}", System.Uri.EscapeDataString(Client.AscLocation)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// The location of the responsible ASC of the specific subscription (home - /// region). For each subscription there is only one responsible location. The - /// location in the response should be used to read or write other resources in - /// ASC according to their ID. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/LocationsOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/LocationsOperationsExtensions.cs deleted file mode 100644 index 2352a413ee62..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/LocationsOperationsExtensions.cs +++ /dev/null @@ -1,127 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for LocationsOperations. - /// - public static partial class LocationsOperationsExtensions - { - /// - /// The location of the responsible ASC of the specific subscription (home - /// region). For each subscription there is only one responsible location. The - /// location in the response should be used to read or write other resources in - /// ASC according to their ID. - /// - /// - /// The operations group for this extension method. - /// - public static IPage List(this ILocationsOperations operations) - { - return operations.ListAsync().GetAwaiter().GetResult(); - } - - /// - /// The location of the responsible ASC of the specific subscription (home - /// region). For each subscription there is only one responsible location. The - /// location in the response should be used to read or write other resources in - /// ASC according to their ID. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this ILocationsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Details of a specific location - /// - /// - /// The operations group for this extension method. - /// - public static AscLocation Get(this ILocationsOperations operations) - { - return operations.GetAsync().GetAwaiter().GetResult(); - } - - /// - /// Details of a specific location - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this ILocationsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// The location of the responsible ASC of the specific subscription (home - /// region). For each subscription there is only one responsible location. The - /// location in the response should be used to read or write other resources in - /// ASC according to their ID. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this ILocationsOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// The location of the responsible ASC of the specific subscription (home - /// region). For each subscription there is only one responsible location. The - /// location in the response should be used to read or write other resources in - /// ASC according to their ID. - /// - /// - /// 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 ILocationsOperations 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AadConnectivityState.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AadConnectivityState.cs deleted file mode 100644 index e6dc14a7b834..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AadConnectivityState.cs +++ /dev/null @@ -1,23 +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.Security.Models -{ - - /// - /// Defines values for AadConnectivityState. - /// - public static class AadConnectivityState - { - public const string Discovered = "Discovered"; - public const string NotLicensed = "NotLicensed"; - public const string Connected = "Connected"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AadConnectivityState1.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AadConnectivityState1.cs deleted file mode 100644 index 4ecf3bb262b8..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AadConnectivityState1.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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Describes an Azure resource with kind - /// - public partial class AadConnectivityState1 - { - /// - /// Initializes a new instance of the AadConnectivityState1 class. - /// - public AadConnectivityState1() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AadConnectivityState1 class. - /// - /// The connectivity state of the - /// external AAD solution - public AadConnectivityState1(string connectivityState = default(string)) - { - ConnectivityState = connectivityState; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the connectivity state of the external AAD solution - /// - /// - /// Possible values include: 'Discovered', 'NotLicensed', 'Connected' - /// - [JsonProperty(PropertyName = "connectivityState")] - public string ConnectivityState { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AadExternalSecuritySolution.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AadExternalSecuritySolution.cs deleted file mode 100644 index 96b281d985c0..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AadExternalSecuritySolution.cs +++ /dev/null @@ -1,59 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Represents an AAD identity protection solution which sends logs to an - /// OMS workspace. - /// - [Newtonsoft.Json.JsonObject("AAD")] - public partial class AadExternalSecuritySolution : ExternalSecuritySolution - { - /// - /// Initializes a new instance of the AadExternalSecuritySolution - /// class. - /// - public AadExternalSecuritySolution() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AadExternalSecuritySolution - /// class. - /// - /// Resource Id - /// Resource name - /// Resource type - /// Location where the resource is - /// stored - public AadExternalSecuritySolution(string id = default(string), string name = default(string), string type = default(string), string location = default(string), AadSolutionProperties properties = default(AadSolutionProperties)) - : base(id, name, type, location) - { - Properties = properties; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "properties")] - public AadSolutionProperties Properties { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AadSolutionProperties.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AadSolutionProperties.cs deleted file mode 100644 index 8c4467443ee6..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AadSolutionProperties.cs +++ /dev/null @@ -1,73 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// The external security solution properties for AAD solutions - /// - public partial class AadSolutionProperties - { - /// - /// Initializes a new instance of the AadSolutionProperties class. - /// - public AadSolutionProperties() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AadSolutionProperties class. - /// - /// The connectivity state of the - /// external AAD solution - public AadSolutionProperties(string deviceVendor = default(string), string deviceType = default(string), ConnectedWorkspace workspace = default(ConnectedWorkspace), string connectivityState = default(string)) - { - DeviceVendor = deviceVendor; - DeviceType = deviceType; - Workspace = workspace; - ConnectivityState = connectivityState; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "deviceVendor")] - public string DeviceVendor { get; set; } - - /// - /// - [JsonProperty(PropertyName = "deviceType")] - public string DeviceType { get; set; } - - /// - /// - [JsonProperty(PropertyName = "workspace")] - public ConnectedWorkspace Workspace { get; set; } - - /// - /// Gets or sets the connectivity state of the external AAD solution - /// - /// - /// Possible values include: 'Discovered', 'NotLicensed', 'Connected' - /// - [JsonProperty(PropertyName = "connectivityState")] - public string ConnectivityState { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ActiveConnectionsNotInAllowedRange.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ActiveConnectionsNotInAllowedRange.cs deleted file mode 100644 index 1d901cbc4a88..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ActiveConnectionsNotInAllowedRange.cs +++ /dev/null @@ -1,64 +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.Security.Models -{ - using System.Linq; - - /// - /// Number of active connections is not in allowed range. - /// - public partial class ActiveConnectionsNotInAllowedRange : TimeWindowCustomAlertRule - { - /// - /// Initializes a new instance of the - /// ActiveConnectionsNotInAllowedRange class. - /// - public ActiveConnectionsNotInAllowedRange() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// ActiveConnectionsNotInAllowedRange class. - /// - /// Status of the custom alert. - /// The minimum threshold. - /// The maximum threshold. - /// The time window size in iso8601 - /// format. - /// The display name of the custom - /// alert. - /// The description of the custom - /// alert. - public ActiveConnectionsNotInAllowedRange(bool isEnabled, int minThreshold, int maxThreshold, System.TimeSpan timeWindowSize, string displayName = default(string), string description = default(string)) - : base(isEnabled, minThreshold, maxThreshold, timeWindowSize, displayName, description) - { - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AdaptiveApplicationControlGroup.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AdaptiveApplicationControlGroup.cs deleted file mode 100644 index 584a79c8d071..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AdaptiveApplicationControlGroup.cs +++ /dev/null @@ -1,145 +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.Security.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - [Rest.Serialization.JsonTransformation] - public partial class AdaptiveApplicationControlGroup - { - /// - /// Initializes a new instance of the AdaptiveApplicationControlGroup - /// class. - /// - public AdaptiveApplicationControlGroup() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AdaptiveApplicationControlGroup - /// class. - /// - /// Resource Id - /// Resource name - /// Resource type - /// Location where the resource is - /// stored - /// Possible values include: 'Audit', - /// 'Enforce', 'None' - /// Possible values include: - /// 'Configured', 'NotConfigured', 'InProgress', 'Failed', - /// 'NoStatus' - /// Possible values include: - /// 'Recommended', 'NotRecommended', 'NotAvailable', 'NoStatus' - /// Possible values include: - /// 'Azure_AppLocker', 'Azure_AuditD', 'NonAzure_AppLocker', - /// 'NonAzure_AuditD', 'None' - public AdaptiveApplicationControlGroup(string id = default(string), string name = default(string), string type = default(string), string location = default(string), string enforcementMode = default(string), ProtectionMode protectionMode = default(ProtectionMode), string configurationStatus = default(string), string recommendationStatus = default(string), IList issues = default(IList), string sourceSystem = default(string), IList vmRecommendations = default(IList), IList pathRecommendations = default(IList)) - { - Id = id; - Name = name; - Type = type; - Location = location; - EnforcementMode = enforcementMode; - ProtectionMode = protectionMode; - ConfigurationStatus = configurationStatus; - RecommendationStatus = recommendationStatus; - Issues = issues; - SourceSystem = sourceSystem; - VmRecommendations = vmRecommendations; - PathRecommendations = pathRecommendations; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets resource Id - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } - - /// - /// Gets resource name - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } - - /// - /// Gets resource type - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } - - /// - /// Gets location where the resource is stored - /// - [JsonProperty(PropertyName = "location")] - public string Location { get; private set; } - - /// - /// Gets or sets possible values include: 'Audit', 'Enforce', 'None' - /// - [JsonProperty(PropertyName = "properties.enforcementMode")] - public string EnforcementMode { get; set; } - - /// - /// - [JsonProperty(PropertyName = "properties.protectionMode")] - public ProtectionMode ProtectionMode { get; set; } - - /// - /// Gets possible values include: 'Configured', 'NotConfigured', - /// 'InProgress', 'Failed', 'NoStatus' - /// - [JsonProperty(PropertyName = "properties.configurationStatus")] - public string ConfigurationStatus { get; private set; } - - /// - /// Gets possible values include: 'Recommended', 'NotRecommended', - /// 'NotAvailable', 'NoStatus' - /// - [JsonProperty(PropertyName = "properties.recommendationStatus")] - public string RecommendationStatus { get; private set; } - - /// - /// - [JsonProperty(PropertyName = "properties.issues")] - public IList Issues { get; private set; } - - /// - /// Gets possible values include: 'Azure_AppLocker', 'Azure_AuditD', - /// 'NonAzure_AppLocker', 'NonAzure_AuditD', 'None' - /// - [JsonProperty(PropertyName = "properties.sourceSystem")] - public string SourceSystem { get; private set; } - - /// - /// - [JsonProperty(PropertyName = "properties.vmRecommendations")] - public IList VmRecommendations { get; set; } - - /// - /// - [JsonProperty(PropertyName = "properties.pathRecommendations")] - public IList PathRecommendations { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AdaptiveApplicationControlGroups.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AdaptiveApplicationControlGroups.cs deleted file mode 100644 index 515e95b7c5c8..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AdaptiveApplicationControlGroups.cs +++ /dev/null @@ -1,54 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Represents a list of machine groups and set of rules that are - /// recommended by Azure Security Center to be allowed - /// - public partial class AdaptiveApplicationControlGroups - { - /// - /// Initializes a new instance of the AdaptiveApplicationControlGroups - /// class. - /// - public AdaptiveApplicationControlGroups() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AdaptiveApplicationControlGroups - /// class. - /// - public AdaptiveApplicationControlGroups(IList value = default(IList)) - { - Value = value; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "value")] - public IList Value { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AdaptiveApplicationControlIssueSummary.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AdaptiveApplicationControlIssueSummary.cs deleted file mode 100644 index b97d7f1986d7..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AdaptiveApplicationControlIssueSummary.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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Represents a summary of the alerts of the machine group - /// - public partial class AdaptiveApplicationControlIssueSummary - { - /// - /// Initializes a new instance of the - /// AdaptiveApplicationControlIssueSummary class. - /// - public AdaptiveApplicationControlIssueSummary() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// AdaptiveApplicationControlIssueSummary class. - /// - /// Possible values include: 'ViolationsAudited', - /// 'ViolationsBlocked', 'MsiAndScriptViolationsAudited', - /// 'MsiAndScriptViolationsBlocked', 'ExecutableViolationsAudited', - /// 'RulesViolatedManually' - /// The number of machines in the group that - /// have this alert - public AdaptiveApplicationControlIssueSummary(string issue = default(string), double? numberOfVms = default(double?)) - { - Issue = issue; - NumberOfVms = numberOfVms; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets possible values include: 'ViolationsAudited', - /// 'ViolationsBlocked', 'MsiAndScriptViolationsAudited', - /// 'MsiAndScriptViolationsBlocked', 'ExecutableViolationsAudited', - /// 'RulesViolatedManually' - /// - [JsonProperty(PropertyName = "issue")] - public string Issue { get; set; } - - /// - /// Gets or sets the number of machines in the group that have this - /// alert - /// - [JsonProperty(PropertyName = "numberOfVms")] - public double? NumberOfVms { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AdaptiveNetworkHardening.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AdaptiveNetworkHardening.cs deleted file mode 100644 index f2f530b17ae7..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AdaptiveNetworkHardening.cs +++ /dev/null @@ -1,83 +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.Security.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The resource whose properties describes the Adaptive Network Hardening - /// settings for some Azure resource - /// - [Rest.Serialization.JsonTransformation] - public partial class AdaptiveNetworkHardening : Resource - { - /// - /// Initializes a new instance of the AdaptiveNetworkHardening class. - /// - public AdaptiveNetworkHardening() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AdaptiveNetworkHardening class. - /// - /// Resource Id - /// Resource name - /// Resource type - /// The security rules which are recommended to be - /// effective on the VM - /// The UTC time on which the rules - /// were calculated - /// The Network Security - /// Groups effective on the network interfaces of the protected - /// resource - public AdaptiveNetworkHardening(string id = default(string), string name = default(string), string type = default(string), IList rules = default(IList), System.DateTime? rulesCalculationTime = default(System.DateTime?), IList effectiveNetworkSecurityGroups = default(IList)) - : base(id, name, type) - { - Rules = rules; - RulesCalculationTime = rulesCalculationTime; - EffectiveNetworkSecurityGroups = effectiveNetworkSecurityGroups; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the security rules which are recommended to be - /// effective on the VM - /// - [JsonProperty(PropertyName = "properties.rules")] - public IList Rules { get; set; } - - /// - /// Gets or sets the UTC time on which the rules were calculated - /// - [JsonProperty(PropertyName = "properties.rulesCalculationTime")] - public System.DateTime? RulesCalculationTime { get; set; } - - /// - /// Gets or sets the Network Security Groups effective on the network - /// interfaces of the protected resource - /// - [JsonProperty(PropertyName = "properties.effectiveNetworkSecurityGroups")] - public IList EffectiveNetworkSecurityGroups { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AdaptiveNetworkHardeningEnforceRequest.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AdaptiveNetworkHardeningEnforceRequest.cs deleted file mode 100644 index 6ec2af5cda64..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AdaptiveNetworkHardeningEnforceRequest.cs +++ /dev/null @@ -1,83 +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.Security.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - public partial class AdaptiveNetworkHardeningEnforceRequest - { - /// - /// Initializes a new instance of the - /// AdaptiveNetworkHardeningEnforceRequest class. - /// - public AdaptiveNetworkHardeningEnforceRequest() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// AdaptiveNetworkHardeningEnforceRequest class. - /// - /// The rules to enforce - /// The Azure resource IDs of the - /// effective network security groups that will be updated with the - /// created security rules from the Adaptive Network Hardening - /// rules - public AdaptiveNetworkHardeningEnforceRequest(IList rules, IList networkSecurityGroups) - { - Rules = rules; - NetworkSecurityGroups = networkSecurityGroups; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the rules to enforce - /// - [JsonProperty(PropertyName = "rules")] - public IList Rules { get; set; } - - /// - /// Gets or sets the Azure resource IDs of the effective network - /// security groups that will be updated with the created security - /// rules from the Adaptive Network Hardening rules - /// - [JsonProperty(PropertyName = "networkSecurityGroups")] - public IList NetworkSecurityGroups { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Rules == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Rules"); - } - if (NetworkSecurityGroups == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "NetworkSecurityGroups"); - } - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AdditionalData.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AdditionalData.cs deleted file mode 100644 index a052f822516a..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AdditionalData.cs +++ /dev/null @@ -1,35 +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.Security.Models -{ - using System.Linq; - - /// - /// Details of the sub-assessment - /// - public partial class AdditionalData - { - /// - /// Initializes a new instance of the AdditionalData class. - /// - public AdditionalData() - { - CustomInit(); - } - - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AdditionalWorkspaceDataType.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AdditionalWorkspaceDataType.cs deleted file mode 100644 index 676173dbafca..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AdditionalWorkspaceDataType.cs +++ /dev/null @@ -1,22 +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.Security.Models -{ - - /// - /// Defines values for AdditionalWorkspaceDataType. - /// - public static class AdditionalWorkspaceDataType - { - public const string Alerts = "Alerts"; - public const string RawEvents = "RawEvents"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AdditionalWorkspaceType.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AdditionalWorkspaceType.cs deleted file mode 100644 index 62a80cafd8d8..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AdditionalWorkspaceType.cs +++ /dev/null @@ -1,21 +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.Security.Models -{ - - /// - /// Defines values for AdditionalWorkspaceType. - /// - public static class AdditionalWorkspaceType - { - public const string Sentinel = "Sentinel"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AdditionalWorkspacesProperties.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AdditionalWorkspacesProperties.cs deleted file mode 100644 index 832e8fc248f4..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AdditionalWorkspacesProperties.cs +++ /dev/null @@ -1,73 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Properties of the additional workspaces. - /// - public partial class AdditionalWorkspacesProperties - { - /// - /// Initializes a new instance of the AdditionalWorkspacesProperties - /// class. - /// - public AdditionalWorkspacesProperties() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AdditionalWorkspacesProperties - /// class. - /// - /// Workspace resource id - /// Workspace type. Possible values include: - /// 'Sentinel' - /// List of data types sent to - /// workspace - public AdditionalWorkspacesProperties(string workspace = default(string), string type = default(string), IList dataTypes = default(IList)) - { - Workspace = workspace; - Type = type; - DataTypes = dataTypes; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets workspace resource id - /// - [JsonProperty(PropertyName = "workspace")] - public string Workspace { get; set; } - - /// - /// Gets or sets workspace type. Possible values include: 'Sentinel' - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; set; } - - /// - /// Gets or sets list of data types sent to workspace - /// - [JsonProperty(PropertyName = "dataTypes")] - public IList DataTypes { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AdvancedThreatProtectionSetting.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AdvancedThreatProtectionSetting.cs deleted file mode 100644 index fac496f0f512..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AdvancedThreatProtectionSetting.cs +++ /dev/null @@ -1,62 +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.Security.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - /// - /// The Advanced Threat Protection resource. - /// - [Rest.Serialization.JsonTransformation] - public partial class AdvancedThreatProtectionSetting : Resource - { - /// - /// Initializes a new instance of the AdvancedThreatProtectionSetting - /// class. - /// - public AdvancedThreatProtectionSetting() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AdvancedThreatProtectionSetting - /// class. - /// - /// Resource Id - /// Resource name - /// Resource type - /// Indicates whether Advanced Threat - /// Protection is enabled. - public AdvancedThreatProtectionSetting(string id = default(string), string name = default(string), string type = default(string), bool? isEnabled = default(bool?)) - : base(id, name, type) - { - IsEnabled = isEnabled; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets indicates whether Advanced Threat Protection is - /// enabled. - /// - [JsonProperty(PropertyName = "properties.isEnabled")] - public bool? IsEnabled { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Alert.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Alert.cs deleted file mode 100644 index 5fb148c23aa4..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Alert.cs +++ /dev/null @@ -1,295 +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.Security.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Security alert - /// - [Rest.Serialization.JsonTransformation] - public partial class Alert : Resource - { - /// - /// Initializes a new instance of the Alert class. - /// - public Alert() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the Alert class. - /// - /// Resource Id - /// Resource name - /// Resource type - /// Unique identifier for the detection logic - /// (all alert instances from the same detection logic will have the - /// same alertType). - /// Unique identifier for the - /// alert. - /// The name of Azure Security - /// Center pricing tier which powering this alert. Learn more: - /// https://docs.microsoft.com/en-us/azure/security-center/security-center-pricing - /// The display name of the - /// alert. - /// Description of the suspicious activity - /// that was detected. - /// The risk level of the threat that was - /// detected. Learn more: - /// https://docs.microsoft.com/en-us/azure/security-center/security-center-alerts-overview#how-are-alerts-classified. - /// Possible values include: 'Informational', 'Low', 'Medium', - /// 'High' - /// The kill chain related intent behind the - /// alert. For list of supported values, and explanations of Azure - /// Security Center's supported kill chain intents. Possible values - /// include: 'Unknown', 'PreAttack', 'InitialAccess', 'Persistence', - /// 'PrivilegeEscalation', 'DefenseEvasion', 'CredentialAccess', - /// 'Discovery', 'LateralMovement', 'Execution', 'Collection', - /// 'Exfiltration', 'CommandAndControl', 'Impact', 'Probing', - /// 'Exploitation' - /// The UTC time of the first event or - /// activity included in the alert in ISO8601 format. - /// The UTC time of the last event or activity - /// included in the alert in ISO8601 format. - /// The resource identifiers that can - /// be used to direct the alert to the right product exposure group - /// (tenant, workspace, subscription etc.). There can be multiple - /// identifiers of different type per alert. - /// Manual action items to take to - /// remediate the alert. - /// The name of the vendor that raises the - /// alert. - /// The life cycle status of the alert. Possible - /// values include: 'Active', 'Resolved', 'Dismissed' - /// Links related to the alert - /// A direct link to the alert page in Azure - /// Portal. - /// The UTC time the alert was generated - /// in ISO8601 format. - /// The name of the product which published - /// this alert (Azure Security Center, Azure ATP, Microsoft Defender - /// ATP, O365 ATP, MCAS, and so on). - /// The UTC processing end time of - /// the alert in ISO8601 format. - /// A list of entities related to the - /// alert. - /// This field determines whether the alert is - /// an incident (a compound grouping of several alerts) or a single - /// alert. - /// Key for corelating related alerts. - /// Alerts with the same correlation key considered to be - /// related. - /// Custom properties for the - /// alert. - /// The display name of the resource - /// most related to this alert. - public Alert(string id = default(string), string name = default(string), string type = default(string), string alertType = default(string), string systemAlertId = default(string), string productComponentName = default(string), string alertDisplayName = default(string), string description = default(string), string severity = default(string), string intent = default(string), System.DateTime? startTimeUtc = default(System.DateTime?), System.DateTime? endTimeUtc = default(System.DateTime?), IList resourceIdentifiers = default(IList), IList remediationSteps = default(IList), string vendorName = default(string), string status = default(string), IList> extendedLinks = default(IList>), string alertUri = default(string), System.DateTime? timeGeneratedUtc = default(System.DateTime?), string productName = default(string), System.DateTime? processingEndTimeUtc = default(System.DateTime?), IList entities = default(IList), bool? isIncident = default(bool?), string correlationKey = default(string), IDictionary extendedProperties = default(IDictionary), string compromisedEntity = default(string)) - : base(id, name, type) - { - AlertType = alertType; - SystemAlertId = systemAlertId; - ProductComponentName = productComponentName; - AlertDisplayName = alertDisplayName; - Description = description; - Severity = severity; - Intent = intent; - StartTimeUtc = startTimeUtc; - EndTimeUtc = endTimeUtc; - ResourceIdentifiers = resourceIdentifiers; - RemediationSteps = remediationSteps; - VendorName = vendorName; - Status = status; - ExtendedLinks = extendedLinks; - AlertUri = alertUri; - TimeGeneratedUtc = timeGeneratedUtc; - ProductName = productName; - ProcessingEndTimeUtc = processingEndTimeUtc; - Entities = entities; - IsIncident = isIncident; - CorrelationKey = correlationKey; - ExtendedProperties = extendedProperties; - CompromisedEntity = compromisedEntity; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets unique identifier for the detection logic (all alert instances - /// from the same detection logic will have the same alertType). - /// - [JsonProperty(PropertyName = "properties.alertType")] - public string AlertType { get; private set; } - - /// - /// Gets unique identifier for the alert. - /// - [JsonProperty(PropertyName = "properties.systemAlertId")] - public string SystemAlertId { get; private set; } - - /// - /// Gets the name of Azure Security Center pricing tier which powering - /// this alert. Learn more: - /// https://docs.microsoft.com/en-us/azure/security-center/security-center-pricing - /// - [JsonProperty(PropertyName = "properties.productComponentName")] - public string ProductComponentName { get; private set; } - - /// - /// Gets the display name of the alert. - /// - [JsonProperty(PropertyName = "properties.alertDisplayName")] - public string AlertDisplayName { get; private set; } - - /// - /// Gets description of the suspicious activity that was detected. - /// - [JsonProperty(PropertyName = "properties.description")] - public string Description { get; private set; } - - /// - /// Gets the risk level of the threat that was detected. Learn more: - /// https://docs.microsoft.com/en-us/azure/security-center/security-center-alerts-overview#how-are-alerts-classified. - /// Possible values include: 'Informational', 'Low', 'Medium', 'High' - /// - [JsonProperty(PropertyName = "properties.severity")] - public string Severity { get; private set; } - - /// - /// Gets the kill chain related intent behind the alert. For list of - /// supported values, and explanations of Azure Security Center's - /// supported kill chain intents. Possible values include: 'Unknown', - /// 'PreAttack', 'InitialAccess', 'Persistence', 'PrivilegeEscalation', - /// 'DefenseEvasion', 'CredentialAccess', 'Discovery', - /// 'LateralMovement', 'Execution', 'Collection', 'Exfiltration', - /// 'CommandAndControl', 'Impact', 'Probing', 'Exploitation' - /// - [JsonProperty(PropertyName = "properties.intent")] - public string Intent { get; private set; } - - /// - /// Gets the UTC time of the first event or activity included in the - /// alert in ISO8601 format. - /// - [JsonProperty(PropertyName = "properties.startTimeUtc")] - public System.DateTime? StartTimeUtc { get; private set; } - - /// - /// Gets the UTC time of the last event or activity included in the - /// alert in ISO8601 format. - /// - [JsonProperty(PropertyName = "properties.endTimeUtc")] - public System.DateTime? EndTimeUtc { get; private set; } - - /// - /// Gets the resource identifiers that can be used to direct the alert - /// to the right product exposure group (tenant, workspace, - /// subscription etc.). There can be multiple identifiers of different - /// type per alert. - /// - [JsonProperty(PropertyName = "properties.resourceIdentifiers")] - public IList ResourceIdentifiers { get; private set; } - - /// - /// Gets manual action items to take to remediate the alert. - /// - [JsonProperty(PropertyName = "properties.remediationSteps")] - public IList RemediationSteps { get; private set; } - - /// - /// Gets the name of the vendor that raises the alert. - /// - [JsonProperty(PropertyName = "properties.vendorName")] - public string VendorName { get; private set; } - - /// - /// Gets the life cycle status of the alert. Possible values include: - /// 'Active', 'Resolved', 'Dismissed' - /// - [JsonProperty(PropertyName = "properties.status")] - public string Status { get; private set; } - - /// - /// Gets links related to the alert - /// - [JsonProperty(PropertyName = "properties.extendedLinks")] - public IList> ExtendedLinks { get; private set; } - - /// - /// Gets a direct link to the alert page in Azure Portal. - /// - [JsonProperty(PropertyName = "properties.alertUri")] - public string AlertUri { get; private set; } - - /// - /// Gets the UTC time the alert was generated in ISO8601 format. - /// - [JsonProperty(PropertyName = "properties.timeGeneratedUtc")] - public System.DateTime? TimeGeneratedUtc { get; private set; } - - /// - /// Gets the name of the product which published this alert (Azure - /// Security Center, Azure ATP, Microsoft Defender ATP, O365 ATP, MCAS, - /// and so on). - /// - [JsonProperty(PropertyName = "properties.productName")] - public string ProductName { get; private set; } - - /// - /// Gets the UTC processing end time of the alert in ISO8601 format. - /// - [JsonProperty(PropertyName = "properties.processingEndTimeUtc")] - public System.DateTime? ProcessingEndTimeUtc { get; private set; } - - /// - /// Gets a list of entities related to the alert. - /// - [JsonProperty(PropertyName = "properties.entities")] - public IList Entities { get; private set; } - - /// - /// Gets this field determines whether the alert is an incident (a - /// compound grouping of several alerts) or a single alert. - /// - [JsonProperty(PropertyName = "properties.isIncident")] - public bool? IsIncident { get; private set; } - - /// - /// Gets key for corelating related alerts. Alerts with the same - /// correlation key considered to be related. - /// - [JsonProperty(PropertyName = "properties.correlationKey")] - public string CorrelationKey { get; private set; } - - /// - /// Gets or sets custom properties for the alert. - /// - [JsonProperty(PropertyName = "properties.extendedProperties")] - public IDictionary ExtendedProperties { get; set; } - - /// - /// Gets the display name of the resource most related to this alert. - /// - [JsonProperty(PropertyName = "properties.compromisedEntity")] - public string CompromisedEntity { get; private set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AlertEntity.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AlertEntity.cs deleted file mode 100644 index 538b3dceaaee..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AlertEntity.cs +++ /dev/null @@ -1,63 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Changing set of properties depending on the entity type. - /// - public partial class AlertEntity - { - /// - /// Initializes a new instance of the AlertEntity class. - /// - public AlertEntity() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AlertEntity class. - /// - /// Unmatched properties from the - /// message are deserialized this collection - /// Type of entity - public AlertEntity(IDictionary additionalProperties = default(IDictionary), string type = default(string)) - { - AdditionalProperties = additionalProperties; - Type = type; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets unmatched properties from the message are deserialized - /// this collection - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - - /// - /// Gets type of entity - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AlertNotifications.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AlertNotifications.cs deleted file mode 100644 index 8fc97ff0f268..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AlertNotifications.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.Security.Models -{ - - /// - /// Defines values for AlertNotifications. - /// - public static class AlertNotifications - { - /// - /// Get notifications on new alerts - /// - public const string On = "On"; - /// - /// Don't get notifications on new alerts - /// - public const string Off = "Off"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AlertSeverity.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AlertSeverity.cs deleted file mode 100644 index f54b8f9ca28a..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AlertSeverity.cs +++ /dev/null @@ -1,36 +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.Security.Models -{ - - /// - /// Defines values for AlertSeverity. - /// - public static class AlertSeverity - { - /// - /// Informational - /// - public const string Informational = "Informational"; - /// - /// Low - /// - public const string Low = "Low"; - /// - /// Medium - /// - public const string Medium = "Medium"; - /// - /// High - /// - public const string High = "High"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AlertSimulatorBundlesRequestProperties.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AlertSimulatorBundlesRequestProperties.cs deleted file mode 100644 index 04aa34c27f51..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AlertSimulatorBundlesRequestProperties.cs +++ /dev/null @@ -1,59 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Simulate alerts according to this bundles. - /// - [Newtonsoft.Json.JsonObject("Bundles")] - public partial class AlertSimulatorBundlesRequestProperties : AlertSimulatorRequestProperties - { - /// - /// Initializes a new instance of the - /// AlertSimulatorBundlesRequestProperties class. - /// - public AlertSimulatorBundlesRequestProperties() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// AlertSimulatorBundlesRequestProperties class. - /// - /// Unmatched properties from the - /// message are deserialized this collection - /// Bundles list. - public AlertSimulatorBundlesRequestProperties(IDictionary additionalProperties = default(IDictionary), IList bundles = default(IList)) - : base(additionalProperties) - { - Bundles = bundles; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets bundles list. - /// - [JsonProperty(PropertyName = "bundles")] - public IList Bundles { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AlertSimulatorRequestBody.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AlertSimulatorRequestBody.cs deleted file mode 100644 index c8bbb95a1506..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AlertSimulatorRequestBody.cs +++ /dev/null @@ -1,51 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Alert Simulator request body. - /// - public partial class AlertSimulatorRequestBody - { - /// - /// Initializes a new instance of the AlertSimulatorRequestBody class. - /// - public AlertSimulatorRequestBody() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AlertSimulatorRequestBody class. - /// - /// Alert Simulator request body data. - public AlertSimulatorRequestBody(AlertSimulatorRequestProperties properties = default(AlertSimulatorRequestProperties)) - { - Properties = properties; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets alert Simulator request body data. - /// - [JsonProperty(PropertyName = "properties")] - public AlertSimulatorRequestProperties Properties { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AlertSimulatorRequestProperties.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AlertSimulatorRequestProperties.cs deleted file mode 100644 index eed55ecbc415..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AlertSimulatorRequestProperties.cs +++ /dev/null @@ -1,57 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Describes properties of an alert simulation request - /// - public partial class AlertSimulatorRequestProperties - { - /// - /// Initializes a new instance of the AlertSimulatorRequestProperties - /// class. - /// - public AlertSimulatorRequestProperties() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AlertSimulatorRequestProperties - /// class. - /// - /// Unmatched properties from the - /// message are deserialized this collection - public AlertSimulatorRequestProperties(IDictionary additionalProperties = default(IDictionary)) - { - AdditionalProperties = additionalProperties; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets unmatched properties from the message are deserialized - /// this collection - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AlertStatus.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AlertStatus.cs deleted file mode 100644 index a71003043b70..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AlertStatus.cs +++ /dev/null @@ -1,33 +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.Security.Models -{ - - /// - /// Defines values for AlertStatus. - /// - public static class AlertStatus - { - /// - /// An alert which doesn't specify a value is assigned the status - /// 'Active' - /// - public const string Active = "Active"; - /// - /// Alert closed after handling - /// - public const string Resolved = "Resolved"; - /// - /// Alert dismissed as false positive - /// - public const string Dismissed = "Dismissed"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AlertSyncSettings.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AlertSyncSettings.cs deleted file mode 100644 index 8137eb5e0ecc..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AlertSyncSettings.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.Security.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Represents an alert sync setting - /// - [Rest.Serialization.JsonTransformation] - public partial class AlertSyncSettings : Setting - { - /// - /// Initializes a new instance of the AlertSyncSettings class. - /// - public AlertSyncSettings() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AlertSyncSettings class. - /// - /// Is the alert sync setting enabled - /// Resource Id - /// Resource name - /// Resource type - public AlertSyncSettings(bool enabled, string id = default(string), string name = default(string), string type = default(string)) - : base(id, name, type) - { - Enabled = enabled; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets is the alert sync setting enabled - /// - [JsonProperty(PropertyName = "properties.enabled")] - public bool Enabled { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - //Nothing to validate - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AlertsSuppressionRule.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AlertsSuppressionRule.cs deleted file mode 100644 index 286a4e6ee6b3..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AlertsSuppressionRule.cs +++ /dev/null @@ -1,137 +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.Security.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Describes the suppression rule - /// - [Rest.Serialization.JsonTransformation] - public partial class AlertsSuppressionRule : Resource - { - /// - /// Initializes a new instance of the AlertsSuppressionRule class. - /// - public AlertsSuppressionRule() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AlertsSuppressionRule class. - /// - /// Type of the alert to automatically - /// suppress. For all alert types, use '*' - /// The reason for dismissing the alert - /// Possible states of the rule. Possible values - /// include: 'Enabled', 'Disabled', 'Expired' - /// Resource Id - /// Resource name - /// Resource type - /// The last time this rule was - /// modified - /// Expiration date of the rule, if - /// value is not provided or provided as null this field will default - /// to the maximum allowed expiration date. - /// Any comment regarding the rule - /// The suppression - /// conditions - public AlertsSuppressionRule(string alertType, string reason, RuleState state, string id = default(string), string name = default(string), string type = default(string), System.DateTime? lastModifiedUtc = default(System.DateTime?), System.DateTime? expirationDateUtc = default(System.DateTime?), string comment = default(string), SuppressionAlertsScope suppressionAlertsScope = default(SuppressionAlertsScope)) - : base(id, name, type) - { - AlertType = alertType; - LastModifiedUtc = lastModifiedUtc; - ExpirationDateUtc = expirationDateUtc; - Reason = reason; - State = state; - Comment = comment; - SuppressionAlertsScope = suppressionAlertsScope; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets type of the alert to automatically suppress. For all - /// alert types, use '*' - /// - [JsonProperty(PropertyName = "properties.alertType")] - public string AlertType { get; set; } - - /// - /// Gets the last time this rule was modified - /// - [JsonProperty(PropertyName = "properties.lastModifiedUtc")] - public System.DateTime? LastModifiedUtc { get; private set; } - - /// - /// Gets or sets expiration date of the rule, if value is not provided - /// or provided as null this field will default to the maximum allowed - /// expiration date. - /// - [JsonProperty(PropertyName = "properties.expirationDateUtc")] - public System.DateTime? ExpirationDateUtc { get; set; } - - /// - /// Gets or sets the reason for dismissing the alert - /// - [JsonProperty(PropertyName = "properties.reason")] - public string Reason { get; set; } - - /// - /// Gets or sets possible states of the rule. Possible values include: - /// 'Enabled', 'Disabled', 'Expired' - /// - [JsonProperty(PropertyName = "properties.state")] - public RuleState State { get; set; } - - /// - /// Gets or sets any comment regarding the rule - /// - [JsonProperty(PropertyName = "properties.comment")] - public string Comment { get; set; } - - /// - /// Gets or sets the suppression conditions - /// - [JsonProperty(PropertyName = "properties.suppressionAlertsScope")] - public SuppressionAlertsScope SuppressionAlertsScope { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (AlertType == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "AlertType"); - } - if (Reason == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Reason"); - } - if (SuppressionAlertsScope != null) - { - SuppressionAlertsScope.Validate(); - } - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AlertsToAdmins.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AlertsToAdmins.cs deleted file mode 100644 index 56987d2649e6..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AlertsToAdmins.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.Security.Models -{ - - /// - /// Defines values for AlertsToAdmins. - /// - public static class AlertsToAdmins - { - /// - /// Send notification on new alerts to the subscription's admins - /// - public const string On = "On"; - /// - /// Don't send notification on new alerts to the subscription's admins - /// - public const string Off = "Off"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AllowedConnectionsResource.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AllowedConnectionsResource.cs deleted file mode 100644 index 698a71888509..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AllowedConnectionsResource.cs +++ /dev/null @@ -1,101 +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.Security.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The resource whose properties describes the allowed traffic between - /// Azure resources - /// - [Rest.Serialization.JsonTransformation] - public partial class AllowedConnectionsResource - { - /// - /// Initializes a new instance of the AllowedConnectionsResource class. - /// - public AllowedConnectionsResource() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AllowedConnectionsResource class. - /// - /// Resource Id - /// Resource name - /// Resource type - /// Location where the resource is - /// stored - /// The UTC time on which the allowed - /// connections resource was calculated - /// List of connectable - /// resources - public AllowedConnectionsResource(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.DateTime? calculatedDateTime = default(System.DateTime?), IList connectableResources = default(IList)) - { - Id = id; - Name = name; - Type = type; - Location = location; - CalculatedDateTime = calculatedDateTime; - ConnectableResources = connectableResources; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets resource Id - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } - - /// - /// Gets resource name - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } - - /// - /// Gets resource type - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } - - /// - /// Gets location where the resource is stored - /// - [JsonProperty(PropertyName = "location")] - public string Location { get; private set; } - - /// - /// Gets the UTC time on which the allowed connections resource was - /// calculated - /// - [JsonProperty(PropertyName = "properties.calculatedDateTime")] - public System.DateTime? CalculatedDateTime { get; private set; } - - /// - /// Gets list of connectable resources - /// - [JsonProperty(PropertyName = "properties.connectableResources")] - public IList ConnectableResources { get; private set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AllowlistCustomAlertRule.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AllowlistCustomAlertRule.cs deleted file mode 100644 index 4f1823712b08..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AllowlistCustomAlertRule.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.Security.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// A custom alert rule that checks if a value (depends on the custom alert - /// type) is allowed. - /// - public partial class AllowlistCustomAlertRule : ListCustomAlertRule - { - /// - /// Initializes a new instance of the AllowlistCustomAlertRule class. - /// - public AllowlistCustomAlertRule() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AllowlistCustomAlertRule class. - /// - /// Status of the custom alert. - /// The values to allow. The format of - /// the values depends on the rule type. - /// The display name of the custom - /// alert. - /// The description of the custom - /// alert. - /// The value type of the items in the list. - /// Possible values include: 'IpCidr', 'String' - public AllowlistCustomAlertRule(bool isEnabled, IList allowlistValues, string displayName = default(string), string description = default(string), string valueType = default(string)) - : base(isEnabled, displayName, description, valueType) - { - AllowlistValues = allowlistValues; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the values to allow. The format of the values depends - /// on the rule type. - /// - [JsonProperty(PropertyName = "allowlistValues")] - public IList AllowlistValues { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - if (AllowlistValues == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "AllowlistValues"); - } - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AmqpC2DMessagesNotInAllowedRange.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AmqpC2DMessagesNotInAllowedRange.cs deleted file mode 100644 index 1ec0be41d31f..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AmqpC2DMessagesNotInAllowedRange.cs +++ /dev/null @@ -1,65 +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.Security.Models -{ - using System.Linq; - - /// - /// Number of cloud to device messages (AMQP protocol) is not in allowed - /// range. - /// - public partial class AmqpC2DMessagesNotInAllowedRange : TimeWindowCustomAlertRule - { - /// - /// Initializes a new instance of the AmqpC2DMessagesNotInAllowedRange - /// class. - /// - public AmqpC2DMessagesNotInAllowedRange() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AmqpC2DMessagesNotInAllowedRange - /// class. - /// - /// Status of the custom alert. - /// The minimum threshold. - /// The maximum threshold. - /// The time window size in iso8601 - /// format. - /// The display name of the custom - /// alert. - /// The description of the custom - /// alert. - public AmqpC2DMessagesNotInAllowedRange(bool isEnabled, int minThreshold, int maxThreshold, System.TimeSpan timeWindowSize, string displayName = default(string), string description = default(string)) - : base(isEnabled, minThreshold, maxThreshold, timeWindowSize, displayName, description) - { - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AmqpC2DRejectedMessagesNotInAllowedRange.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AmqpC2DRejectedMessagesNotInAllowedRange.cs deleted file mode 100644 index 27ca3c49286e..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AmqpC2DRejectedMessagesNotInAllowedRange.cs +++ /dev/null @@ -1,65 +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.Security.Models -{ - using System.Linq; - - /// - /// Number of rejected cloud to device messages (AMQP protocol) is not in - /// allowed range. - /// - public partial class AmqpC2DRejectedMessagesNotInAllowedRange : TimeWindowCustomAlertRule - { - /// - /// Initializes a new instance of the - /// AmqpC2DRejectedMessagesNotInAllowedRange class. - /// - public AmqpC2DRejectedMessagesNotInAllowedRange() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// AmqpC2DRejectedMessagesNotInAllowedRange class. - /// - /// Status of the custom alert. - /// The minimum threshold. - /// The maximum threshold. - /// The time window size in iso8601 - /// format. - /// The display name of the custom - /// alert. - /// The description of the custom - /// alert. - public AmqpC2DRejectedMessagesNotInAllowedRange(bool isEnabled, int minThreshold, int maxThreshold, System.TimeSpan timeWindowSize, string displayName = default(string), string description = default(string)) - : base(isEnabled, minThreshold, maxThreshold, timeWindowSize, displayName, description) - { - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AmqpD2CMessagesNotInAllowedRange.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AmqpD2CMessagesNotInAllowedRange.cs deleted file mode 100644 index 8061c59a72ce..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AmqpD2CMessagesNotInAllowedRange.cs +++ /dev/null @@ -1,65 +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.Security.Models -{ - using System.Linq; - - /// - /// Number of device to cloud messages (AMQP protocol) is not in allowed - /// range. - /// - public partial class AmqpD2CMessagesNotInAllowedRange : TimeWindowCustomAlertRule - { - /// - /// Initializes a new instance of the AmqpD2CMessagesNotInAllowedRange - /// class. - /// - public AmqpD2CMessagesNotInAllowedRange() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AmqpD2CMessagesNotInAllowedRange - /// class. - /// - /// Status of the custom alert. - /// The minimum threshold. - /// The maximum threshold. - /// The time window size in iso8601 - /// format. - /// The display name of the custom - /// alert. - /// The description of the custom - /// alert. - public AmqpD2CMessagesNotInAllowedRange(bool isEnabled, int minThreshold, int maxThreshold, System.TimeSpan timeWindowSize, string displayName = default(string), string description = default(string)) - : base(isEnabled, minThreshold, maxThreshold, timeWindowSize, displayName, description) - { - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AssessmentLinks.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AssessmentLinks.cs deleted file mode 100644 index 95ac7c0a98ef..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AssessmentLinks.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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Links relevant to the assessment - /// - public partial class AssessmentLinks - { - /// - /// Initializes a new instance of the AssessmentLinks class. - /// - public AssessmentLinks() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AssessmentLinks class. - /// - /// Link to assessment in Azure - /// Portal - public AssessmentLinks(string azurePortalUri = default(string)) - { - AzurePortalUri = azurePortalUri; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets link to assessment in Azure Portal - /// - [JsonProperty(PropertyName = "azurePortalUri")] - public string AzurePortalUri { get; private set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AssessmentStatus.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AssessmentStatus.cs deleted file mode 100644 index 10c8e8539eac..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AssessmentStatus.cs +++ /dev/null @@ -1,87 +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.Security.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// The result of the assessment - /// - public partial class AssessmentStatus - { - /// - /// Initializes a new instance of the AssessmentStatus class. - /// - public AssessmentStatus() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AssessmentStatus class. - /// - /// Programmatic code for the status of the - /// assessment. Possible values include: 'Healthy', 'Unhealthy', - /// 'NotApplicable' - /// Programmatic code for the cause of the - /// assessment status - /// Human readable description of the - /// assessment status - public AssessmentStatus(string code, string cause = default(string), string description = default(string)) - { - Code = code; - Cause = cause; - Description = description; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets programmatic code for the status of the assessment. - /// Possible values include: 'Healthy', 'Unhealthy', 'NotApplicable' - /// - [JsonProperty(PropertyName = "code")] - public string Code { get; set; } - - /// - /// Gets or sets programmatic code for the cause of the assessment - /// status - /// - [JsonProperty(PropertyName = "cause")] - public string Cause { get; set; } - - /// - /// Gets or sets human readable description of the assessment status - /// - [JsonProperty(PropertyName = "description")] - public string Description { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Code == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Code"); - } - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AssessmentStatusCode.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AssessmentStatusCode.cs deleted file mode 100644 index c886cae05ca2..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AssessmentStatusCode.cs +++ /dev/null @@ -1,32 +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.Security.Models -{ - - /// - /// Defines values for AssessmentStatusCode. - /// - public static class AssessmentStatusCode - { - /// - /// The resource is healthy - /// - public const string Healthy = "Healthy"; - /// - /// The resource has a security issue that needs to be addressed - /// - public const string Unhealthy = "Unhealthy"; - /// - /// Assessment for this resource did not happen - /// - public const string NotApplicable = "NotApplicable"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AssessmentType.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AssessmentType.cs deleted file mode 100644 index 7bc9c94154f4..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AssessmentType.cs +++ /dev/null @@ -1,39 +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.Security.Models -{ - - /// - /// Defines values for AssessmentType. - /// - public static class AssessmentType - { - /// - /// Azure Security Center managed assessments - /// - public const string BuiltIn = "BuiltIn"; - /// - /// User defined policies that are automatically ingested from Azure - /// Policy to Azure Security Center - /// - public const string CustomPolicy = "CustomPolicy"; - /// - /// User assessments pushed directly by the user or other third party - /// to Azure Security Center - /// - public const string CustomerManaged = "CustomerManaged"; - /// - /// An assessment that was created by a verified 3rd party if the user - /// connected it to ASC - /// - public const string VerifiedPartner = "VerifiedPartner"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AtaExternalSecuritySolution.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AtaExternalSecuritySolution.cs deleted file mode 100644 index e4c37c3b9e05..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AtaExternalSecuritySolution.cs +++ /dev/null @@ -1,59 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Represents an ATA security solution which sends logs to an OMS - /// workspace - /// - [Newtonsoft.Json.JsonObject("ATA")] - public partial class AtaExternalSecuritySolution : ExternalSecuritySolution - { - /// - /// Initializes a new instance of the AtaExternalSecuritySolution - /// class. - /// - public AtaExternalSecuritySolution() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AtaExternalSecuritySolution - /// class. - /// - /// Resource Id - /// Resource name - /// Resource type - /// Location where the resource is - /// stored - public AtaExternalSecuritySolution(string id = default(string), string name = default(string), string type = default(string), string location = default(string), AtaSolutionProperties properties = default(AtaSolutionProperties)) - : base(id, name, type, location) - { - Properties = properties; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "properties")] - public AtaSolutionProperties Properties { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AtaSolutionProperties.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AtaSolutionProperties.cs deleted file mode 100644 index 482a89428aee..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AtaSolutionProperties.cs +++ /dev/null @@ -1,54 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The external security solution properties for ATA solutions - /// - public partial class AtaSolutionProperties : ExternalSecuritySolutionProperties - { - /// - /// Initializes a new instance of the AtaSolutionProperties class. - /// - public AtaSolutionProperties() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AtaSolutionProperties class. - /// - /// Unmatched properties from the - /// message are deserialized this collection - public AtaSolutionProperties(IDictionary additionalProperties = default(IDictionary), string deviceVendor = default(string), string deviceType = default(string), ConnectedWorkspace workspace = default(ConnectedWorkspace), string lastEventReceived = default(string)) - : base(additionalProperties, deviceVendor, deviceType, workspace) - { - LastEventReceived = lastEventReceived; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "lastEventReceived")] - public string LastEventReceived { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AuthenticationDetailsProperties.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AuthenticationDetailsProperties.cs deleted file mode 100644 index 4e15389c098a..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AuthenticationDetailsProperties.cs +++ /dev/null @@ -1,67 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Settings for cloud authentication management - /// - public partial class AuthenticationDetailsProperties - { - /// - /// Initializes a new instance of the AuthenticationDetailsProperties - /// class. - /// - public AuthenticationDetailsProperties() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AuthenticationDetailsProperties - /// class. - /// - /// State of the - /// multi-cloud connector. Possible values include: 'Valid', 'Invalid', - /// 'Expired', 'IncorrectPolicy' - /// The permissions detected in the - /// cloud account. - public AuthenticationDetailsProperties(string authenticationProvisioningState = default(string), IList grantedPermissions = default(IList)) - { - AuthenticationProvisioningState = authenticationProvisioningState; - GrantedPermissions = grantedPermissions; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets state of the multi-cloud connector. Possible values include: - /// 'Valid', 'Invalid', 'Expired', 'IncorrectPolicy' - /// - [JsonProperty(PropertyName = "authenticationProvisioningState")] - public string AuthenticationProvisioningState { get; private set; } - - /// - /// Gets the permissions detected in the cloud account. - /// - [JsonProperty(PropertyName = "grantedPermissions")] - public IList GrantedPermissions { get; private set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AuthenticationProvisioningState.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AuthenticationProvisioningState.cs deleted file mode 100644 index 7db7aa930cd6..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AuthenticationProvisioningState.cs +++ /dev/null @@ -1,36 +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.Security.Models -{ - - /// - /// Defines values for AuthenticationProvisioningState. - /// - public static class AuthenticationProvisioningState - { - /// - /// Valid connector - /// - public const string Valid = "Valid"; - /// - /// Invalid connector - /// - public const string Invalid = "Invalid"; - /// - /// the connection has expired - /// - public const string Expired = "Expired"; - /// - /// Incorrect policy of the connector - /// - public const string IncorrectPolicy = "IncorrectPolicy"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AutoProvision.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AutoProvision.cs deleted file mode 100644 index 4f43de04f692..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AutoProvision.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.Security.Models -{ - - /// - /// Defines values for AutoProvision. - /// - public static class AutoProvision - { - /// - /// Install missing security agent on VMs automatically - /// - public const string On = "On"; - /// - /// Do not install security agent on the VMs automatically - /// - public const string Off = "Off"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AutoProvisioningSetting.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AutoProvisioningSetting.cs deleted file mode 100644 index c91262555845..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AutoProvisioningSetting.cs +++ /dev/null @@ -1,74 +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.Security.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Auto provisioning setting - /// - [Rest.Serialization.JsonTransformation] - public partial class AutoProvisioningSetting : Resource - { - /// - /// Initializes a new instance of the AutoProvisioningSetting class. - /// - public AutoProvisioningSetting() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AutoProvisioningSetting class. - /// - /// Describes what kind of security agent - /// provisioning action to take. Possible values include: 'On', - /// 'Off' - /// Resource Id - /// Resource name - /// Resource type - public AutoProvisioningSetting(string autoProvision, string id = default(string), string name = default(string), string type = default(string)) - : base(id, name, type) - { - AutoProvision = autoProvision; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets describes what kind of security agent provisioning - /// action to take. Possible values include: 'On', 'Off' - /// - [JsonProperty(PropertyName = "properties.autoProvision")] - public string AutoProvision { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (AutoProvision == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "AutoProvision"); - } - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Automation.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Automation.cs deleted file mode 100644 index 779e4c004182..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Automation.cs +++ /dev/null @@ -1,113 +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.Security.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The security automation resource. - /// - [Rest.Serialization.JsonTransformation] - public partial class Automation : TrackedResource - { - /// - /// Initializes a new instance of the Automation class. - /// - public Automation() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the Automation class. - /// - /// Resource Id - /// Resource name - /// Resource type - /// Location where the resource is - /// stored - /// Kind of the resource - /// Entity tag is used for comparing two or more - /// entities from the same requested resource. - /// A list of key value pairs that describe the - /// resource. - /// The security automation - /// description. - /// Indicates whether the security automation - /// is enabled. - /// A collection of scopes on which the security - /// automations logic is applied. Supported scopes are the subscription - /// itself or a resource group under that subscription. The automation - /// will only apply on defined scopes. - /// A collection of the source event types which - /// evaluate the security automation set of rules. - /// A collection of the actions which are - /// triggered if all the configured rules evaluations, within at least - /// one rule set, are true. - public Automation(string id = default(string), string name = default(string), string type = default(string), string location = default(string), string kind = default(string), string etag = default(string), IDictionary tags = default(IDictionary), string description = default(string), bool? isEnabled = default(bool?), IList scopes = default(IList), IList sources = default(IList), IList actions = default(IList)) - : base(id, name, type, location, kind, etag, tags) - { - Description = description; - IsEnabled = isEnabled; - Scopes = scopes; - Sources = sources; - Actions = actions; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the security automation description. - /// - [JsonProperty(PropertyName = "properties.description")] - public string Description { get; set; } - - /// - /// Gets or sets indicates whether the security automation is enabled. - /// - [JsonProperty(PropertyName = "properties.isEnabled")] - public bool? IsEnabled { get; set; } - - /// - /// Gets or sets a collection of scopes on which the security - /// automations logic is applied. Supported scopes are the subscription - /// itself or a resource group under that subscription. The automation - /// will only apply on defined scopes. - /// - [JsonProperty(PropertyName = "properties.scopes")] - public IList Scopes { get; set; } - - /// - /// Gets or sets a collection of the source event types which evaluate - /// the security automation set of rules. - /// - [JsonProperty(PropertyName = "properties.sources")] - public IList Sources { get; set; } - - /// - /// Gets or sets a collection of the actions which are triggered if all - /// the configured rules evaluations, within at least one rule set, are - /// true. - /// - [JsonProperty(PropertyName = "properties.actions")] - public IList Actions { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AutomationAction.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AutomationAction.cs deleted file mode 100644 index 921ecb8ffaf1..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AutomationAction.cs +++ /dev/null @@ -1,35 +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.Security.Models -{ - using System.Linq; - - /// - /// The action that should be triggered. - /// - public partial class AutomationAction - { - /// - /// Initializes a new instance of the AutomationAction class. - /// - public AutomationAction() - { - CustomInit(); - } - - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AutomationActionEventHub.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AutomationActionEventHub.cs deleted file mode 100644 index 43699c6f00ff..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AutomationActionEventHub.cs +++ /dev/null @@ -1,74 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// The target Event Hub to which event data will be exported. To learn - /// more about Security Center continuous export capabilities, visit - /// https://aka.ms/ASCExportLearnMore - /// - [Newtonsoft.Json.JsonObject("EventHub")] - public partial class AutomationActionEventHub : AutomationAction - { - /// - /// Initializes a new instance of the AutomationActionEventHub class. - /// - public AutomationActionEventHub() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AutomationActionEventHub class. - /// - /// The target Event Hub Azure - /// Resource ID. - /// The target Event Hub SAS policy - /// name. - /// The target Event Hub connection - /// string (it will not be included in any response). - public AutomationActionEventHub(string eventHubResourceId = default(string), string sasPolicyName = default(string), string connectionString = default(string)) - { - EventHubResourceId = eventHubResourceId; - SasPolicyName = sasPolicyName; - ConnectionString = connectionString; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the target Event Hub Azure Resource ID. - /// - [JsonProperty(PropertyName = "eventHubResourceId")] - public string EventHubResourceId { get; set; } - - /// - /// Gets the target Event Hub SAS policy name. - /// - [JsonProperty(PropertyName = "sasPolicyName")] - public string SasPolicyName { get; private set; } - - /// - /// Gets or sets the target Event Hub connection string (it will not be - /// included in any response). - /// - [JsonProperty(PropertyName = "connectionString")] - public string ConnectionString { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AutomationActionLogicApp.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AutomationActionLogicApp.cs deleted file mode 100644 index 241bc0dd39ae..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AutomationActionLogicApp.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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// The logic app action that should be triggered. To learn more about - /// Security Center's Workflow Automation capabilities, visit - /// https://aka.ms/ASCWorkflowAutomationLearnMore - /// - [Newtonsoft.Json.JsonObject("LogicApp")] - public partial class AutomationActionLogicApp : AutomationAction - { - /// - /// Initializes a new instance of the AutomationActionLogicApp class. - /// - public AutomationActionLogicApp() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AutomationActionLogicApp class. - /// - /// The triggered Logic App Azure - /// Resource ID. This can also reside on other subscriptions, given - /// that you have permissions to trigger the Logic App - /// The Logic App trigger URI endpoint (it will not - /// be included in any response). - public AutomationActionLogicApp(string logicAppResourceId = default(string), string uri = default(string)) - { - LogicAppResourceId = logicAppResourceId; - Uri = uri; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the triggered Logic App Azure Resource ID. This can - /// also reside on other subscriptions, given that you have permissions - /// to trigger the Logic App - /// - [JsonProperty(PropertyName = "logicAppResourceId")] - public string LogicAppResourceId { get; set; } - - /// - /// Gets or sets the Logic App trigger URI endpoint (it will not be - /// included in any response). - /// - [JsonProperty(PropertyName = "uri")] - public string Uri { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AutomationActionWorkspace.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AutomationActionWorkspace.cs deleted file mode 100644 index ba4e8d9d8d32..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AutomationActionWorkspace.cs +++ /dev/null @@ -1,61 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// The Log Analytics Workspace to which event data will be exported. - /// Security alerts data will reside in the 'SecurityAlert' table and the - /// assessments data will reside in the 'SecurityRecommendation' table - /// (under the 'Security'/'SecurityCenterFree' solutions). Note that in - /// order to view the data in the workspace, the Security Center Log - /// Analytics free/standard solution needs to be enabled on that workspace. - /// To learn more about Security Center continuous export capabilities, - /// visit https://aka.ms/ASCExportLearnMore - /// - [Newtonsoft.Json.JsonObject("Workspace")] - public partial class AutomationActionWorkspace : AutomationAction - { - /// - /// Initializes a new instance of the AutomationActionWorkspace class. - /// - public AutomationActionWorkspace() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AutomationActionWorkspace class. - /// - /// The fully qualified Log Analytics - /// Workspace Azure Resource ID. - public AutomationActionWorkspace(string workspaceResourceId = default(string)) - { - WorkspaceResourceId = workspaceResourceId; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the fully qualified Log Analytics Workspace Azure - /// Resource ID. - /// - [JsonProperty(PropertyName = "workspaceResourceId")] - public string WorkspaceResourceId { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AutomationRuleSet.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AutomationRuleSet.cs deleted file mode 100644 index 894960364084..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AutomationRuleSet.cs +++ /dev/null @@ -1,53 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// A rule set which evaluates all its rules upon an event interception. - /// Only when all the included rules in the rule set will be evaluated as - /// 'true', will the event trigger the defined actions. - /// - public partial class AutomationRuleSet - { - /// - /// Initializes a new instance of the AutomationRuleSet class. - /// - public AutomationRuleSet() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AutomationRuleSet class. - /// - public AutomationRuleSet(IList rules = default(IList)) - { - Rules = rules; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "rules")] - public IList Rules { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AutomationScope.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AutomationScope.cs deleted file mode 100644 index ced4486980ea..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AutomationScope.cs +++ /dev/null @@ -1,64 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// A single automation scope. - /// - public partial class AutomationScope - { - /// - /// Initializes a new instance of the AutomationScope class. - /// - public AutomationScope() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AutomationScope class. - /// - /// The resources scope description. - /// The resources scope path. Can be the - /// subscription on which the automation is defined on or a resource - /// group under that subscription (fully qualified Azure resource - /// IDs). - public AutomationScope(string description = default(string), string scopePath = default(string)) - { - Description = description; - ScopePath = scopePath; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the resources scope description. - /// - [JsonProperty(PropertyName = "description")] - public string Description { get; set; } - - /// - /// Gets or sets the resources scope path. Can be the subscription on - /// which the automation is defined on or a resource group under that - /// subscription (fully qualified Azure resource IDs). - /// - [JsonProperty(PropertyName = "scopePath")] - public string ScopePath { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AutomationSource.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AutomationSource.cs deleted file mode 100644 index 9e48941ebb18..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AutomationSource.cs +++ /dev/null @@ -1,76 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The source event types which evaluate the security automation set of - /// rules. For example - security alerts and security assessments. To learn - /// more about the supported security events data models schemas - please - /// visit https://aka.ms/ASCAutomationSchemas. - /// - public partial class AutomationSource - { - /// - /// Initializes a new instance of the AutomationSource class. - /// - public AutomationSource() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AutomationSource class. - /// - /// A valid event source type. Possible - /// values include: 'Assessments', 'SubAssessments', 'Alerts', - /// 'SecureScores', 'SecureScoresSnapshot', 'SecureScoreControls', - /// 'SecureScoreControlsSnapshot', 'RegulatoryComplianceAssessment', - /// 'RegulatoryComplianceAssessmentSnapshot' - /// A set of rules which evaluate upon event - /// interception. A logical disjunction is applied between defined rule - /// sets (logical 'or'). - public AutomationSource(string eventSource = default(string), IList ruleSets = default(IList)) - { - EventSource = eventSource; - RuleSets = ruleSets; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets a valid event source type. Possible values include: - /// 'Assessments', 'SubAssessments', 'Alerts', 'SecureScores', - /// 'SecureScoresSnapshot', 'SecureScoreControls', - /// 'SecureScoreControlsSnapshot', 'RegulatoryComplianceAssessment', - /// 'RegulatoryComplianceAssessmentSnapshot' - /// - [JsonProperty(PropertyName = "eventSource")] - public string EventSource { get; set; } - - /// - /// Gets or sets a set of rules which evaluate upon event interception. - /// A logical disjunction is applied between defined rule sets (logical - /// 'or'). - /// - [JsonProperty(PropertyName = "ruleSets")] - public IList RuleSets { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AutomationTriggeringRule.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AutomationTriggeringRule.cs deleted file mode 100644 index a08d617056f6..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AutomationTriggeringRule.cs +++ /dev/null @@ -1,93 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// A rule which is evaluated upon event interception. The rule is - /// configured by comparing a specific value from the event model to an - /// expected value. This comparison is done by using one of the supported - /// operators set. - /// - public partial class AutomationTriggeringRule - { - /// - /// Initializes a new instance of the AutomationTriggeringRule class. - /// - public AutomationTriggeringRule() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AutomationTriggeringRule class. - /// - /// The JPath of the entity model property - /// that should be checked. - /// The data type of the compared operands - /// (string, integer, floating point number or a boolean [true/false]]. - /// Possible values include: 'String', 'Integer', 'Number', - /// 'Boolean' - /// The expected value. - /// A valid comparer operator to use. A - /// case-insensitive comparison will be applied for String - /// PropertyType. Possible values include: 'Equals', 'GreaterThan', - /// 'GreaterThanOrEqualTo', 'LesserThan', 'LesserThanOrEqualTo', - /// 'NotEquals', 'Contains', 'StartsWith', 'EndsWith' - public AutomationTriggeringRule(string propertyJPath = default(string), string propertyType = default(string), string expectedValue = default(string), string operatorProperty = default(string)) - { - PropertyJPath = propertyJPath; - PropertyType = propertyType; - ExpectedValue = expectedValue; - OperatorProperty = operatorProperty; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the JPath of the entity model property that should be - /// checked. - /// - [JsonProperty(PropertyName = "propertyJPath")] - public string PropertyJPath { get; set; } - - /// - /// Gets or sets the data type of the compared operands (string, - /// integer, floating point number or a boolean [true/false]]. Possible - /// values include: 'String', 'Integer', 'Number', 'Boolean' - /// - [JsonProperty(PropertyName = "propertyType")] - public string PropertyType { get; set; } - - /// - /// Gets or sets the expected value. - /// - [JsonProperty(PropertyName = "expectedValue")] - public string ExpectedValue { get; set; } - - /// - /// Gets or sets a valid comparer operator to use. A case-insensitive - /// comparison will be applied for String PropertyType. Possible values - /// include: 'Equals', 'GreaterThan', 'GreaterThanOrEqualTo', - /// 'LesserThan', 'LesserThanOrEqualTo', 'NotEquals', 'Contains', - /// 'StartsWith', 'EndsWith' - /// - [JsonProperty(PropertyName = "operator")] - public string OperatorProperty { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AutomationValidationStatus.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AutomationValidationStatus.cs deleted file mode 100644 index d72b1cde55b2..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AutomationValidationStatus.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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// The security automation model state property bag. - /// - public partial class AutomationValidationStatus - { - /// - /// Initializes a new instance of the AutomationValidationStatus class. - /// - public AutomationValidationStatus() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AutomationValidationStatus class. - /// - /// Indicates whether the model is valid or - /// not. - /// The validation message. - public AutomationValidationStatus(bool? isValid = default(bool?), string message = default(string)) - { - IsValid = isValid; - Message = message; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets indicates whether the model is valid or not. - /// - [JsonProperty(PropertyName = "isValid")] - public bool? IsValid { get; set; } - - /// - /// Gets or sets the validation message. - /// - [JsonProperty(PropertyName = "message")] - public string Message { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AwAssumeRoleAuthenticationDetailsProperties.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AwAssumeRoleAuthenticationDetailsProperties.cs deleted file mode 100644 index d23662cc5f9a..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AwAssumeRoleAuthenticationDetailsProperties.cs +++ /dev/null @@ -1,105 +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.Security.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// AWS cloud account connector based assume role, the role enables - /// delegating access to your AWS resources. The role is composed of role - /// Amazon Resource Name (ARN) and external ID. For more details, refer to - /// <a - /// href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-user.html">Creating - /// a Role to Delegate Permissions to an IAM User (write only)</a> - /// - [Newtonsoft.Json.JsonObject("awsAssumeRole")] - public partial class AwAssumeRoleAuthenticationDetailsProperties : AuthenticationDetailsProperties - { - /// - /// Initializes a new instance of the - /// AwAssumeRoleAuthenticationDetailsProperties class. - /// - public AwAssumeRoleAuthenticationDetailsProperties() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// AwAssumeRoleAuthenticationDetailsProperties class. - /// - /// Assumed role ID is an identifier - /// that you can use to create temporary security credentials. - /// A unique identifier that is required - /// when you assume a role in another account. - /// State of the - /// multi-cloud connector. Possible values include: 'Valid', 'Invalid', - /// 'Expired', 'IncorrectPolicy' - /// The permissions detected in the - /// cloud account. - /// The ID of the cloud account - public AwAssumeRoleAuthenticationDetailsProperties(string awsAssumeRoleArn, string awsExternalId, string authenticationProvisioningState = default(string), IList grantedPermissions = default(IList), string accountId = default(string)) - : base(authenticationProvisioningState, grantedPermissions) - { - AccountId = accountId; - AwsAssumeRoleArn = awsAssumeRoleArn; - AwsExternalId = awsExternalId; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the ID of the cloud account - /// - [JsonProperty(PropertyName = "accountId")] - public string AccountId { get; private set; } - - /// - /// Gets or sets assumed role ID is an identifier that you can use to - /// create temporary security credentials. - /// - [JsonProperty(PropertyName = "awsAssumeRoleArn")] - public string AwsAssumeRoleArn { get; set; } - - /// - /// Gets or sets a unique identifier that is required when you assume a - /// role in another account. - /// - [JsonProperty(PropertyName = "awsExternalId")] - public string AwsExternalId { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (AwsAssumeRoleArn == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "AwsAssumeRoleArn"); - } - if (AwsExternalId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "AwsExternalId"); - } - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AwsCredsAuthenticationDetailsProperties.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AwsCredsAuthenticationDetailsProperties.cs deleted file mode 100644 index f934c6479f8f..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AwsCredsAuthenticationDetailsProperties.cs +++ /dev/null @@ -1,104 +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.Security.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// AWS cloud account connector based credentials, the credentials is - /// composed of access key ID and secret key, for more details, refer to - /// <a - /// href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_create.html">Creating - /// an IAM User in Your AWS Account (write only)</a> - /// - [Newtonsoft.Json.JsonObject("awsCreds")] - public partial class AwsCredsAuthenticationDetailsProperties : AuthenticationDetailsProperties - { - /// - /// Initializes a new instance of the - /// AwsCredsAuthenticationDetailsProperties class. - /// - public AwsCredsAuthenticationDetailsProperties() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// AwsCredsAuthenticationDetailsProperties class. - /// - /// Public key element of the AWS - /// credential object (write only) - /// Secret key element of the AWS - /// credential object (write only) - /// State of the - /// multi-cloud connector. Possible values include: 'Valid', 'Invalid', - /// 'Expired', 'IncorrectPolicy' - /// The permissions detected in the - /// cloud account. - /// The ID of the cloud account - public AwsCredsAuthenticationDetailsProperties(string awsAccessKeyId, string awsSecretAccessKey, string authenticationProvisioningState = default(string), IList grantedPermissions = default(IList), string accountId = default(string)) - : base(authenticationProvisioningState, grantedPermissions) - { - AccountId = accountId; - AwsAccessKeyId = awsAccessKeyId; - AwsSecretAccessKey = awsSecretAccessKey; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the ID of the cloud account - /// - [JsonProperty(PropertyName = "accountId")] - public string AccountId { get; private set; } - - /// - /// Gets or sets public key element of the AWS credential object (write - /// only) - /// - [JsonProperty(PropertyName = "awsAccessKeyId")] - public string AwsAccessKeyId { get; set; } - - /// - /// Gets or sets secret key element of the AWS credential object (write - /// only) - /// - [JsonProperty(PropertyName = "awsSecretAccessKey")] - public string AwsSecretAccessKey { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (AwsAccessKeyId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "AwsAccessKeyId"); - } - if (AwsSecretAccessKey == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "AwsSecretAccessKey"); - } - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AzureResourceDetails.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AzureResourceDetails.cs deleted file mode 100644 index b634e09ebdb5..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AzureResourceDetails.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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Details of the Azure resource that was assessed - /// - [Newtonsoft.Json.JsonObject("Azure")] - public partial class AzureResourceDetails : ResourceDetails - { - /// - /// Initializes a new instance of the AzureResourceDetails class. - /// - public AzureResourceDetails() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AzureResourceDetails class. - /// - /// Azure resource Id of the assessed resource - public AzureResourceDetails(string id = default(string)) - { - Id = id; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets azure resource Id of the assessed resource - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AzureResourceIdentifier.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AzureResourceIdentifier.cs deleted file mode 100644 index 4bfd85f17cd3..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AzureResourceIdentifier.cs +++ /dev/null @@ -1,54 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Azure resource identifier. - /// - [Newtonsoft.Json.JsonObject("AzureResource")] - public partial class AzureResourceIdentifier : ResourceIdentifier - { - /// - /// Initializes a new instance of the AzureResourceIdentifier class. - /// - public AzureResourceIdentifier() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AzureResourceIdentifier class. - /// - /// ARM resource identifier for the cloud - /// resource being alerted on - public AzureResourceIdentifier(string azureResourceId = default(string)) - { - AzureResourceId = azureResourceId; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets ARM resource identifier for the cloud resource being alerted - /// on - /// - [JsonProperty(PropertyName = "azureResourceId")] - public string AzureResourceId { get; private set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AzureResourceLink.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AzureResourceLink.cs deleted file mode 100644 index d2d7d81bfbc5..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AzureResourceLink.cs +++ /dev/null @@ -1,51 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Describes an Azure resource with kind - /// - public partial class AzureResourceLink - { - /// - /// Initializes a new instance of the AzureResourceLink class. - /// - public AzureResourceLink() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AzureResourceLink class. - /// - /// Azure resource Id - public AzureResourceLink(string id = default(string)) - { - Id = id; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets azure resource Id - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Baseline.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Baseline.cs deleted file mode 100644 index a300c7515832..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Baseline.cs +++ /dev/null @@ -1,61 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Baseline details. - /// - public partial class Baseline - { - /// - /// Initializes a new instance of the Baseline class. - /// - public Baseline() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the Baseline class. - /// - /// Expected results. - /// Baseline update time (UTC). - public Baseline(IList> expectedResults = default(IList>), System.DateTime? updatedTime = default(System.DateTime?)) - { - ExpectedResults = expectedResults; - UpdatedTime = updatedTime; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets expected results. - /// - [JsonProperty(PropertyName = "expectedResults")] - public IList> ExpectedResults { get; set; } - - /// - /// Gets or sets baseline update time (UTC). - /// - [JsonProperty(PropertyName = "updatedTime")] - public System.DateTime? UpdatedTime { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/BaselineAdjustedResult.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/BaselineAdjustedResult.cs deleted file mode 100644 index 29e81afc6670..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/BaselineAdjustedResult.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.Security.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The rule result adjusted with baseline. - /// - public partial class BaselineAdjustedResult - { - /// - /// Initializes a new instance of the BaselineAdjustedResult class. - /// - public BaselineAdjustedResult() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the BaselineAdjustedResult class. - /// - /// Possible values include: 'NonFinding', - /// 'Finding', 'InternalError' - /// Results the are not in - /// baseline. - /// Results the are in - /// baseline. - public BaselineAdjustedResult(Baseline baseline = default(Baseline), string status = default(string), IList> resultsNotInBaseline = default(IList>), IList> resultsOnlyInBaseline = default(IList>)) - { - Baseline = baseline; - Status = status; - ResultsNotInBaseline = resultsNotInBaseline; - ResultsOnlyInBaseline = resultsOnlyInBaseline; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "baseline")] - public Baseline Baseline { get; set; } - - /// - /// Gets or sets possible values include: 'NonFinding', 'Finding', - /// 'InternalError' - /// - [JsonProperty(PropertyName = "status")] - public string Status { get; set; } - - /// - /// Gets or sets results the are not in baseline. - /// - [JsonProperty(PropertyName = "resultsNotInBaseline")] - public IList> ResultsNotInBaseline { get; set; } - - /// - /// Gets or sets results the are in baseline. - /// - [JsonProperty(PropertyName = "resultsOnlyInBaseline")] - public IList> ResultsOnlyInBaseline { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/BenchmarkReference.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/BenchmarkReference.cs deleted file mode 100644 index f730db7e5513..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/BenchmarkReference.cs +++ /dev/null @@ -1,59 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// The benchmark references. - /// - public partial class BenchmarkReference - { - /// - /// Initializes a new instance of the BenchmarkReference class. - /// - public BenchmarkReference() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the BenchmarkReference class. - /// - /// The benchmark name. - /// The benchmark reference. - public BenchmarkReference(string benchmark = default(string), string reference = default(string)) - { - Benchmark = benchmark; - Reference = reference; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the benchmark name. - /// - [JsonProperty(PropertyName = "benchmark")] - public string Benchmark { get; set; } - - /// - /// Gets or sets the benchmark reference. - /// - [JsonProperty(PropertyName = "reference")] - public string Reference { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/BundleType.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/BundleType.cs deleted file mode 100644 index 60da8696f4e5..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/BundleType.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.Security.Models -{ - - /// - /// Defines values for BundleType. - /// - public static class BundleType - { - public const string AppServices = "AppServices"; - public const string DNS = "DNS"; - public const string KeyVaults = "KeyVaults"; - public const string KubernetesService = "KubernetesService"; - public const string ResourceManager = "ResourceManager"; - public const string SqlServers = "SqlServers"; - public const string StorageAccounts = "StorageAccounts"; - public const string VirtualMachines = "VirtualMachines"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/CVE.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/CVE.cs deleted file mode 100644 index c517739c77c2..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/CVE.cs +++ /dev/null @@ -1,59 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// CVE details - /// - public partial class CVE - { - /// - /// Initializes a new instance of the CVE class. - /// - public CVE() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the CVE class. - /// - /// CVE title - /// Link url - public CVE(string title = default(string), string link = default(string)) - { - Title = title; - Link = link; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets CVE title - /// - [JsonProperty(PropertyName = "title")] - public string Title { get; private set; } - - /// - /// Gets link url - /// - [JsonProperty(PropertyName = "link")] - public string Link { get; private set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/CVSS.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/CVSS.cs deleted file mode 100644 index 9f419f3ffaee..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/CVSS.cs +++ /dev/null @@ -1,51 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// CVSS details - /// - public partial class CVSS - { - /// - /// Initializes a new instance of the CVSS class. - /// - public CVSS() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the CVSS class. - /// - /// CVSS base - public CVSS(double? baseProperty = default(double?)) - { - BaseProperty = baseProperty; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets CVSS base - /// - [JsonProperty(PropertyName = "base")] - public double? BaseProperty { get; private set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Categories.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Categories.cs deleted file mode 100644 index 822bbff8ba38..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Categories.cs +++ /dev/null @@ -1,25 +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.Security.Models -{ - - /// - /// Defines values for Categories. - /// - public static class Categories - { - public const string Compute = "Compute"; - public const string Networking = "Networking"; - public const string Data = "Data"; - public const string IdentityAndAccess = "IdentityAndAccess"; - public const string IoT = "IoT"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/CefExternalSecuritySolution.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/CefExternalSecuritySolution.cs deleted file mode 100644 index 71f7f935f574..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/CefExternalSecuritySolution.cs +++ /dev/null @@ -1,58 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Represents a security solution which sends CEF logs to an OMS workspace - /// - [Newtonsoft.Json.JsonObject("CEF")] - public partial class CefExternalSecuritySolution : ExternalSecuritySolution - { - /// - /// Initializes a new instance of the CefExternalSecuritySolution - /// class. - /// - public CefExternalSecuritySolution() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the CefExternalSecuritySolution - /// class. - /// - /// Resource Id - /// Resource name - /// Resource type - /// Location where the resource is - /// stored - public CefExternalSecuritySolution(string id = default(string), string name = default(string), string type = default(string), string location = default(string), CefSolutionProperties properties = default(CefSolutionProperties)) - : base(id, name, type, location) - { - Properties = properties; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "properties")] - public CefSolutionProperties Properties { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/CefSolutionProperties.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/CefSolutionProperties.cs deleted file mode 100644 index 03694767fcec..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/CefSolutionProperties.cs +++ /dev/null @@ -1,66 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The external security solution properties for CEF solutions - /// - public partial class CefSolutionProperties : ExternalSecuritySolutionProperties - { - /// - /// Initializes a new instance of the CefSolutionProperties class. - /// - public CefSolutionProperties() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the CefSolutionProperties class. - /// - /// Unmatched properties from the - /// message are deserialized this collection - public CefSolutionProperties(IDictionary additionalProperties = default(IDictionary), string deviceVendor = default(string), string deviceType = default(string), ConnectedWorkspace workspace = default(ConnectedWorkspace), string hostname = default(string), string agent = default(string), string lastEventReceived = default(string)) - : base(additionalProperties, deviceVendor, deviceType, workspace) - { - Hostname = hostname; - Agent = agent; - LastEventReceived = lastEventReceived; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "hostname")] - public string Hostname { get; set; } - - /// - /// - [JsonProperty(PropertyName = "agent")] - public string Agent { get; set; } - - /// - /// - [JsonProperty(PropertyName = "lastEventReceived")] - public string LastEventReceived { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Compliance.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Compliance.cs deleted file mode 100644 index 4004358f771f..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Compliance.cs +++ /dev/null @@ -1,83 +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.Security.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Compliance of a scope - /// - [Rest.Serialization.JsonTransformation] - public partial class Compliance : Resource - { - /// - /// Initializes a new instance of the Compliance class. - /// - public Compliance() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the Compliance class. - /// - /// Resource Id - /// Resource name - /// Resource type - /// The timestamp when the - /// Compliance calculation was conducted. - /// The resource count of the given - /// subscription for which the Compliance calculation was conducted - /// (needed for Management Group Compliance calculation). - /// An array of segment, which is the - /// actually the compliance assessment. - public Compliance(string id = default(string), string name = default(string), string type = default(string), System.DateTime? assessmentTimestampUtcDate = default(System.DateTime?), int? resourceCount = default(int?), IList assessmentResult = default(IList)) - : base(id, name, type) - { - AssessmentTimestampUtcDate = assessmentTimestampUtcDate; - ResourceCount = resourceCount; - AssessmentResult = assessmentResult; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the timestamp when the Compliance calculation was conducted. - /// - [JsonProperty(PropertyName = "properties.assessmentTimestampUtcDate")] - public System.DateTime? AssessmentTimestampUtcDate { get; private set; } - - /// - /// Gets the resource count of the given subscription for which the - /// Compliance calculation was conducted (needed for Management Group - /// Compliance calculation). - /// - [JsonProperty(PropertyName = "properties.resourceCount")] - public int? ResourceCount { get; private set; } - - /// - /// Gets an array of segment, which is the actually the compliance - /// assessment. - /// - [JsonProperty(PropertyName = "properties.assessmentResult")] - public IList AssessmentResult { get; private set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ComplianceResult.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ComplianceResult.cs deleted file mode 100644 index 24aa5241f32f..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ComplianceResult.cs +++ /dev/null @@ -1,62 +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.Security.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - /// - /// a compliance result - /// - [Rest.Serialization.JsonTransformation] - public partial class ComplianceResult : Resource - { - /// - /// Initializes a new instance of the ComplianceResult class. - /// - public ComplianceResult() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ComplianceResult class. - /// - /// Resource Id - /// Resource name - /// Resource type - /// The status of the resource regarding a - /// single assessment. Possible values include: 'Healthy', - /// 'NotApplicable', 'OffByPolicy', 'NotHealthy' - public ComplianceResult(string id = default(string), string name = default(string), string type = default(string), string resourceStatus = default(string)) - : base(id, name, type) - { - ResourceStatus = resourceStatus; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the status of the resource regarding a single assessment. - /// Possible values include: 'Healthy', 'NotApplicable', 'OffByPolicy', - /// 'NotHealthy' - /// - [JsonProperty(PropertyName = "properties.resourceStatus")] - public string ResourceStatus { get; private set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ComplianceSegment.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ComplianceSegment.cs deleted file mode 100644 index 326a57a4e2cb..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ComplianceSegment.cs +++ /dev/null @@ -1,61 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// A segment of a compliance assessment. - /// - public partial class ComplianceSegment - { - /// - /// Initializes a new instance of the ComplianceSegment class. - /// - public ComplianceSegment() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ComplianceSegment class. - /// - /// The segment type, e.g. compliant, - /// non-compliance, insufficient coverage, N/A, etc. - /// The size (%) of the segment. - public ComplianceSegment(string segmentType = default(string), double? percentage = default(double?)) - { - SegmentType = segmentType; - Percentage = percentage; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the segment type, e.g. compliant, non-compliance, insufficient - /// coverage, N/A, etc. - /// - [JsonProperty(PropertyName = "segmentType")] - public string SegmentType { get; private set; } - - /// - /// Gets the size (%) of the segment. - /// - [JsonProperty(PropertyName = "percentage")] - public double? Percentage { get; private set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ConnectableResource.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ConnectableResource.cs deleted file mode 100644 index fdee3b843f08..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ConnectableResource.cs +++ /dev/null @@ -1,74 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Describes the allowed inbound and outbound traffic of an Azure resource - /// - public partial class ConnectableResource - { - /// - /// Initializes a new instance of the ConnectableResource class. - /// - public ConnectableResource() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ConnectableResource class. - /// - /// The Azure resource id - /// The list of Azure resources - /// that the resource has inbound allowed connection from - /// The list of Azure - /// resources that the resource has outbound allowed connection - /// to - public ConnectableResource(string id = default(string), IList inboundConnectedResources = default(IList), IList outboundConnectedResources = default(IList)) - { - Id = id; - InboundConnectedResources = inboundConnectedResources; - OutboundConnectedResources = outboundConnectedResources; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the Azure resource id - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } - - /// - /// Gets the list of Azure resources that the resource has inbound - /// allowed connection from - /// - [JsonProperty(PropertyName = "inboundConnectedResources")] - public IList InboundConnectedResources { get; private set; } - - /// - /// Gets the list of Azure resources that the resource has outbound - /// allowed connection to - /// - [JsonProperty(PropertyName = "outboundConnectedResources")] - public IList OutboundConnectedResources { get; private set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ConnectedResource.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ConnectedResource.cs deleted file mode 100644 index a9458d7b180b..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ConnectedResource.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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Describes properties of a connected resource - /// - public partial class ConnectedResource - { - /// - /// Initializes a new instance of the ConnectedResource class. - /// - public ConnectedResource() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ConnectedResource class. - /// - /// The Azure resource id of the - /// connected resource - /// The allowed tcp ports - /// The allowed udp ports - public ConnectedResource(string connectedResourceId = default(string), string tcpPorts = default(string), string udpPorts = default(string)) - { - ConnectedResourceId = connectedResourceId; - TcpPorts = tcpPorts; - UdpPorts = udpPorts; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the Azure resource id of the connected resource - /// - [JsonProperty(PropertyName = "connectedResourceId")] - public string ConnectedResourceId { get; private set; } - - /// - /// Gets the allowed tcp ports - /// - [JsonProperty(PropertyName = "tcpPorts")] - public string TcpPorts { get; private set; } - - /// - /// Gets the allowed udp ports - /// - [JsonProperty(PropertyName = "udpPorts")] - public string UdpPorts { get; private set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ConnectedWorkspace.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ConnectedWorkspace.cs deleted file mode 100644 index ede95550d65f..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ConnectedWorkspace.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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Represents an OMS workspace to which the solution is connected - /// - public partial class ConnectedWorkspace - { - /// - /// Initializes a new instance of the ConnectedWorkspace class. - /// - public ConnectedWorkspace() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ConnectedWorkspace class. - /// - /// Azure resource ID of the connected OMS - /// workspace - public ConnectedWorkspace(string id = default(string)) - { - Id = id; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets azure resource ID of the connected OMS workspace - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ConnectionFromIpNotAllowed.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ConnectionFromIpNotAllowed.cs deleted file mode 100644 index 1c567d2fc44c..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ConnectionFromIpNotAllowed.cs +++ /dev/null @@ -1,65 +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.Security.Models -{ - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Inbound connection from an ip that isn't allowed. Allow list consists - /// of ipv4 or ipv6 range in CIDR notation. - /// - public partial class ConnectionFromIpNotAllowed : AllowlistCustomAlertRule - { - /// - /// Initializes a new instance of the ConnectionFromIpNotAllowed class. - /// - public ConnectionFromIpNotAllowed() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ConnectionFromIpNotAllowed class. - /// - /// Status of the custom alert. - /// The values to allow. The format of - /// the values depends on the rule type. - /// The display name of the custom - /// alert. - /// The description of the custom - /// alert. - /// The value type of the items in the list. - /// Possible values include: 'IpCidr', 'String' - public ConnectionFromIpNotAllowed(bool isEnabled, IList allowlistValues, string displayName = default(string), string description = default(string), string valueType = default(string)) - : base(isEnabled, allowlistValues, displayName, description, valueType) - { - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ConnectionStrings.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ConnectionStrings.cs deleted file mode 100644 index 3f8d150af8f3..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ConnectionStrings.cs +++ /dev/null @@ -1,67 +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.Security.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Connection string for ingesting security data and logs - /// - public partial class ConnectionStrings - { - /// - /// Initializes a new instance of the ConnectionStrings class. - /// - public ConnectionStrings() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ConnectionStrings class. - /// - /// Connection strings - public ConnectionStrings(IList value) - { - Value = value; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets connection strings - /// - [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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ConnectionToIpNotAllowed.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ConnectionToIpNotAllowed.cs deleted file mode 100644 index 16d02941054a..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ConnectionToIpNotAllowed.cs +++ /dev/null @@ -1,65 +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.Security.Models -{ - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Outbound connection to an ip that isn't allowed. Allow list consists of - /// ipv4 or ipv6 range in CIDR notation. - /// - public partial class ConnectionToIpNotAllowed : AllowlistCustomAlertRule - { - /// - /// Initializes a new instance of the ConnectionToIpNotAllowed class. - /// - public ConnectionToIpNotAllowed() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ConnectionToIpNotAllowed class. - /// - /// Status of the custom alert. - /// The values to allow. The format of - /// the values depends on the rule type. - /// The display name of the custom - /// alert. - /// The description of the custom - /// alert. - /// The value type of the items in the list. - /// Possible values include: 'IpCidr', 'String' - public ConnectionToIpNotAllowed(bool isEnabled, IList allowlistValues, string displayName = default(string), string description = default(string), string valueType = default(string)) - : base(isEnabled, allowlistValues, displayName, description, valueType) - { - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ConnectionType.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ConnectionType.cs deleted file mode 100644 index 599f04894777..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ConnectionType.cs +++ /dev/null @@ -1,22 +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.Security.Models -{ - - /// - /// Defines values for ConnectionType. - /// - public static class ConnectionType - { - public const string Internal = "Internal"; - public const string External = "External"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ConnectorSetting.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ConnectorSetting.cs deleted file mode 100644 index e99d45471912..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ConnectorSetting.cs +++ /dev/null @@ -1,85 +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.Security.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - /// - /// The connector setting - /// - [Rest.Serialization.JsonTransformation] - public partial class ConnectorSetting : Resource - { - /// - /// Initializes a new instance of the ConnectorSetting class. - /// - public ConnectorSetting() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ConnectorSetting class. - /// - /// Resource Id - /// Resource name - /// Resource type - /// Settings for hybrid compute - /// management. These settings are relevant only for Arc autoProvision - /// (Hybrid Compute). - /// Settings for authentication - /// management, these settings are relevant only for the cloud - /// connector. - public ConnectorSetting(string id = default(string), string name = default(string), string type = default(string), HybridComputeSettingsProperties hybridComputeSettings = default(HybridComputeSettingsProperties), AuthenticationDetailsProperties authenticationDetails = default(AuthenticationDetailsProperties)) - : base(id, name, type) - { - HybridComputeSettings = hybridComputeSettings; - AuthenticationDetails = authenticationDetails; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets settings for hybrid compute management. These settings - /// are relevant only for Arc autoProvision (Hybrid Compute). - /// - [JsonProperty(PropertyName = "properties.hybridComputeSettings")] - public HybridComputeSettingsProperties HybridComputeSettings { get; set; } - - /// - /// Gets or sets settings for authentication management, these settings - /// are relevant only for the cloud connector. - /// - [JsonProperty(PropertyName = "properties.authenticationDetails")] - public AuthenticationDetailsProperties AuthenticationDetails { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (HybridComputeSettings != null) - { - HybridComputeSettings.Validate(); - } - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ContainerRegistryVulnerabilityProperties.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ContainerRegistryVulnerabilityProperties.cs deleted file mode 100644 index 5938f602483a..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ContainerRegistryVulnerabilityProperties.cs +++ /dev/null @@ -1,117 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Additional context fields for container registry Vulnerability - /// assessment - /// - [Newtonsoft.Json.JsonObject("ContainerRegistryVulnerability")] - public partial class ContainerRegistryVulnerabilityProperties : AdditionalData - { - /// - /// Initializes a new instance of the - /// ContainerRegistryVulnerabilityProperties class. - /// - public ContainerRegistryVulnerabilityProperties() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// ContainerRegistryVulnerabilityProperties class. - /// - /// Vulnerability Type. e.g: Vulnerability, - /// Potential Vulnerability, Information Gathered, - /// Vulnerability - /// Dictionary from cvss version to cvss details - /// object - /// Indicates whether a patch is available or - /// not - /// List of CVEs - /// Published time - /// Name of the repository which the - /// vulnerable image belongs to - /// Digest of the vulnerable image - public ContainerRegistryVulnerabilityProperties(string type = default(string), IDictionary cvss = default(IDictionary), bool? patchable = default(bool?), IList cve = default(IList), System.DateTime? publishedTime = default(System.DateTime?), IList vendorReferences = default(IList), string repositoryName = default(string), string imageDigest = default(string)) - { - Type = type; - Cvss = cvss; - Patchable = patchable; - Cve = cve; - PublishedTime = publishedTime; - VendorReferences = vendorReferences; - RepositoryName = repositoryName; - ImageDigest = imageDigest; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets vulnerability Type. e.g: Vulnerability, Potential - /// Vulnerability, Information Gathered, Vulnerability - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } - - /// - /// Gets dictionary from cvss version to cvss details object - /// - [JsonProperty(PropertyName = "cvss")] - public IDictionary Cvss { get; private set; } - - /// - /// Gets indicates whether a patch is available or not - /// - [JsonProperty(PropertyName = "patchable")] - public bool? Patchable { get; private set; } - - /// - /// Gets list of CVEs - /// - [JsonProperty(PropertyName = "cve")] - public IList Cve { get; private set; } - - /// - /// Gets published time - /// - [JsonProperty(PropertyName = "publishedTime")] - public System.DateTime? PublishedTime { get; private set; } - - /// - /// - [JsonProperty(PropertyName = "vendorReferences")] - public IList VendorReferences { get; private set; } - - /// - /// Gets name of the repository which the vulnerable image belongs to - /// - [JsonProperty(PropertyName = "repositoryName")] - public string RepositoryName { get; private set; } - - /// - /// Gets digest of the vulnerable image - /// - [JsonProperty(PropertyName = "imageDigest")] - public string ImageDigest { get; private set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ControlType.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ControlType.cs deleted file mode 100644 index dc6e20143b2a..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ControlType.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.Security.Models -{ - - /// - /// Defines values for ControlType. - /// - public static class ControlType - { - /// - /// Azure Security Center managed assessments - /// - public const string BuiltIn = "BuiltIn"; - /// - /// Non Azure Security Center managed assessments - /// - public const string Custom = "Custom"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/CreatedByType.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/CreatedByType.cs deleted file mode 100644 index a18acdd38fdf..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/CreatedByType.cs +++ /dev/null @@ -1,24 +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.Security.Models -{ - - /// - /// Defines values for CreatedByType. - /// - public static class CreatedByType - { - public const string User = "User"; - public const string Application = "Application"; - public const string ManagedIdentity = "ManagedIdentity"; - public const string Key = "Key"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/CustomAlertRule.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/CustomAlertRule.cs deleted file mode 100644 index c52d16896c22..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/CustomAlertRule.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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// A custom alert rule. - /// - public partial class CustomAlertRule - { - /// - /// Initializes a new instance of the CustomAlertRule class. - /// - public CustomAlertRule() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the CustomAlertRule class. - /// - /// Status of the custom alert. - /// The display name of the custom - /// alert. - /// The description of the custom - /// alert. - public CustomAlertRule(bool isEnabled, string displayName = default(string), string description = default(string)) - { - DisplayName = displayName; - Description = description; - IsEnabled = isEnabled; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the display name of the custom alert. - /// - [JsonProperty(PropertyName = "displayName")] - public string DisplayName { get; private set; } - - /// - /// Gets the description of the custom alert. - /// - [JsonProperty(PropertyName = "description")] - public string Description { get; private set; } - - /// - /// Gets or sets status of the custom alert. - /// - [JsonProperty(PropertyName = "isEnabled")] - public bool IsEnabled { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - //Nothing to validate - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/DataExportSettings.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/DataExportSettings.cs deleted file mode 100644 index e9c06204304c..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/DataExportSettings.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.Security.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Represents a data export setting - /// - [Rest.Serialization.JsonTransformation] - public partial class DataExportSettings : Setting - { - /// - /// Initializes a new instance of the DataExportSettings class. - /// - public DataExportSettings() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the DataExportSettings class. - /// - /// Is the data export setting enabled - /// Resource Id - /// Resource name - /// Resource type - public DataExportSettings(bool enabled, string id = default(string), string name = default(string), string type = default(string)) - : base(id, name, type) - { - Enabled = enabled; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets is the data export setting enabled - /// - [JsonProperty(PropertyName = "properties.enabled")] - public bool Enabled { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - //Nothing to validate - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/DataSource.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/DataSource.cs deleted file mode 100644 index 21aee25c6657..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/DataSource.cs +++ /dev/null @@ -1,24 +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.Security.Models -{ - - /// - /// Defines values for DataSource. - /// - public static class DataSource - { - /// - /// Devices twin data - /// - public const string TwinData = "TwinData"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/DenylistCustomAlertRule.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/DenylistCustomAlertRule.cs deleted file mode 100644 index fefdebb7ccad..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/DenylistCustomAlertRule.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.Security.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// A custom alert rule that checks if a value (depends on the custom alert - /// type) is denied. - /// - public partial class DenylistCustomAlertRule : ListCustomAlertRule - { - /// - /// Initializes a new instance of the DenylistCustomAlertRule class. - /// - public DenylistCustomAlertRule() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the DenylistCustomAlertRule class. - /// - /// Status of the custom alert. - /// The values to deny. The format of the - /// values depends on the rule type. - /// The display name of the custom - /// alert. - /// The description of the custom - /// alert. - /// The value type of the items in the list. - /// Possible values include: 'IpCidr', 'String' - public DenylistCustomAlertRule(bool isEnabled, IList denylistValues, string displayName = default(string), string description = default(string), string valueType = default(string)) - : base(isEnabled, displayName, description, valueType) - { - DenylistValues = denylistValues; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the values to deny. The format of the values depends - /// on the rule type. - /// - [JsonProperty(PropertyName = "denylistValues")] - public IList DenylistValues { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - if (DenylistValues == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "DenylistValues"); - } - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/DeviceSecurityGroup.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/DeviceSecurityGroup.cs deleted file mode 100644 index 1c292fc222b8..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/DeviceSecurityGroup.cs +++ /dev/null @@ -1,88 +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.Security.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The device security group resource - /// - [Rest.Serialization.JsonTransformation] - public partial class DeviceSecurityGroup : Resource - { - /// - /// Initializes a new instance of the DeviceSecurityGroup class. - /// - public DeviceSecurityGroup() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the DeviceSecurityGroup class. - /// - /// Resource Id - /// Resource name - /// Resource type - /// The list of custom alert threshold - /// rules. - /// The list of custom alert time-window - /// rules. - /// The allow-list custom alert - /// rules. - /// The deny-list custom alert - /// rules. - public DeviceSecurityGroup(string id = default(string), string name = default(string), string type = default(string), IList thresholdRules = default(IList), IList timeWindowRules = default(IList), IList allowlistRules = default(IList), IList denylistRules = default(IList)) - : base(id, name, type) - { - ThresholdRules = thresholdRules; - TimeWindowRules = timeWindowRules; - AllowlistRules = allowlistRules; - DenylistRules = denylistRules; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the list of custom alert threshold rules. - /// - [JsonProperty(PropertyName = "properties.thresholdRules")] - public IList ThresholdRules { get; set; } - - /// - /// Gets or sets the list of custom alert time-window rules. - /// - [JsonProperty(PropertyName = "properties.timeWindowRules")] - public IList TimeWindowRules { get; set; } - - /// - /// Gets or sets the allow-list custom alert rules. - /// - [JsonProperty(PropertyName = "properties.allowlistRules")] - public IList AllowlistRules { get; set; } - - /// - /// Gets or sets the deny-list custom alert rules. - /// - [JsonProperty(PropertyName = "properties.denylistRules")] - public IList DenylistRules { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/DirectMethodInvokesNotInAllowedRange.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/DirectMethodInvokesNotInAllowedRange.cs deleted file mode 100644 index efb160b104ec..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/DirectMethodInvokesNotInAllowedRange.cs +++ /dev/null @@ -1,64 +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.Security.Models -{ - using System.Linq; - - /// - /// Number of direct method invokes is not in allowed range. - /// - public partial class DirectMethodInvokesNotInAllowedRange : TimeWindowCustomAlertRule - { - /// - /// Initializes a new instance of the - /// DirectMethodInvokesNotInAllowedRange class. - /// - public DirectMethodInvokesNotInAllowedRange() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// DirectMethodInvokesNotInAllowedRange class. - /// - /// Status of the custom alert. - /// The minimum threshold. - /// The maximum threshold. - /// The time window size in iso8601 - /// format. - /// The display name of the custom - /// alert. - /// The description of the custom - /// alert. - public DirectMethodInvokesNotInAllowedRange(bool isEnabled, int minThreshold, int maxThreshold, System.TimeSpan timeWindowSize, string displayName = default(string), string description = default(string)) - : base(isEnabled, minThreshold, maxThreshold, timeWindowSize, displayName, description) - { - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Direction.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Direction.cs deleted file mode 100644 index 1f13287d7fa6..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Direction.cs +++ /dev/null @@ -1,22 +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.Security.Models -{ - - /// - /// Defines values for Direction. - /// - public static class Direction - { - public const string Inbound = "Inbound"; - public const string Outbound = "Outbound"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/DiscoveredSecuritySolution.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/DiscoveredSecuritySolution.cs deleted file mode 100644 index dcd1ce59ccfb..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/DiscoveredSecuritySolution.cs +++ /dev/null @@ -1,137 +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.Security.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - [Rest.Serialization.JsonTransformation] - public partial class DiscoveredSecuritySolution - { - /// - /// Initializes a new instance of the DiscoveredSecuritySolution class. - /// - public DiscoveredSecuritySolution() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the DiscoveredSecuritySolution class. - /// - /// The security family of the discovered - /// solution. Possible values include: 'Waf', 'Ngfw', 'SaasWaf', - /// 'Va' - /// The security solutions' image offer - /// The security solutions' image - /// publisher - /// The security solutions' image sku - /// Resource Id - /// Resource name - /// Resource type - /// Location where the resource is - /// stored - public DiscoveredSecuritySolution(string securityFamily, string offer, string publisher, string sku, string id = default(string), string name = default(string), string type = default(string), string location = default(string)) - { - Id = id; - Name = name; - Type = type; - Location = location; - SecurityFamily = securityFamily; - Offer = offer; - Publisher = publisher; - Sku = sku; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets resource Id - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } - - /// - /// Gets resource name - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } - - /// - /// Gets resource type - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } - - /// - /// Gets location where the resource is stored - /// - [JsonProperty(PropertyName = "location")] - public string Location { get; private set; } - - /// - /// Gets or sets the security family of the discovered solution. - /// Possible values include: 'Waf', 'Ngfw', 'SaasWaf', 'Va' - /// - [JsonProperty(PropertyName = "properties.securityFamily")] - public string SecurityFamily { get; set; } - - /// - /// Gets or sets the security solutions' image offer - /// - [JsonProperty(PropertyName = "properties.offer")] - public string Offer { get; set; } - - /// - /// Gets or sets the security solutions' image publisher - /// - [JsonProperty(PropertyName = "properties.publisher")] - public string Publisher { get; set; } - - /// - /// Gets or sets the security solutions' image sku - /// - [JsonProperty(PropertyName = "properties.sku")] - public string Sku { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (SecurityFamily == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "SecurityFamily"); - } - if (Offer == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Offer"); - } - if (Publisher == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Publisher"); - } - if (Sku == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Sku"); - } - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/EffectiveNetworkSecurityGroups.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/EffectiveNetworkSecurityGroups.cs deleted file mode 100644 index 17b9f1c49622..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/EffectiveNetworkSecurityGroups.cs +++ /dev/null @@ -1,66 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Describes the Network Security Groups effective on a network interface - /// - public partial class EffectiveNetworkSecurityGroups - { - /// - /// Initializes a new instance of the EffectiveNetworkSecurityGroups - /// class. - /// - public EffectiveNetworkSecurityGroups() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EffectiveNetworkSecurityGroups - /// class. - /// - /// The Azure resource ID of the network - /// interface - /// The Network Security Groups - /// effective on the network interface - public EffectiveNetworkSecurityGroups(string networkInterface = default(string), IList networkSecurityGroups = default(IList)) - { - NetworkInterface = networkInterface; - NetworkSecurityGroups = networkSecurityGroups; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the Azure resource ID of the network interface - /// - [JsonProperty(PropertyName = "networkInterface")] - public string NetworkInterface { get; set; } - - /// - /// Gets or sets the Network Security Groups effective on the network - /// interface - /// - [JsonProperty(PropertyName = "networkSecurityGroups")] - public IList NetworkSecurityGroups { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/EndOfSupportStatus.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/EndOfSupportStatus.cs deleted file mode 100644 index 711d2f3fa86d..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/EndOfSupportStatus.cs +++ /dev/null @@ -1,25 +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.Security.Models -{ - - /// - /// Defines values for EndOfSupportStatus. - /// - public static class EndOfSupportStatus - { - public const string None = "None"; - public const string NoLongerSupported = "noLongerSupported"; - public const string VersionNoLongerSupported = "versionNoLongerSupported"; - public const string UpcomingNoLongerSupported = "upcomingNoLongerSupported"; - public const string UpcomingVersionNoLongerSupported = "upcomingVersionNoLongerSupported"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/EventSource.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/EventSource.cs deleted file mode 100644 index 78f7630e6c2e..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/EventSource.cs +++ /dev/null @@ -1,29 +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.Security.Models -{ - - /// - /// Defines values for EventSource. - /// - public static class EventSource - { - public const string Assessments = "Assessments"; - public const string SubAssessments = "SubAssessments"; - public const string Alerts = "Alerts"; - public const string SecureScores = "SecureScores"; - public const string SecureScoresSnapshot = "SecureScoresSnapshot"; - public const string SecureScoreControls = "SecureScoreControls"; - public const string SecureScoreControlsSnapshot = "SecureScoreControlsSnapshot"; - public const string RegulatoryComplianceAssessment = "RegulatoryComplianceAssessment"; - public const string RegulatoryComplianceAssessmentSnapshot = "RegulatoryComplianceAssessmentSnapshot"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ExpandControlsEnum.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ExpandControlsEnum.cs deleted file mode 100644 index e9d717ddacba..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ExpandControlsEnum.cs +++ /dev/null @@ -1,24 +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.Security.Models -{ - - /// - /// Defines values for ExpandControlsEnum. - /// - public static class ExpandControlsEnum - { - /// - /// Add definition object for each control - /// - public const string Definition = "definition"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ExpandEnum.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ExpandEnum.cs deleted file mode 100644 index 6f3b1395c0b3..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ExpandEnum.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.Security.Models -{ - - /// - /// Defines values for ExpandEnum. - /// - public static class ExpandEnum - { - /// - /// All links associated with an assessment - /// - public const string Links = "links"; - /// - /// Assessment metadata - /// - public const string Metadata = "metadata"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ExportData.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ExportData.cs deleted file mode 100644 index 4702716c60b7..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ExportData.cs +++ /dev/null @@ -1,24 +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.Security.Models -{ - - /// - /// Defines values for ExportData. - /// - public static class ExportData - { - /// - /// Agent raw events - /// - public const string RawEvents = "RawEvents"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ExternalSecuritySolution.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ExternalSecuritySolution.cs deleted file mode 100644 index 119f870c19ad..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ExternalSecuritySolution.cs +++ /dev/null @@ -1,78 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Represents a security solution external to Azure Security Center which - /// sends information to an OMS workspace and whose data is displayed by - /// Azure Security Center. - /// - public partial class ExternalSecuritySolution - { - /// - /// Initializes a new instance of the ExternalSecuritySolution class. - /// - public ExternalSecuritySolution() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ExternalSecuritySolution class. - /// - /// Resource Id - /// Resource name - /// Resource type - /// Location where the resource is - /// stored - public ExternalSecuritySolution(string id = default(string), string name = default(string), string type = default(string), string location = default(string)) - { - Id = id; - Name = name; - Type = type; - Location = location; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets resource Id - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } - - /// - /// Gets resource name - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } - - /// - /// Gets resource type - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } - - /// - /// Gets location where the resource is stored - /// - [JsonProperty(PropertyName = "location")] - public string Location { get; private set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ExternalSecuritySolutionKind.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ExternalSecuritySolutionKind.cs deleted file mode 100644 index 06da0714d086..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ExternalSecuritySolutionKind.cs +++ /dev/null @@ -1,23 +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.Security.Models -{ - - /// - /// Defines values for ExternalSecuritySolutionKind. - /// - public static class ExternalSecuritySolutionKind - { - public const string CEF = "CEF"; - public const string ATA = "ATA"; - public const string AAD = "AAD"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ExternalSecuritySolutionKind1.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ExternalSecuritySolutionKind1.cs deleted file mode 100644 index 7a1246b2fade..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ExternalSecuritySolutionKind1.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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Describes an Azure resource with kind - /// - public partial class ExternalSecuritySolutionKind1 - { - /// - /// Initializes a new instance of the ExternalSecuritySolutionKind1 - /// class. - /// - public ExternalSecuritySolutionKind1() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ExternalSecuritySolutionKind1 - /// class. - /// - /// The kind of the external solution. Possible - /// values include: 'CEF', 'ATA', 'AAD' - public ExternalSecuritySolutionKind1(string kind = default(string)) - { - Kind = kind; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the kind of the external solution. Possible values - /// include: 'CEF', 'ATA', 'AAD' - /// - [JsonProperty(PropertyName = "kind")] - public string Kind { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ExternalSecuritySolutionProperties.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ExternalSecuritySolutionProperties.cs deleted file mode 100644 index 0d621f57ed66..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ExternalSecuritySolutionProperties.cs +++ /dev/null @@ -1,75 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The solution properties (correspond to the solution kind) - /// - public partial class ExternalSecuritySolutionProperties - { - /// - /// Initializes a new instance of the - /// ExternalSecuritySolutionProperties class. - /// - public ExternalSecuritySolutionProperties() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// ExternalSecuritySolutionProperties class. - /// - /// Unmatched properties from the - /// message are deserialized this collection - public ExternalSecuritySolutionProperties(IDictionary additionalProperties = default(IDictionary), string deviceVendor = default(string), string deviceType = default(string), ConnectedWorkspace workspace = default(ConnectedWorkspace)) - { - AdditionalProperties = additionalProperties; - DeviceVendor = deviceVendor; - DeviceType = deviceType; - Workspace = workspace; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets unmatched properties from the message are deserialized - /// this collection - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - - /// - /// - [JsonProperty(PropertyName = "deviceVendor")] - public string DeviceVendor { get; set; } - - /// - /// - [JsonProperty(PropertyName = "deviceType")] - public string DeviceType { get; set; } - - /// - /// - [JsonProperty(PropertyName = "workspace")] - public ConnectedWorkspace Workspace { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/FailedLocalLoginsNotInAllowedRange.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/FailedLocalLoginsNotInAllowedRange.cs deleted file mode 100644 index d2d8d1166ae2..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/FailedLocalLoginsNotInAllowedRange.cs +++ /dev/null @@ -1,64 +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.Security.Models -{ - using System.Linq; - - /// - /// Number of failed local logins is not in allowed range. - /// - public partial class FailedLocalLoginsNotInAllowedRange : TimeWindowCustomAlertRule - { - /// - /// Initializes a new instance of the - /// FailedLocalLoginsNotInAllowedRange class. - /// - public FailedLocalLoginsNotInAllowedRange() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// FailedLocalLoginsNotInAllowedRange class. - /// - /// Status of the custom alert. - /// The minimum threshold. - /// The maximum threshold. - /// The time window size in iso8601 - /// format. - /// The display name of the custom - /// alert. - /// The description of the custom - /// alert. - public FailedLocalLoginsNotInAllowedRange(bool isEnabled, int minThreshold, int maxThreshold, System.TimeSpan timeWindowSize, string displayName = default(string), string description = default(string)) - : base(isEnabled, minThreshold, maxThreshold, timeWindowSize, displayName, description) - { - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/FileUploadsNotInAllowedRange.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/FileUploadsNotInAllowedRange.cs deleted file mode 100644 index 55109af42dc0..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/FileUploadsNotInAllowedRange.cs +++ /dev/null @@ -1,64 +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.Security.Models -{ - using System.Linq; - - /// - /// Number of file uploads is not in allowed range. - /// - public partial class FileUploadsNotInAllowedRange : TimeWindowCustomAlertRule - { - /// - /// Initializes a new instance of the FileUploadsNotInAllowedRange - /// class. - /// - public FileUploadsNotInAllowedRange() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the FileUploadsNotInAllowedRange - /// class. - /// - /// Status of the custom alert. - /// The minimum threshold. - /// The maximum threshold. - /// The time window size in iso8601 - /// format. - /// The display name of the custom - /// alert. - /// The description of the custom - /// alert. - public FileUploadsNotInAllowedRange(bool isEnabled, int minThreshold, int maxThreshold, System.TimeSpan timeWindowSize, string displayName = default(string), string description = default(string)) - : base(isEnabled, minThreshold, maxThreshold, timeWindowSize, displayName, description) - { - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/GcpCredentialsDetailsProperties.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/GcpCredentialsDetailsProperties.cs deleted file mode 100644 index 946e5ec735eb..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/GcpCredentialsDetailsProperties.cs +++ /dev/null @@ -1,210 +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.Security.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// GCP cloud account connector based service to service credentials, the - /// credentials are composed of the organization ID and a JSON API key - /// (write only) - /// - [Newtonsoft.Json.JsonObject("gcpCredentials")] - public partial class GcpCredentialsDetailsProperties : AuthenticationDetailsProperties - { - /// - /// Initializes a new instance of the GcpCredentialsDetailsProperties - /// class. - /// - public GcpCredentialsDetailsProperties() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the GcpCredentialsDetailsProperties - /// class. - /// - /// The organization ID of the GCP cloud - /// account - /// Type field of the API key (write only) - /// Project ID field of the API key (write - /// only) - /// Private key ID field of the API key - /// (write only) - /// Private key field of the API key (write - /// only) - /// Client email field of the API key (write - /// only) - /// Client ID field of the API key (write - /// only) - /// Auth URI field of the API key (write - /// only) - /// Token URI field of the API key (write - /// only) - /// Auth provider x509 - /// certificate URL field of the API key (write only) - /// Client x509 certificate URL field - /// of the API key (write only) - /// State of the - /// multi-cloud connector. Possible values include: 'Valid', 'Invalid', - /// 'Expired', 'IncorrectPolicy' - /// The permissions detected in the - /// cloud account. - public GcpCredentialsDetailsProperties(string organizationId, string type, string projectId, string privateKeyId, string privateKey, string clientEmail, string clientId, string authUri, string tokenUri, string authProviderX509CertUrl, string clientX509CertUrl, string authenticationProvisioningState = default(string), IList grantedPermissions = default(IList)) - : base(authenticationProvisioningState, grantedPermissions) - { - OrganizationId = organizationId; - Type = type; - ProjectId = projectId; - PrivateKeyId = privateKeyId; - PrivateKey = privateKey; - ClientEmail = clientEmail; - ClientId = clientId; - AuthUri = authUri; - TokenUri = tokenUri; - AuthProviderX509CertUrl = authProviderX509CertUrl; - ClientX509CertUrl = clientX509CertUrl; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the organization ID of the GCP cloud account - /// - [JsonProperty(PropertyName = "organizationId")] - public string OrganizationId { get; set; } - - /// - /// Gets or sets type field of the API key (write only) - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; set; } - - /// - /// Gets or sets project ID field of the API key (write only) - /// - [JsonProperty(PropertyName = "projectId")] - public string ProjectId { get; set; } - - /// - /// Gets or sets private key ID field of the API key (write only) - /// - [JsonProperty(PropertyName = "privateKeyId")] - public string PrivateKeyId { get; set; } - - /// - /// Gets or sets private key field of the API key (write only) - /// - [JsonProperty(PropertyName = "privateKey")] - public string PrivateKey { get; set; } - - /// - /// Gets or sets client email field of the API key (write only) - /// - [JsonProperty(PropertyName = "clientEmail")] - public string ClientEmail { get; set; } - - /// - /// Gets or sets client ID field of the API key (write only) - /// - [JsonProperty(PropertyName = "clientId")] - public string ClientId { get; set; } - - /// - /// Gets or sets auth URI field of the API key (write only) - /// - [JsonProperty(PropertyName = "authUri")] - public string AuthUri { get; set; } - - /// - /// Gets or sets token URI field of the API key (write only) - /// - [JsonProperty(PropertyName = "tokenUri")] - public string TokenUri { get; set; } - - /// - /// Gets or sets auth provider x509 certificate URL field of the API - /// key (write only) - /// - [JsonProperty(PropertyName = "authProviderX509CertUrl")] - public string AuthProviderX509CertUrl { get; set; } - - /// - /// Gets or sets client x509 certificate URL field of the API key - /// (write only) - /// - [JsonProperty(PropertyName = "clientX509CertUrl")] - public string ClientX509CertUrl { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (OrganizationId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "OrganizationId"); - } - if (Type == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Type"); - } - if (ProjectId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ProjectId"); - } - if (PrivateKeyId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "PrivateKeyId"); - } - if (PrivateKey == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "PrivateKey"); - } - if (ClientEmail == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ClientEmail"); - } - if (ClientId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ClientId"); - } - if (AuthUri == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "AuthUri"); - } - if (TokenUri == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "TokenUri"); - } - if (AuthProviderX509CertUrl == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "AuthProviderX509CertUrl"); - } - if (ClientX509CertUrl == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ClientX509CertUrl"); - } - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/HttpC2DMessagesNotInAllowedRange.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/HttpC2DMessagesNotInAllowedRange.cs deleted file mode 100644 index 21b2e8bf7d9e..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/HttpC2DMessagesNotInAllowedRange.cs +++ /dev/null @@ -1,65 +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.Security.Models -{ - using System.Linq; - - /// - /// Number of cloud to device messages (HTTP protocol) is not in allowed - /// range. - /// - public partial class HttpC2DMessagesNotInAllowedRange : TimeWindowCustomAlertRule - { - /// - /// Initializes a new instance of the HttpC2DMessagesNotInAllowedRange - /// class. - /// - public HttpC2DMessagesNotInAllowedRange() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the HttpC2DMessagesNotInAllowedRange - /// class. - /// - /// Status of the custom alert. - /// The minimum threshold. - /// The maximum threshold. - /// The time window size in iso8601 - /// format. - /// The display name of the custom - /// alert. - /// The description of the custom - /// alert. - public HttpC2DMessagesNotInAllowedRange(bool isEnabled, int minThreshold, int maxThreshold, System.TimeSpan timeWindowSize, string displayName = default(string), string description = default(string)) - : base(isEnabled, minThreshold, maxThreshold, timeWindowSize, displayName, description) - { - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/HttpC2DRejectedMessagesNotInAllowedRange.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/HttpC2DRejectedMessagesNotInAllowedRange.cs deleted file mode 100644 index 73f69e0b71b0..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/HttpC2DRejectedMessagesNotInAllowedRange.cs +++ /dev/null @@ -1,65 +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.Security.Models -{ - using System.Linq; - - /// - /// Number of rejected cloud to device messages (HTTP protocol) is not in - /// allowed range. - /// - public partial class HttpC2DRejectedMessagesNotInAllowedRange : TimeWindowCustomAlertRule - { - /// - /// Initializes a new instance of the - /// HttpC2DRejectedMessagesNotInAllowedRange class. - /// - public HttpC2DRejectedMessagesNotInAllowedRange() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// HttpC2DRejectedMessagesNotInAllowedRange class. - /// - /// Status of the custom alert. - /// The minimum threshold. - /// The maximum threshold. - /// The time window size in iso8601 - /// format. - /// The display name of the custom - /// alert. - /// The description of the custom - /// alert. - public HttpC2DRejectedMessagesNotInAllowedRange(bool isEnabled, int minThreshold, int maxThreshold, System.TimeSpan timeWindowSize, string displayName = default(string), string description = default(string)) - : base(isEnabled, minThreshold, maxThreshold, timeWindowSize, displayName, description) - { - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/HttpD2CMessagesNotInAllowedRange.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/HttpD2CMessagesNotInAllowedRange.cs deleted file mode 100644 index 820edd41c00a..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/HttpD2CMessagesNotInAllowedRange.cs +++ /dev/null @@ -1,65 +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.Security.Models -{ - using System.Linq; - - /// - /// Number of device to cloud messages (HTTP protocol) is not in allowed - /// range. - /// - public partial class HttpD2CMessagesNotInAllowedRange : TimeWindowCustomAlertRule - { - /// - /// Initializes a new instance of the HttpD2CMessagesNotInAllowedRange - /// class. - /// - public HttpD2CMessagesNotInAllowedRange() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the HttpD2CMessagesNotInAllowedRange - /// class. - /// - /// Status of the custom alert. - /// The minimum threshold. - /// The maximum threshold. - /// The time window size in iso8601 - /// format. - /// The display name of the custom - /// alert. - /// The description of the custom - /// alert. - public HttpD2CMessagesNotInAllowedRange(bool isEnabled, int minThreshold, int maxThreshold, System.TimeSpan timeWindowSize, string displayName = default(string), string description = default(string)) - : base(isEnabled, minThreshold, maxThreshold, timeWindowSize, displayName, description) - { - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/HybridComputeProvisioningState.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/HybridComputeProvisioningState.cs deleted file mode 100644 index 738d7684264e..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/HybridComputeProvisioningState.cs +++ /dev/null @@ -1,32 +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.Security.Models -{ - - /// - /// Defines values for HybridComputeProvisioningState. - /// - public static class HybridComputeProvisioningState - { - /// - /// Valid service principal details. - /// - public const string Valid = "Valid"; - /// - /// Invalid service principal details. - /// - public const string Invalid = "Invalid"; - /// - /// the service principal details are expired - /// - public const string Expired = "Expired"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/HybridComputeSettingsProperties.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/HybridComputeSettingsProperties.cs deleted file mode 100644 index 18bf12f00bc5..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/HybridComputeSettingsProperties.cs +++ /dev/null @@ -1,124 +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.Security.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Settings for hybrid compute management - /// - public partial class HybridComputeSettingsProperties - { - /// - /// Initializes a new instance of the HybridComputeSettingsProperties - /// class. - /// - public HybridComputeSettingsProperties() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the HybridComputeSettingsProperties - /// class. - /// - /// Whether or not to automatically install - /// Azure Arc (hybrid compute) agents on machines. Possible values - /// include: 'On', 'Off' - /// State of the service - /// principal and its secret. Possible values include: 'Valid', - /// 'Invalid', 'Expired' - /// The name of the resource group - /// where Arc (Hybrid Compute) connectors are connected. - /// The location where the metadata of machines - /// will be stored - /// For a non-Azure machine that is not - /// connected directly to the internet, specify a proxy server that the - /// non-Azure machine can use. - /// An object to access resources that - /// are secured by an Azure AD tenant. - public HybridComputeSettingsProperties(string autoProvision, string hybridComputeProvisioningState = default(string), string resourceGroupName = default(string), string region = default(string), ProxyServerProperties proxyServer = default(ProxyServerProperties), ServicePrincipalProperties servicePrincipal = default(ServicePrincipalProperties)) - { - HybridComputeProvisioningState = hybridComputeProvisioningState; - AutoProvision = autoProvision; - ResourceGroupName = resourceGroupName; - Region = region; - ProxyServer = proxyServer; - ServicePrincipal = servicePrincipal; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets state of the service principal and its secret. Possible values - /// include: 'Valid', 'Invalid', 'Expired' - /// - [JsonProperty(PropertyName = "hybridComputeProvisioningState")] - public string HybridComputeProvisioningState { get; private set; } - - /// - /// Gets or sets whether or not to automatically install Azure Arc - /// (hybrid compute) agents on machines. Possible values include: 'On', - /// 'Off' - /// - [JsonProperty(PropertyName = "autoProvision")] - public string AutoProvision { get; set; } - - /// - /// Gets or sets the name of the resource group where Arc (Hybrid - /// Compute) connectors are connected. - /// - [JsonProperty(PropertyName = "resourceGroupName")] - public string ResourceGroupName { get; set; } - - /// - /// Gets or sets the location where the metadata of machines will be - /// stored - /// - [JsonProperty(PropertyName = "region")] - public string Region { get; set; } - - /// - /// Gets or sets for a non-Azure machine that is not connected directly - /// to the internet, specify a proxy server that the non-Azure machine - /// can use. - /// - [JsonProperty(PropertyName = "proxyServer")] - public ProxyServerProperties ProxyServer { get; set; } - - /// - /// Gets or sets an object to access resources that are secured by an - /// Azure AD tenant. - /// - [JsonProperty(PropertyName = "servicePrincipal")] - public ServicePrincipalProperties ServicePrincipal { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (AutoProvision == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "AutoProvision"); - } - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ImplementationEffort.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ImplementationEffort.cs deleted file mode 100644 index bb650e74439d..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ImplementationEffort.cs +++ /dev/null @@ -1,23 +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.Security.Models -{ - - /// - /// Defines values for ImplementationEffort. - /// - public static class ImplementationEffort - { - public const string Low = "Low"; - public const string Moderate = "Moderate"; - public const string High = "High"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/InformationProtectionKeyword.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/InformationProtectionKeyword.cs deleted file mode 100644 index 081316c6a281..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/InformationProtectionKeyword.cs +++ /dev/null @@ -1,81 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// The information type keyword. - /// - public partial class InformationProtectionKeyword - { - /// - /// Initializes a new instance of the InformationProtectionKeyword - /// class. - /// - public InformationProtectionKeyword() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the InformationProtectionKeyword - /// class. - /// - /// The keyword pattern. - /// Indicates whether the keyword is custom or - /// not. - /// Indicates whether the keyword can be - /// applied on numeric types or not. - /// Indicates whether the keyword is excluded or - /// not. - public InformationProtectionKeyword(string pattern = default(string), bool? custom = default(bool?), bool? canBeNumeric = default(bool?), bool? excluded = default(bool?)) - { - Pattern = pattern; - Custom = custom; - CanBeNumeric = canBeNumeric; - Excluded = excluded; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the keyword pattern. - /// - [JsonProperty(PropertyName = "pattern")] - public string Pattern { get; set; } - - /// - /// Gets or sets indicates whether the keyword is custom or not. - /// - [JsonProperty(PropertyName = "custom")] - public bool? Custom { get; set; } - - /// - /// Gets or sets indicates whether the keyword can be applied on - /// numeric types or not. - /// - [JsonProperty(PropertyName = "canBeNumeric")] - public bool? CanBeNumeric { get; set; } - - /// - /// Gets or sets indicates whether the keyword is excluded or not. - /// - [JsonProperty(PropertyName = "excluded")] - public bool? Excluded { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/InformationProtectionPolicy.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/InformationProtectionPolicy.cs deleted file mode 100644 index ec242a463632..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/InformationProtectionPolicy.cs +++ /dev/null @@ -1,88 +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.Security.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Information protection policy. - /// - [Rest.Serialization.JsonTransformation] - public partial class InformationProtectionPolicy : Resource - { - /// - /// Initializes a new instance of the InformationProtectionPolicy - /// class. - /// - public InformationProtectionPolicy() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the InformationProtectionPolicy - /// class. - /// - /// Resource Id - /// Resource name - /// Resource type - /// Describes the last UTC time the - /// policy was modified. - /// Describes the version of the policy. - /// Dictionary of sensitivity labels. - /// The sensitivity information - /// types. - public InformationProtectionPolicy(string id = default(string), string name = default(string), string type = default(string), System.DateTime? lastModifiedUtc = default(System.DateTime?), string version = default(string), IDictionary labels = default(IDictionary), IDictionary informationTypes = default(IDictionary)) - : base(id, name, type) - { - LastModifiedUtc = lastModifiedUtc; - Version = version; - Labels = labels; - InformationTypes = informationTypes; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets describes the last UTC time the policy was modified. - /// - [JsonProperty(PropertyName = "properties.lastModifiedUtc")] - public System.DateTime? LastModifiedUtc { get; private set; } - - /// - /// Gets describes the version of the policy. - /// - [JsonProperty(PropertyName = "properties.version")] - public string Version { get; private set; } - - /// - /// Gets or sets dictionary of sensitivity labels. - /// - [JsonProperty(PropertyName = "properties.labels")] - public IDictionary Labels { get; set; } - - /// - /// Gets or sets the sensitivity information types. - /// - [JsonProperty(PropertyName = "properties.informationTypes")] - public IDictionary InformationTypes { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/InformationType.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/InformationType.cs deleted file mode 100644 index 928cd9418374..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/InformationType.cs +++ /dev/null @@ -1,108 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The information type. - /// - public partial class InformationType - { - /// - /// Initializes a new instance of the InformationType class. - /// - public InformationType() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the InformationType class. - /// - /// The name of the information type. - /// The description of the information - /// type. - /// The order of the information type. - /// The recommended label id to be - /// associated with this information type. - /// Indicates whether the information type is - /// enabled or not. - /// Indicates whether the information type is - /// custom or not. - /// The information type keywords. - public InformationType(string displayName = default(string), string description = default(string), int? order = default(int?), System.Guid? recommendedLabelId = default(System.Guid?), bool? enabled = default(bool?), bool? custom = default(bool?), IList keywords = default(IList)) - { - DisplayName = displayName; - Description = description; - Order = order; - RecommendedLabelId = recommendedLabelId; - Enabled = enabled; - Custom = custom; - Keywords = keywords; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the name of the information type. - /// - [JsonProperty(PropertyName = "displayName")] - public string DisplayName { get; set; } - - /// - /// Gets or sets the description of the information type. - /// - [JsonProperty(PropertyName = "description")] - public string Description { get; set; } - - /// - /// Gets or sets the order of the information type. - /// - [JsonProperty(PropertyName = "order")] - public int? Order { get; set; } - - /// - /// Gets or sets the recommended label id to be associated with this - /// information type. - /// - [JsonProperty(PropertyName = "recommendedLabelId")] - public System.Guid? RecommendedLabelId { get; set; } - - /// - /// Gets or sets indicates whether the information type is enabled or - /// not. - /// - [JsonProperty(PropertyName = "enabled")] - public bool? Enabled { get; set; } - - /// - /// Gets or sets indicates whether the information type is custom or - /// not. - /// - [JsonProperty(PropertyName = "custom")] - public bool? Custom { get; set; } - - /// - /// Gets or sets the information type keywords. - /// - [JsonProperty(PropertyName = "keywords")] - public IList Keywords { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IngestionConnectionString.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IngestionConnectionString.cs deleted file mode 100644 index f3dfa012394b..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IngestionConnectionString.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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Connection string for ingesting security data and logs - /// - public partial class IngestionConnectionString - { - /// - /// Initializes a new instance of the IngestionConnectionString class. - /// - public IngestionConnectionString() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the IngestionConnectionString class. - /// - /// The region where ingested logs and data - /// resides - /// Connection string value - public IngestionConnectionString(string location = default(string), string value = default(string)) - { - Location = location; - Value = value; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the region where ingested logs and data resides - /// - [JsonProperty(PropertyName = "location")] - public string Location { get; private set; } - - /// - /// Gets connection string value - /// - [JsonProperty(PropertyName = "value")] - public string Value { get; private set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IngestionSetting.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IngestionSetting.cs deleted file mode 100644 index c7a6adc3d336..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IngestionSetting.cs +++ /dev/null @@ -1,56 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Configures how to correlate scan data and logs with resources - /// associated with the subscription. - /// - public partial class IngestionSetting : Resource - { - /// - /// Initializes a new instance of the IngestionSetting class. - /// - public IngestionSetting() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the IngestionSetting class. - /// - /// Resource Id - /// Resource name - /// Resource type - /// Ingestion setting data - public IngestionSetting(string id = default(string), string name = default(string), string type = default(string), object properties = default(object)) - : base(id, name, type) - { - Properties = properties; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets ingestion setting data - /// - [JsonProperty(PropertyName = "properties")] - public object Properties { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IngestionSettingToken.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IngestionSettingToken.cs deleted file mode 100644 index 75bb1556dcb4..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IngestionSettingToken.cs +++ /dev/null @@ -1,54 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Configures how to correlate scan data and logs with resources - /// associated with the subscription. - /// - public partial class IngestionSettingToken - { - /// - /// Initializes a new instance of the IngestionSettingToken class. - /// - public IngestionSettingToken() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the IngestionSettingToken class. - /// - /// The token is used for correlating security data - /// and logs with the resources in the subscription. - public IngestionSettingToken(string token = default(string)) - { - Token = token; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the token is used for correlating security data and logs with - /// the resources in the subscription. - /// - [JsonProperty(PropertyName = "token")] - public string Token { get; private set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Intent.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Intent.cs deleted file mode 100644 index 671f7b602390..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Intent.cs +++ /dev/null @@ -1,117 +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.Security.Models -{ - - /// - /// Defines values for Intent. - /// - public static class Intent - { - /// - /// Unknown - /// - public const string Unknown = "Unknown"; - /// - /// PreAttack could be either 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, to scan the target system and - /// find a way in. Further details on the PreAttack stage can be read - /// in [MITRE Pre-Att&ck - /// matrix](https://attack.mitre.org/matrices/pre/). - /// - public const string PreAttack = "PreAttack"; - /// - /// InitialAccess is the stage where an attacker manages to get - /// foothold on the attacked resource. - /// - public const string InitialAccess = "InitialAccess"; - /// - /// Persistence is any access, action, or configuration change to a - /// system that gives a threat actor a persistent presence on that - /// system. - /// - 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. - /// - public const string PrivilegeEscalation = "PrivilegeEscalation"; - /// - /// Defense evasion consists of techniques an adversary may use to - /// evade detection or avoid other defenses. - /// - 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. - /// - public const string CredentialAccess = "CredentialAccess"; - /// - /// Discovery consists of techniques that allow the adversary to gain - /// knowledge about the system and internal network. - /// - 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. - /// - public const string LateralMovement = "LateralMovement"; - /// - /// The execution tactic represents techniques that result in execution - /// of adversary-controlled code on a local or remote system. - /// - 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. - /// - 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. - /// - 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"; - /// - /// Impact events primarily try to directly reduce the availability or - /// integrity of a system, service, or network; including manipulation - /// of data to impact a business or operational process. - /// - public const string Impact = "Impact"; - /// - /// Probing could be either 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. - /// - public const string Probing = "Probing"; - /// - /// Exploitation is the stage where an attacker manages to get a - /// foothold on the attacked resource. This stage is relevant for - /// compute hosts and resources such as user accounts, certificates - /// etc. - /// - public const string Exploitation = "Exploitation"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecurityAggregatedAlert.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecurityAggregatedAlert.cs deleted file mode 100644 index 6976cdba2dbb..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecurityAggregatedAlert.cs +++ /dev/null @@ -1,200 +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.Security.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Security Solution Aggregated Alert information - /// - [Rest.Serialization.JsonTransformation] - public partial class IoTSecurityAggregatedAlert - { - /// - /// Initializes a new instance of the IoTSecurityAggregatedAlert class. - /// - public IoTSecurityAggregatedAlert() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the IoTSecurityAggregatedAlert class. - /// - /// Resource Id - /// Resource name - /// Resource type - /// Resource tags - /// Name of the alert type. - /// Display name of the alert - /// type. - /// Date of detection. - /// Name of the organization that raised the - /// alert. - /// Assessed alert severity. Possible - /// values include: 'Informational', 'Low', 'Medium', 'High' - /// Recommended steps for - /// remediation. - /// Description of the suspected - /// vulnerability and meaning. - /// Number of alerts occurrences within the - /// aggregated time window. - /// Azure resource ID of the - /// resource that received the alerts. - /// The type of the alerted resource (Azure, - /// Non-Azure). - /// IoT Security solution alert - /// response. - /// Log analytics query for getting the - /// list of affected devices/alerts. - /// 10 devices with the highest number of - /// occurrences of this alert type, on this day. - public IoTSecurityAggregatedAlert(string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string alertType = default(string), string alertDisplayName = default(string), System.DateTime? aggregatedDateUtc = default(System.DateTime?), string vendorName = default(string), string reportedSeverity = default(string), string remediationSteps = default(string), string description = default(string), long? count = default(long?), string effectedResourceType = default(string), string systemSource = default(string), string actionTaken = default(string), string logAnalyticsQuery = default(string), IList topDevicesList = default(IList)) - { - Id = id; - Name = name; - Type = type; - Tags = tags; - AlertType = alertType; - AlertDisplayName = alertDisplayName; - AggregatedDateUtc = aggregatedDateUtc; - VendorName = vendorName; - ReportedSeverity = reportedSeverity; - RemediationSteps = remediationSteps; - Description = description; - Count = count; - EffectedResourceType = effectedResourceType; - SystemSource = systemSource; - ActionTaken = actionTaken; - LogAnalyticsQuery = logAnalyticsQuery; - TopDevicesList = topDevicesList; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets resource Id - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } - - /// - /// Gets resource name - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } - - /// - /// Gets resource type - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } - - /// - /// Gets or sets resource tags - /// - [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; set; } - - /// - /// Gets name of the alert type. - /// - [JsonProperty(PropertyName = "properties.alertType")] - public string AlertType { get; private set; } - - /// - /// Gets display name of the alert type. - /// - [JsonProperty(PropertyName = "properties.alertDisplayName")] - public string AlertDisplayName { get; private set; } - - /// - /// Gets date of detection. - /// - [JsonConverter(typeof(DateJsonConverter))] - [JsonProperty(PropertyName = "properties.aggregatedDateUtc")] - public System.DateTime? AggregatedDateUtc { get; private set; } - - /// - /// Gets name of the organization that raised the alert. - /// - [JsonProperty(PropertyName = "properties.vendorName")] - public string VendorName { get; private set; } - - /// - /// Gets assessed alert severity. Possible values include: - /// 'Informational', 'Low', 'Medium', 'High' - /// - [JsonProperty(PropertyName = "properties.reportedSeverity")] - public string ReportedSeverity { get; private set; } - - /// - /// Gets recommended steps for remediation. - /// - [JsonProperty(PropertyName = "properties.remediationSteps")] - public string RemediationSteps { get; private set; } - - /// - /// Gets description of the suspected vulnerability and meaning. - /// - [JsonProperty(PropertyName = "properties.description")] - public string Description { get; private set; } - - /// - /// Gets number of alerts occurrences within the aggregated time - /// window. - /// - [JsonProperty(PropertyName = "properties.count")] - public long? Count { get; private set; } - - /// - /// Gets azure resource ID of the resource that received the alerts. - /// - [JsonProperty(PropertyName = "properties.effectedResourceType")] - public string EffectedResourceType { get; private set; } - - /// - /// Gets the type of the alerted resource (Azure, Non-Azure). - /// - [JsonProperty(PropertyName = "properties.systemSource")] - public string SystemSource { get; private set; } - - /// - /// Gets ioT Security solution alert response. - /// - [JsonProperty(PropertyName = "properties.actionTaken")] - public string ActionTaken { get; private set; } - - /// - /// Gets log analytics query for getting the list of affected - /// devices/alerts. - /// - [JsonProperty(PropertyName = "properties.logAnalyticsQuery")] - public string LogAnalyticsQuery { get; private set; } - - /// - /// Gets 10 devices with the highest number of occurrences of this - /// alert type, on this day. - /// - [JsonProperty(PropertyName = "properties.topDevicesList")] - public IList TopDevicesList { get; private set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecurityAggregatedAlertPropertiesTopDevicesListItem.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecurityAggregatedAlertPropertiesTopDevicesListItem.cs deleted file mode 100644 index e99cf861e643..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecurityAggregatedAlertPropertiesTopDevicesListItem.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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - public partial class IoTSecurityAggregatedAlertPropertiesTopDevicesListItem - { - /// - /// Initializes a new instance of the - /// IoTSecurityAggregatedAlertPropertiesTopDevicesListItem class. - /// - public IoTSecurityAggregatedAlertPropertiesTopDevicesListItem() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// IoTSecurityAggregatedAlertPropertiesTopDevicesListItem class. - /// - /// Name of the device. - /// Number of alerts raised for this - /// device. - /// Most recent time this alert was raised - /// for this device, on this day. - public IoTSecurityAggregatedAlertPropertiesTopDevicesListItem(string deviceId = default(string), long? alertsCount = default(long?), string lastOccurrence = default(string)) - { - DeviceId = deviceId; - AlertsCount = alertsCount; - LastOccurrence = lastOccurrence; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets name of the device. - /// - [JsonProperty(PropertyName = "deviceId")] - public string DeviceId { get; private set; } - - /// - /// Gets number of alerts raised for this device. - /// - [JsonProperty(PropertyName = "alertsCount")] - public long? AlertsCount { get; private set; } - - /// - /// Gets most recent time this alert was raised for this device, on - /// this day. - /// - [JsonProperty(PropertyName = "lastOccurrence")] - public string LastOccurrence { get; private set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecurityAggregatedRecommendation.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecurityAggregatedRecommendation.cs deleted file mode 100644 index 10cb785cc6f8..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecurityAggregatedRecommendation.cs +++ /dev/null @@ -1,175 +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.Security.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// IoT Security solution recommendation information. - /// - [Rest.Serialization.JsonTransformation] - public partial class IoTSecurityAggregatedRecommendation - { - /// - /// Initializes a new instance of the - /// IoTSecurityAggregatedRecommendation class. - /// - public IoTSecurityAggregatedRecommendation() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// IoTSecurityAggregatedRecommendation class. - /// - /// Resource Id - /// Resource name - /// Resource type - /// Resource tags - /// Name of the - /// recommendation. - /// Display name of the - /// recommendation type. - /// Description of the suspected - /// vulnerability and meaning. - /// Recommendation-type - /// GUID. - /// Name of the organization that made the - /// recommendation. - /// Recommended steps for - /// remediation - /// Assessed recommendation severity. - /// Possible values include: 'Informational', 'Low', 'Medium', - /// 'High' - /// Number of healthy devices within the - /// IoT Security solution. - /// Number of unhealthy devices - /// within the IoT Security solution. - /// Log analytics query for getting the - /// list of affected devices/alerts. - public IoTSecurityAggregatedRecommendation(string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string recommendationName = default(string), string recommendationDisplayName = default(string), string description = default(string), string recommendationTypeId = default(string), string detectedBy = default(string), string remediationSteps = default(string), string reportedSeverity = default(string), long? healthyDevices = default(long?), long? unhealthyDeviceCount = default(long?), string logAnalyticsQuery = default(string)) - { - Id = id; - Name = name; - Type = type; - Tags = tags; - RecommendationName = recommendationName; - RecommendationDisplayName = recommendationDisplayName; - Description = description; - RecommendationTypeId = recommendationTypeId; - DetectedBy = detectedBy; - RemediationSteps = remediationSteps; - ReportedSeverity = reportedSeverity; - HealthyDevices = healthyDevices; - UnhealthyDeviceCount = unhealthyDeviceCount; - LogAnalyticsQuery = logAnalyticsQuery; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets resource Id - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } - - /// - /// Gets resource name - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } - - /// - /// Gets resource type - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } - - /// - /// Gets or sets resource tags - /// - [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; set; } - - /// - /// Gets or sets name of the recommendation. - /// - [JsonProperty(PropertyName = "properties.recommendationName")] - public string RecommendationName { get; set; } - - /// - /// Gets display name of the recommendation type. - /// - [JsonProperty(PropertyName = "properties.recommendationDisplayName")] - public string RecommendationDisplayName { get; private set; } - - /// - /// Gets description of the suspected vulnerability and meaning. - /// - [JsonProperty(PropertyName = "properties.description")] - public string Description { get; private set; } - - /// - /// Gets recommendation-type GUID. - /// - [JsonProperty(PropertyName = "properties.recommendationTypeId")] - public string RecommendationTypeId { get; private set; } - - /// - /// Gets name of the organization that made the recommendation. - /// - [JsonProperty(PropertyName = "properties.detectedBy")] - public string DetectedBy { get; private set; } - - /// - /// Gets recommended steps for remediation - /// - [JsonProperty(PropertyName = "properties.remediationSteps")] - public string RemediationSteps { get; private set; } - - /// - /// Gets assessed recommendation severity. Possible values include: - /// 'Informational', 'Low', 'Medium', 'High' - /// - [JsonProperty(PropertyName = "properties.reportedSeverity")] - public string ReportedSeverity { get; private set; } - - /// - /// Gets number of healthy devices within the IoT Security solution. - /// - [JsonProperty(PropertyName = "properties.healthyDevices")] - public long? HealthyDevices { get; private set; } - - /// - /// Gets number of unhealthy devices within the IoT Security solution. - /// - [JsonProperty(PropertyName = "properties.unhealthyDeviceCount")] - public long? UnhealthyDeviceCount { get; private set; } - - /// - /// Gets log analytics query for getting the list of affected - /// devices/alerts. - /// - [JsonProperty(PropertyName = "properties.logAnalyticsQuery")] - public string LogAnalyticsQuery { get; private set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecurityAlertedDevice.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecurityAlertedDevice.cs deleted file mode 100644 index 370ea29693b8..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecurityAlertedDevice.cs +++ /dev/null @@ -1,61 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Statistical information about the number of alerts per device during - /// last set number of days. - /// - public partial class IoTSecurityAlertedDevice - { - /// - /// Initializes a new instance of the IoTSecurityAlertedDevice class. - /// - public IoTSecurityAlertedDevice() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the IoTSecurityAlertedDevice class. - /// - /// Device identifier. - /// Number of alerts raised for this - /// device. - public IoTSecurityAlertedDevice(string deviceId = default(string), long? alertsCount = default(long?)) - { - DeviceId = deviceId; - AlertsCount = alertsCount; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets device identifier. - /// - [JsonProperty(PropertyName = "deviceId")] - public string DeviceId { get; private set; } - - /// - /// Gets number of alerts raised for this device. - /// - [JsonProperty(PropertyName = "alertsCount")] - public long? AlertsCount { get; private set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecurityDeviceAlert.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecurityDeviceAlert.cs deleted file mode 100644 index fcc0b588b6c1..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecurityDeviceAlert.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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Statistical information about the number of alerts per alert type - /// during last set number of days - /// - public partial class IoTSecurityDeviceAlert - { - /// - /// Initializes a new instance of the IoTSecurityDeviceAlert class. - /// - public IoTSecurityDeviceAlert() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the IoTSecurityDeviceAlert class. - /// - /// Display name of the alert - /// Assessed Alert severity. Possible - /// values include: 'Informational', 'Low', 'Medium', 'High' - /// Number of alerts raised for this alert - /// type. - public IoTSecurityDeviceAlert(string alertDisplayName = default(string), string reportedSeverity = default(string), long? alertsCount = default(long?)) - { - AlertDisplayName = alertDisplayName; - ReportedSeverity = reportedSeverity; - AlertsCount = alertsCount; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets display name of the alert - /// - [JsonProperty(PropertyName = "alertDisplayName")] - public string AlertDisplayName { get; private set; } - - /// - /// Gets assessed Alert severity. Possible values include: - /// 'Informational', 'Low', 'Medium', 'High' - /// - [JsonProperty(PropertyName = "reportedSeverity")] - public string ReportedSeverity { get; private set; } - - /// - /// Gets number of alerts raised for this alert type. - /// - [JsonProperty(PropertyName = "alertsCount")] - public long? AlertsCount { get; private set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecurityDeviceRecommendation.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecurityDeviceRecommendation.cs deleted file mode 100644 index 273a5f40b9c5..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecurityDeviceRecommendation.cs +++ /dev/null @@ -1,75 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Statistical information about the number of recommendations per device, - /// per recommendation type. - /// - public partial class IoTSecurityDeviceRecommendation - { - /// - /// Initializes a new instance of the IoTSecurityDeviceRecommendation - /// class. - /// - public IoTSecurityDeviceRecommendation() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the IoTSecurityDeviceRecommendation - /// class. - /// - /// Display name of the - /// recommendation. - /// Assessed recommendation severity. - /// Possible values include: 'Informational', 'Low', 'Medium', - /// 'High' - /// Number of devices with this - /// recommendation. - public IoTSecurityDeviceRecommendation(string recommendationDisplayName = default(string), string reportedSeverity = default(string), long? devicesCount = default(long?)) - { - RecommendationDisplayName = recommendationDisplayName; - ReportedSeverity = reportedSeverity; - DevicesCount = devicesCount; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets display name of the recommendation. - /// - [JsonProperty(PropertyName = "recommendationDisplayName")] - public string RecommendationDisplayName { get; private set; } - - /// - /// Gets assessed recommendation severity. Possible values include: - /// 'Informational', 'Low', 'Medium', 'High' - /// - [JsonProperty(PropertyName = "reportedSeverity")] - public string ReportedSeverity { get; private set; } - - /// - /// Gets number of devices with this recommendation. - /// - [JsonProperty(PropertyName = "devicesCount")] - public long? DevicesCount { get; private set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecuritySolutionAnalyticsModel.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecuritySolutionAnalyticsModel.cs deleted file mode 100644 index d9b4829a9e80..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecuritySolutionAnalyticsModel.cs +++ /dev/null @@ -1,108 +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.Security.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Security analytics of your IoT Security solution - /// - [Rest.Serialization.JsonTransformation] - public partial class IoTSecuritySolutionAnalyticsModel : Resource - { - /// - /// Initializes a new instance of the IoTSecuritySolutionAnalyticsModel - /// class. - /// - public IoTSecuritySolutionAnalyticsModel() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the IoTSecuritySolutionAnalyticsModel - /// class. - /// - /// Resource Id - /// Resource name - /// Resource type - /// Security analytics of your IoT Security - /// solution. - /// Number of unhealthy devices - /// within your IoT Security solution. - /// List of device metrics by the - /// aggregation date. - /// List of the 3 devices with the most - /// alerts. - /// List of the 3 most - /// prevalent device alerts. - /// List of the 3 most - /// prevalent device recommendations. - public IoTSecuritySolutionAnalyticsModel(string id = default(string), string name = default(string), string type = default(string), IoTSeverityMetrics metrics = default(IoTSeverityMetrics), long? unhealthyDeviceCount = default(long?), IList devicesMetrics = default(IList), IList topAlertedDevices = default(IList), IList mostPrevalentDeviceAlerts = default(IList), IList mostPrevalentDeviceRecommendations = default(IList)) - : base(id, name, type) - { - Metrics = metrics; - UnhealthyDeviceCount = unhealthyDeviceCount; - DevicesMetrics = devicesMetrics; - TopAlertedDevices = topAlertedDevices; - MostPrevalentDeviceAlerts = mostPrevalentDeviceAlerts; - MostPrevalentDeviceRecommendations = mostPrevalentDeviceRecommendations; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets security analytics of your IoT Security solution. - /// - [JsonProperty(PropertyName = "properties.metrics")] - public IoTSeverityMetrics Metrics { get; private set; } - - /// - /// Gets number of unhealthy devices within your IoT Security solution. - /// - [JsonProperty(PropertyName = "properties.unhealthyDeviceCount")] - public long? UnhealthyDeviceCount { get; private set; } - - /// - /// Gets list of device metrics by the aggregation date. - /// - [JsonProperty(PropertyName = "properties.devicesMetrics")] - public IList DevicesMetrics { get; private set; } - - /// - /// Gets or sets list of the 3 devices with the most alerts. - /// - [JsonProperty(PropertyName = "properties.topAlertedDevices")] - public IList TopAlertedDevices { get; set; } - - /// - /// Gets or sets list of the 3 most prevalent device alerts. - /// - [JsonProperty(PropertyName = "properties.mostPrevalentDeviceAlerts")] - public IList MostPrevalentDeviceAlerts { get; set; } - - /// - /// Gets or sets list of the 3 most prevalent device recommendations. - /// - [JsonProperty(PropertyName = "properties.mostPrevalentDeviceRecommendations")] - public IList MostPrevalentDeviceRecommendations { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecuritySolutionAnalyticsModelList.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecuritySolutionAnalyticsModelList.cs deleted file mode 100644 index 2dbfcc768ce6..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecuritySolutionAnalyticsModelList.cs +++ /dev/null @@ -1,81 +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.Security.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// List of Security analytics of your IoT Security solution - /// - public partial class IoTSecuritySolutionAnalyticsModelList - { - /// - /// Initializes a new instance of the - /// IoTSecuritySolutionAnalyticsModelList class. - /// - public IoTSecuritySolutionAnalyticsModelList() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// IoTSecuritySolutionAnalyticsModelList class. - /// - /// List of Security analytics of your IoT Security - /// solution - /// When there is too much alert data for one - /// page, use this URI to fetch the next page. - public IoTSecuritySolutionAnalyticsModelList(IList value, string nextLink = default(string)) - { - Value = value; - NextLink = nextLink; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets list of Security analytics of your IoT Security - /// solution - /// - [JsonProperty(PropertyName = "value")] - public IList Value { get; set; } - - /// - /// Gets when there is too much alert data for one page, use this URI - /// to fetch the next page. - /// - [JsonProperty(PropertyName = "nextLink")] - public string NextLink { get; private 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem.cs deleted file mode 100644 index aee9300681d2..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem.cs +++ /dev/null @@ -1,63 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - public partial class IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem - { - /// - /// Initializes a new instance of the - /// IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem - /// class. - /// - public IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem - /// class. - /// - /// Aggregation of IoT Security solution device - /// alert metrics by date. - /// Device alert count by - /// severity. - public IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem(System.DateTime? date = default(System.DateTime?), IoTSeverityMetrics devicesMetrics = default(IoTSeverityMetrics)) - { - Date = date; - DevicesMetrics = devicesMetrics; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets aggregation of IoT Security solution device alert - /// metrics by date. - /// - [JsonProperty(PropertyName = "date")] - public System.DateTime? Date { get; set; } - - /// - /// Gets or sets device alert count by severity. - /// - [JsonProperty(PropertyName = "devicesMetrics")] - public IoTSeverityMetrics DevicesMetrics { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecuritySolutionModel.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecuritySolutionModel.cs deleted file mode 100644 index 513d7a6b5754..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSecuritySolutionModel.cs +++ /dev/null @@ -1,225 +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.Security.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// IoT Security solution configuration and resource information. - /// - [Rest.Serialization.JsonTransformation] - public partial class IoTSecuritySolutionModel - { - /// - /// Initializes a new instance of the IoTSecuritySolutionModel class. - /// - public IoTSecuritySolutionModel() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the IoTSecuritySolutionModel class. - /// - /// Resource display name. - /// IoT Hub resource IDs - /// Resource Id - /// Resource name - /// Resource type - /// Resource tags - /// The resource location. - /// Workspace resource ID - /// Status of the IoT Security solution. Possible - /// values include: 'Enabled', 'Disabled' - /// List of additional options for exporting to - /// workspace data. - /// Disabled data sources. Disabling - /// these data sources compromises the system. - /// List of resources that were - /// automatically discovered as relevant to the security - /// solution. - /// Unmasked IP address logging - /// status. Possible values include: 'Disabled', 'Enabled' - /// List of additional - /// workspaces - /// Azure Resource Manager metadata containing - /// createdBy and modifiedBy information. - public IoTSecuritySolutionModel(string displayName, IList iotHubs, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string location = default(string), string workspace = default(string), string status = default(string), IList export = default(IList), IList disabledDataSources = default(IList), UserDefinedResourcesProperties userDefinedResources = default(UserDefinedResourcesProperties), IList autoDiscoveredResources = default(IList), IList recommendationsConfiguration = default(IList), string unmaskedIpLoggingStatus = default(string), IList additionalWorkspaces = default(IList), SystemData systemData = default(SystemData)) - { - Id = id; - Name = name; - Type = type; - Tags = tags; - Location = location; - Workspace = workspace; - DisplayName = displayName; - Status = status; - Export = export; - DisabledDataSources = disabledDataSources; - IotHubs = iotHubs; - UserDefinedResources = userDefinedResources; - AutoDiscoveredResources = autoDiscoveredResources; - RecommendationsConfiguration = recommendationsConfiguration; - UnmaskedIpLoggingStatus = unmaskedIpLoggingStatus; - AdditionalWorkspaces = additionalWorkspaces; - SystemData = systemData; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets resource Id - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } - - /// - /// Gets resource name - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } - - /// - /// Gets resource type - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } - - /// - /// Gets or sets resource tags - /// - [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; set; } - - /// - /// Gets or sets the resource location. - /// - [JsonProperty(PropertyName = "location")] - public string Location { get; set; } - - /// - /// Gets or sets workspace resource ID - /// - [JsonProperty(PropertyName = "properties.workspace")] - public string Workspace { get; set; } - - /// - /// Gets or sets resource display name. - /// - [JsonProperty(PropertyName = "properties.displayName")] - public string DisplayName { get; set; } - - /// - /// Gets or sets status of the IoT Security solution. Possible values - /// include: 'Enabled', 'Disabled' - /// - [JsonProperty(PropertyName = "properties.status")] - public string Status { get; set; } - - /// - /// Gets or sets list of additional options for exporting to workspace - /// data. - /// - [JsonProperty(PropertyName = "properties.export")] - public IList Export { get; set; } - - /// - /// Gets or sets disabled data sources. Disabling these data sources - /// compromises the system. - /// - [JsonProperty(PropertyName = "properties.disabledDataSources")] - public IList DisabledDataSources { get; set; } - - /// - /// Gets or sets ioT Hub resource IDs - /// - [JsonProperty(PropertyName = "properties.iotHubs")] - public IList IotHubs { get; set; } - - /// - /// - [JsonProperty(PropertyName = "properties.userDefinedResources")] - public UserDefinedResourcesProperties UserDefinedResources { get; set; } - - /// - /// Gets list of resources that were automatically discovered as - /// relevant to the security solution. - /// - [JsonProperty(PropertyName = "properties.autoDiscoveredResources")] - public IList AutoDiscoveredResources { get; private set; } - - /// - /// - [JsonProperty(PropertyName = "properties.recommendationsConfiguration")] - public IList RecommendationsConfiguration { get; set; } - - /// - /// Gets or sets unmasked IP address logging status. Possible values - /// include: 'Disabled', 'Enabled' - /// - [JsonProperty(PropertyName = "properties.unmaskedIpLoggingStatus")] - public string UnmaskedIpLoggingStatus { get; set; } - - /// - /// Gets or sets list of additional workspaces - /// - [JsonProperty(PropertyName = "properties.additionalWorkspaces")] - public IList AdditionalWorkspaces { get; set; } - - /// - /// Gets azure Resource Manager metadata containing createdBy and - /// modifiedBy information. - /// - [JsonProperty(PropertyName = "systemData")] - public SystemData SystemData { get; private set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (DisplayName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "DisplayName"); - } - if (IotHubs == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "IotHubs"); - } - if (UserDefinedResources != null) - { - UserDefinedResources.Validate(); - } - if (RecommendationsConfiguration != null) - { - foreach (var element in RecommendationsConfiguration) - { - if (element != null) - { - element.Validate(); - } - } - } - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSeverityMetrics.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSeverityMetrics.cs deleted file mode 100644 index 71fc0a7748c7..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IoTSeverityMetrics.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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// IoT Security solution analytics severity metrics. - /// - public partial class IoTSeverityMetrics - { - /// - /// Initializes a new instance of the IoTSeverityMetrics class. - /// - public IoTSeverityMetrics() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the IoTSeverityMetrics class. - /// - /// Count of high severity - /// alerts/recommendations. - /// Count of medium severity - /// alerts/recommendations. - /// Count of low severity - /// alerts/recommendations. - public IoTSeverityMetrics(long? high = default(long?), long? medium = default(long?), long? low = default(long?)) - { - High = high; - Medium = medium; - Low = low; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets count of high severity alerts/recommendations. - /// - [JsonProperty(PropertyName = "high")] - public long? High { get; set; } - - /// - /// Gets or sets count of medium severity alerts/recommendations. - /// - [JsonProperty(PropertyName = "medium")] - public long? Medium { get; set; } - - /// - /// Gets or sets count of low severity alerts/recommendations. - /// - [JsonProperty(PropertyName = "low")] - public long? Low { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/JitNetworkAccessPolicy.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/JitNetworkAccessPolicy.cs deleted file mode 100644 index dd50ff3c5eb5..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/JitNetworkAccessPolicy.cs +++ /dev/null @@ -1,144 +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.Security.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - [Rest.Serialization.JsonTransformation] - public partial class JitNetworkAccessPolicy - { - /// - /// Initializes a new instance of the JitNetworkAccessPolicy class. - /// - public JitNetworkAccessPolicy() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the JitNetworkAccessPolicy class. - /// - /// Configurations for - /// Microsoft.Compute/virtualMachines resource type. - /// Resource Id - /// Resource name - /// Resource type - /// Kind of the resource - /// Location where the resource is - /// stored - /// Gets the provisioning state of the - /// Just-in-Time policy. - public JitNetworkAccessPolicy(IList virtualMachines, string id = default(string), string name = default(string), string type = default(string), string kind = default(string), string location = default(string), IList requests = default(IList), string provisioningState = default(string)) - { - Id = id; - Name = name; - Type = type; - Kind = kind; - Location = location; - VirtualMachines = virtualMachines; - Requests = requests; - ProvisioningState = provisioningState; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets resource Id - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } - - /// - /// Gets resource name - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } - - /// - /// Gets resource type - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } - - /// - /// Gets or sets kind of the resource - /// - [JsonProperty(PropertyName = "kind")] - public string Kind { get; set; } - - /// - /// Gets location where the resource is stored - /// - [JsonProperty(PropertyName = "location")] - public string Location { get; private set; } - - /// - /// Gets or sets configurations for Microsoft.Compute/virtualMachines - /// resource type. - /// - [JsonProperty(PropertyName = "properties.virtualMachines")] - public IList VirtualMachines { get; set; } - - /// - /// - [JsonProperty(PropertyName = "properties.requests")] - public IList Requests { get; set; } - - /// - /// Gets the provisioning state of the Just-in-Time policy. - /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; private set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (VirtualMachines == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "VirtualMachines"); - } - if (VirtualMachines != null) - { - foreach (var element in VirtualMachines) - { - if (element != null) - { - element.Validate(); - } - } - } - if (Requests != null) - { - foreach (var element1 in Requests) - { - if (element1 != null) - { - element1.Validate(); - } - } - } - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/JitNetworkAccessPolicyInitiatePort.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/JitNetworkAccessPolicyInitiatePort.cs deleted file mode 100644 index 3ba8881a47ae..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/JitNetworkAccessPolicyInitiatePort.cs +++ /dev/null @@ -1,78 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - public partial class JitNetworkAccessPolicyInitiatePort - { - /// - /// Initializes a new instance of the - /// JitNetworkAccessPolicyInitiatePort class. - /// - public JitNetworkAccessPolicyInitiatePort() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// JitNetworkAccessPolicyInitiatePort class. - /// - /// The time to close the request in - /// UTC - /// Source of the allowed - /// traffic. If omitted, the request will be for the source IP address - /// of the initiate request. - public JitNetworkAccessPolicyInitiatePort(int number, System.DateTime endTimeUtc, string allowedSourceAddressPrefix = default(string)) - { - Number = number; - AllowedSourceAddressPrefix = allowedSourceAddressPrefix; - EndTimeUtc = endTimeUtc; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "number")] - public int Number { get; set; } - - /// - /// Gets or sets source of the allowed traffic. If omitted, the request - /// will be for the source IP address of the initiate request. - /// - [JsonProperty(PropertyName = "allowedSourceAddressPrefix")] - public string AllowedSourceAddressPrefix { get; set; } - - /// - /// Gets or sets the time to close the request in UTC - /// - [JsonProperty(PropertyName = "endTimeUtc")] - public System.DateTime EndTimeUtc { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - //Nothing to validate - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/JitNetworkAccessPolicyInitiateRequest.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/JitNetworkAccessPolicyInitiateRequest.cs deleted file mode 100644 index a200477d08ac..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/JitNetworkAccessPolicyInitiateRequest.cs +++ /dev/null @@ -1,87 +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.Security.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - public partial class JitNetworkAccessPolicyInitiateRequest - { - /// - /// Initializes a new instance of the - /// JitNetworkAccessPolicyInitiateRequest class. - /// - public JitNetworkAccessPolicyInitiateRequest() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// JitNetworkAccessPolicyInitiateRequest class. - /// - /// A list of virtual machines & - /// ports to open access for - /// The justification for making the - /// initiate request - public JitNetworkAccessPolicyInitiateRequest(IList virtualMachines, string justification = default(string)) - { - VirtualMachines = virtualMachines; - Justification = justification; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets a list of virtual machines &amp; ports to open - /// access for - /// - [JsonProperty(PropertyName = "virtualMachines")] - public IList VirtualMachines { get; set; } - - /// - /// Gets or sets the justification for making the initiate request - /// - [JsonProperty(PropertyName = "justification")] - public string Justification { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (VirtualMachines == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "VirtualMachines"); - } - if (VirtualMachines != null) - { - foreach (var element in VirtualMachines) - { - if (element != null) - { - element.Validate(); - } - } - } - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/JitNetworkAccessPolicyInitiateVirtualMachine.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/JitNetworkAccessPolicyInitiateVirtualMachine.cs deleted file mode 100644 index 184efe058a64..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/JitNetworkAccessPolicyInitiateVirtualMachine.cs +++ /dev/null @@ -1,91 +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.Security.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - public partial class JitNetworkAccessPolicyInitiateVirtualMachine - { - /// - /// Initializes a new instance of the - /// JitNetworkAccessPolicyInitiateVirtualMachine class. - /// - public JitNetworkAccessPolicyInitiateVirtualMachine() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// JitNetworkAccessPolicyInitiateVirtualMachine class. - /// - /// Resource ID of the virtual machine that is linked - /// to this policy - /// The ports to open for the resource with the - /// `id` - public JitNetworkAccessPolicyInitiateVirtualMachine(string id, IList ports) - { - Id = id; - Ports = ports; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets resource ID of the virtual machine that is linked to - /// this policy - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - /// - /// Gets or sets the ports to open for the resource with the `id` - /// - [JsonProperty(PropertyName = "ports")] - public IList Ports { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Id == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Id"); - } - if (Ports == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Ports"); - } - if (Ports != null) - { - foreach (var element in Ports) - { - if (element != null) - { - element.Validate(); - } - } - } - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/JitNetworkAccessPolicyVirtualMachine.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/JitNetworkAccessPolicyVirtualMachine.cs deleted file mode 100644 index d9317bcb088a..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/JitNetworkAccessPolicyVirtualMachine.cs +++ /dev/null @@ -1,101 +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.Security.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - public partial class JitNetworkAccessPolicyVirtualMachine - { - /// - /// Initializes a new instance of the - /// JitNetworkAccessPolicyVirtualMachine class. - /// - public JitNetworkAccessPolicyVirtualMachine() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// JitNetworkAccessPolicyVirtualMachine class. - /// - /// Resource ID of the virtual machine that is linked - /// to this policy - /// Port configurations for the virtual - /// machine - /// Public IP address of the Azure - /// Firewall that is linked to this policy, if applicable - public JitNetworkAccessPolicyVirtualMachine(string id, IList ports, string publicIpAddress = default(string)) - { - Id = id; - Ports = ports; - PublicIpAddress = publicIpAddress; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets resource ID of the virtual machine that is linked to - /// this policy - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - /// - /// Gets or sets port configurations for the virtual machine - /// - [JsonProperty(PropertyName = "ports")] - public IList Ports { get; set; } - - /// - /// Gets or sets public IP address of the Azure Firewall that is linked - /// to this policy, if applicable - /// - [JsonProperty(PropertyName = "publicIpAddress")] - public string PublicIpAddress { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Id == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Id"); - } - if (Ports == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Ports"); - } - if (Ports != null) - { - foreach (var element in Ports) - { - if (element != null) - { - element.Validate(); - } - } - } - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/JitNetworkAccessPortRule.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/JitNetworkAccessPortRule.cs deleted file mode 100644 index bf465a75df8e..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/JitNetworkAccessPortRule.cs +++ /dev/null @@ -1,109 +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.Security.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - public partial class JitNetworkAccessPortRule - { - /// - /// Initializes a new instance of the JitNetworkAccessPortRule class. - /// - public JitNetworkAccessPortRule() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the JitNetworkAccessPortRule class. - /// - /// Possible values include: 'TCP', 'UDP', - /// 'All' - /// Maximum duration requests - /// can be made for. In ISO 8601 duration format. Minimum 5 minutes, - /// maximum 1 day - /// Mutually exclusive with - /// the "allowedSourceAddressPrefixes" parameter. Should be an IP - /// address or CIDR, for example "192.168.0.3" or - /// "192.168.0.0/16". - /// Mutually exclusive with - /// the "allowedSourceAddressPrefix" parameter. - public JitNetworkAccessPortRule(int number, string protocol, string maxRequestAccessDuration, string allowedSourceAddressPrefix = default(string), IList allowedSourceAddressPrefixes = default(IList)) - { - Number = number; - Protocol = protocol; - AllowedSourceAddressPrefix = allowedSourceAddressPrefix; - AllowedSourceAddressPrefixes = allowedSourceAddressPrefixes; - MaxRequestAccessDuration = maxRequestAccessDuration; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "number")] - public int Number { get; set; } - - /// - /// Gets or sets possible values include: 'TCP', 'UDP', 'All' - /// - [JsonProperty(PropertyName = "protocol")] - public string Protocol { get; set; } - - /// - /// Gets or sets mutually exclusive with the - /// "allowedSourceAddressPrefixes" parameter. Should be an IP address - /// or CIDR, for example "192.168.0.3" or "192.168.0.0/16". - /// - [JsonProperty(PropertyName = "allowedSourceAddressPrefix")] - public string AllowedSourceAddressPrefix { get; set; } - - /// - /// Gets or sets mutually exclusive with the - /// "allowedSourceAddressPrefix" parameter. - /// - [JsonProperty(PropertyName = "allowedSourceAddressPrefixes")] - public IList AllowedSourceAddressPrefixes { get; set; } - - /// - /// Gets or sets maximum duration requests can be made for. In ISO 8601 - /// duration format. Minimum 5 minutes, maximum 1 day - /// - [JsonProperty(PropertyName = "maxRequestAccessDuration")] - public string MaxRequestAccessDuration { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Protocol == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Protocol"); - } - if (MaxRequestAccessDuration == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "MaxRequestAccessDuration"); - } - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/JitNetworkAccessRequest.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/JitNetworkAccessRequest.cs deleted file mode 100644 index e0c69789405e..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/JitNetworkAccessRequest.cs +++ /dev/null @@ -1,103 +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.Security.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - public partial class JitNetworkAccessRequest - { - /// - /// Initializes a new instance of the JitNetworkAccessRequest class. - /// - public JitNetworkAccessRequest() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the JitNetworkAccessRequest class. - /// - /// The start time of the request in - /// UTC - /// The identity of the person who made the - /// request - /// The justification for making the - /// initiate request - public JitNetworkAccessRequest(IList virtualMachines, System.DateTime startTimeUtc, string requestor, string justification = default(string)) - { - VirtualMachines = virtualMachines; - StartTimeUtc = startTimeUtc; - Requestor = requestor; - Justification = justification; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "virtualMachines")] - public IList VirtualMachines { get; set; } - - /// - /// Gets or sets the start time of the request in UTC - /// - [JsonProperty(PropertyName = "startTimeUtc")] - public System.DateTime StartTimeUtc { get; set; } - - /// - /// Gets or sets the identity of the person who made the request - /// - [JsonProperty(PropertyName = "requestor")] - public string Requestor { get; set; } - - /// - /// Gets or sets the justification for making the initiate request - /// - [JsonProperty(PropertyName = "justification")] - public string Justification { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (VirtualMachines == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "VirtualMachines"); - } - if (Requestor == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Requestor"); - } - if (VirtualMachines != null) - { - foreach (var element in VirtualMachines) - { - if (element != null) - { - element.Validate(); - } - } - } - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/JitNetworkAccessRequestPort.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/JitNetworkAccessRequestPort.cs deleted file mode 100644 index 18a2297f1887..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/JitNetworkAccessRequestPort.cs +++ /dev/null @@ -1,133 +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.Security.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - public partial class JitNetworkAccessRequestPort - { - /// - /// Initializes a new instance of the JitNetworkAccessRequestPort - /// class. - /// - public JitNetworkAccessRequestPort() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the JitNetworkAccessRequestPort - /// class. - /// - /// The date & time at which the request - /// ends in UTC - /// The status of the port. Possible values - /// include: 'Revoked', 'Initiated' - /// A description of why the `status` has - /// its value. Possible values include: 'Expired', 'UserRequested', - /// 'NewerRequestInitiated' - /// Mutually exclusive with - /// the "allowedSourceAddressPrefixes" parameter. Should be an IP - /// address or CIDR, for example "192.168.0.3" or - /// "192.168.0.0/16". - /// Mutually exclusive with - /// the "allowedSourceAddressPrefix" parameter. - /// The port which is mapped to this port's - /// `number` in the Azure Firewall, if applicable - public JitNetworkAccessRequestPort(int number, System.DateTime endTimeUtc, string status, string statusReason, string allowedSourceAddressPrefix = default(string), IList allowedSourceAddressPrefixes = default(IList), int? mappedPort = default(int?)) - { - Number = number; - AllowedSourceAddressPrefix = allowedSourceAddressPrefix; - AllowedSourceAddressPrefixes = allowedSourceAddressPrefixes; - EndTimeUtc = endTimeUtc; - Status = status; - StatusReason = statusReason; - MappedPort = mappedPort; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "number")] - public int Number { get; set; } - - /// - /// Gets or sets mutually exclusive with the - /// "allowedSourceAddressPrefixes" parameter. Should be an IP address - /// or CIDR, for example "192.168.0.3" or "192.168.0.0/16". - /// - [JsonProperty(PropertyName = "allowedSourceAddressPrefix")] - public string AllowedSourceAddressPrefix { get; set; } - - /// - /// Gets or sets mutually exclusive with the - /// "allowedSourceAddressPrefix" parameter. - /// - [JsonProperty(PropertyName = "allowedSourceAddressPrefixes")] - public IList AllowedSourceAddressPrefixes { get; set; } - - /// - /// Gets or sets the date &amp; time at which the request ends in - /// UTC - /// - [JsonProperty(PropertyName = "endTimeUtc")] - public System.DateTime EndTimeUtc { get; set; } - - /// - /// Gets or sets the status of the port. Possible values include: - /// 'Revoked', 'Initiated' - /// - [JsonProperty(PropertyName = "status")] - public string Status { get; set; } - - /// - /// Gets or sets a description of why the `status` has its value. - /// Possible values include: 'Expired', 'UserRequested', - /// 'NewerRequestInitiated' - /// - [JsonProperty(PropertyName = "statusReason")] - public string StatusReason { get; set; } - - /// - /// Gets or sets the port which is mapped to this port's `number` in - /// the Azure Firewall, if applicable - /// - [JsonProperty(PropertyName = "mappedPort")] - public int? MappedPort { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Status == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Status"); - } - if (StatusReason == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "StatusReason"); - } - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/JitNetworkAccessRequestVirtualMachine.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/JitNetworkAccessRequestVirtualMachine.cs deleted file mode 100644 index 38f2fe3c1c8c..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/JitNetworkAccessRequestVirtualMachine.cs +++ /dev/null @@ -1,91 +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.Security.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - public partial class JitNetworkAccessRequestVirtualMachine - { - /// - /// Initializes a new instance of the - /// JitNetworkAccessRequestVirtualMachine class. - /// - public JitNetworkAccessRequestVirtualMachine() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// JitNetworkAccessRequestVirtualMachine class. - /// - /// Resource ID of the virtual machine that is linked - /// to this policy - /// The ports that were opened for the virtual - /// machine - public JitNetworkAccessRequestVirtualMachine(string id, IList ports) - { - Id = id; - Ports = ports; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets resource ID of the virtual machine that is linked to - /// this policy - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - /// - /// Gets or sets the ports that were opened for the virtual machine - /// - [JsonProperty(PropertyName = "ports")] - public IList Ports { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Id == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Id"); - } - if (Ports == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Ports"); - } - if (Ports != null) - { - foreach (var element in Ports) - { - if (element != null) - { - element.Validate(); - } - } - } - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ListCustomAlertRule.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ListCustomAlertRule.cs deleted file mode 100644 index 528d183316de..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ListCustomAlertRule.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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// A List custom alert rule. - /// - public partial class ListCustomAlertRule : CustomAlertRule - { - /// - /// Initializes a new instance of the ListCustomAlertRule class. - /// - public ListCustomAlertRule() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ListCustomAlertRule class. - /// - /// Status of the custom alert. - /// The display name of the custom - /// alert. - /// The description of the custom - /// alert. - /// The value type of the items in the list. - /// Possible values include: 'IpCidr', 'String' - public ListCustomAlertRule(bool isEnabled, string displayName = default(string), string description = default(string), string valueType = default(string)) - : base(isEnabled, displayName, description) - { - ValueType = valueType; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the value type of the items in the list. Possible values - /// include: 'IpCidr', 'String' - /// - [JsonProperty(PropertyName = "valueType")] - public string ValueType { get; private set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/LocalUserNotAllowed.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/LocalUserNotAllowed.cs deleted file mode 100644 index 0005bd059e44..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/LocalUserNotAllowed.cs +++ /dev/null @@ -1,65 +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.Security.Models -{ - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Login by a local user that isn't allowed. Allow list consists of login - /// names to allow. - /// - public partial class LocalUserNotAllowed : AllowlistCustomAlertRule - { - /// - /// Initializes a new instance of the LocalUserNotAllowed class. - /// - public LocalUserNotAllowed() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the LocalUserNotAllowed class. - /// - /// Status of the custom alert. - /// The values to allow. The format of - /// the values depends on the rule type. - /// The display name of the custom - /// alert. - /// The description of the custom - /// alert. - /// The value type of the items in the list. - /// Possible values include: 'IpCidr', 'String' - public LocalUserNotAllowed(bool isEnabled, IList allowlistValues, string displayName = default(string), string description = default(string), string valueType = default(string)) - : base(isEnabled, allowlistValues, displayName, description, valueType) - { - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Location.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Location.cs deleted file mode 100644 index a35eb9fed24e..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Location.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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Describes an Azure resource with location - /// - public partial class Location - { - /// - /// Initializes a new instance of the Location class. - /// - public Location() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the Location class. - /// - /// Location where the resource is - /// stored - public Location(string locationProperty = default(string)) - { - LocationProperty = locationProperty; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets location where the resource is stored - /// - [JsonProperty(PropertyName = "location")] - public string LocationProperty { get; private set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/LogAnalyticsIdentifier.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/LogAnalyticsIdentifier.cs deleted file mode 100644 index 75b4efedb02b..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/LogAnalyticsIdentifier.cs +++ /dev/null @@ -1,100 +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.Security.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Represents a Log Analytics workspace scope identifier. - /// - [Newtonsoft.Json.JsonObject("LogAnalytics")] - public partial class LogAnalyticsIdentifier : ResourceIdentifier - { - /// - /// Initializes a new instance of the LogAnalyticsIdentifier class. - /// - public LogAnalyticsIdentifier() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the LogAnalyticsIdentifier class. - /// - /// The LogAnalytics workspace id that stores - /// this alert. - /// The azure subscription id for - /// the LogAnalytics workspace storing this alert. - /// The azure resource group for - /// the LogAnalytics workspace storing this alert - /// (optional) The LogAnalytics agent id - /// reporting the event that this alert is based on. - public LogAnalyticsIdentifier(string workspaceId = default(string), string workspaceSubscriptionId = default(string), string workspaceResourceGroup = default(string), string agentId = default(string)) - { - WorkspaceId = workspaceId; - WorkspaceSubscriptionId = workspaceSubscriptionId; - WorkspaceResourceGroup = workspaceResourceGroup; - AgentId = agentId; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the LogAnalytics workspace id that stores this alert. - /// - [JsonProperty(PropertyName = "workspaceId")] - public string WorkspaceId { get; private set; } - - /// - /// Gets the azure subscription id for the LogAnalytics workspace - /// storing this alert. - /// - [JsonProperty(PropertyName = "workspaceSubscriptionId")] - public string WorkspaceSubscriptionId { get; private set; } - - /// - /// Gets the azure resource group for the LogAnalytics workspace - /// storing this alert - /// - [JsonProperty(PropertyName = "workspaceResourceGroup")] - public string WorkspaceResourceGroup { get; private set; } - - /// - /// Gets (optional) The LogAnalytics agent id reporting the event that - /// this alert is based on. - /// - [JsonProperty(PropertyName = "agentId")] - public string AgentId { get; private set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (WorkspaceSubscriptionId != null) - { - if (!System.Text.RegularExpressions.Regex.IsMatch(WorkspaceSubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) - { - throw new ValidationException(ValidationRules.Pattern, "WorkspaceSubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); - } - } - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/MqttC2DMessagesNotInAllowedRange.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/MqttC2DMessagesNotInAllowedRange.cs deleted file mode 100644 index 3df534833527..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/MqttC2DMessagesNotInAllowedRange.cs +++ /dev/null @@ -1,65 +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.Security.Models -{ - using System.Linq; - - /// - /// Number of cloud to device messages (MQTT protocol) is not in allowed - /// range. - /// - public partial class MqttC2DMessagesNotInAllowedRange : TimeWindowCustomAlertRule - { - /// - /// Initializes a new instance of the MqttC2DMessagesNotInAllowedRange - /// class. - /// - public MqttC2DMessagesNotInAllowedRange() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the MqttC2DMessagesNotInAllowedRange - /// class. - /// - /// Status of the custom alert. - /// The minimum threshold. - /// The maximum threshold. - /// The time window size in iso8601 - /// format. - /// The display name of the custom - /// alert. - /// The description of the custom - /// alert. - public MqttC2DMessagesNotInAllowedRange(bool isEnabled, int minThreshold, int maxThreshold, System.TimeSpan timeWindowSize, string displayName = default(string), string description = default(string)) - : base(isEnabled, minThreshold, maxThreshold, timeWindowSize, displayName, description) - { - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/MqttC2DRejectedMessagesNotInAllowedRange.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/MqttC2DRejectedMessagesNotInAllowedRange.cs deleted file mode 100644 index 6607cb5285c9..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/MqttC2DRejectedMessagesNotInAllowedRange.cs +++ /dev/null @@ -1,65 +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.Security.Models -{ - using System.Linq; - - /// - /// Number of rejected cloud to device messages (MQTT protocol) is not in - /// allowed range. - /// - public partial class MqttC2DRejectedMessagesNotInAllowedRange : TimeWindowCustomAlertRule - { - /// - /// Initializes a new instance of the - /// MqttC2DRejectedMessagesNotInAllowedRange class. - /// - public MqttC2DRejectedMessagesNotInAllowedRange() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// MqttC2DRejectedMessagesNotInAllowedRange class. - /// - /// Status of the custom alert. - /// The minimum threshold. - /// The maximum threshold. - /// The time window size in iso8601 - /// format. - /// The display name of the custom - /// alert. - /// The description of the custom - /// alert. - public MqttC2DRejectedMessagesNotInAllowedRange(bool isEnabled, int minThreshold, int maxThreshold, System.TimeSpan timeWindowSize, string displayName = default(string), string description = default(string)) - : base(isEnabled, minThreshold, maxThreshold, timeWindowSize, displayName, description) - { - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/MqttD2CMessagesNotInAllowedRange.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/MqttD2CMessagesNotInAllowedRange.cs deleted file mode 100644 index 1bba936ed591..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/MqttD2CMessagesNotInAllowedRange.cs +++ /dev/null @@ -1,65 +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.Security.Models -{ - using System.Linq; - - /// - /// Number of device to cloud messages (MQTT protocol) is not in allowed - /// range. - /// - public partial class MqttD2CMessagesNotInAllowedRange : TimeWindowCustomAlertRule - { - /// - /// Initializes a new instance of the MqttD2CMessagesNotInAllowedRange - /// class. - /// - public MqttD2CMessagesNotInAllowedRange() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the MqttD2CMessagesNotInAllowedRange - /// class. - /// - /// Status of the custom alert. - /// The minimum threshold. - /// The maximum threshold. - /// The time window size in iso8601 - /// format. - /// The display name of the custom - /// alert. - /// The description of the custom - /// alert. - public MqttD2CMessagesNotInAllowedRange(bool isEnabled, int minThreshold, int maxThreshold, System.TimeSpan timeWindowSize, string displayName = default(string), string description = default(string)) - : base(isEnabled, minThreshold, maxThreshold, timeWindowSize, displayName, description) - { - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/OnPremiseResourceDetails.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/OnPremiseResourceDetails.cs deleted file mode 100644 index 755fcd1a3f42..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/OnPremiseResourceDetails.cs +++ /dev/null @@ -1,105 +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.Security.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Details of the On Premise resource that was assessed - /// - [Newtonsoft.Json.JsonObject("OnPremise")] - public partial class OnPremiseResourceDetails : ResourceDetails - { - /// - /// Initializes a new instance of the OnPremiseResourceDetails class. - /// - public OnPremiseResourceDetails() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the OnPremiseResourceDetails class. - /// - /// Azure resource Id of the workspace the - /// machine is attached to - /// The unique Id of the machine - /// The oms agent Id installed on the - /// machine - /// The name of the machine - public OnPremiseResourceDetails(string workspaceId, string vmuuid, string sourceComputerId, string machineName) - { - WorkspaceId = workspaceId; - Vmuuid = vmuuid; - SourceComputerId = sourceComputerId; - MachineName = machineName; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets azure resource Id of the workspace the machine is - /// attached to - /// - [JsonProperty(PropertyName = "workspaceId")] - public string WorkspaceId { get; set; } - - /// - /// Gets or sets the unique Id of the machine - /// - [JsonProperty(PropertyName = "vmuuid")] - public string Vmuuid { get; set; } - - /// - /// Gets or sets the oms agent Id installed on the machine - /// - [JsonProperty(PropertyName = "sourceComputerId")] - public string SourceComputerId { get; set; } - - /// - /// Gets or sets the name of the machine - /// - [JsonProperty(PropertyName = "machineName")] - public string MachineName { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (WorkspaceId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "WorkspaceId"); - } - if (Vmuuid == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Vmuuid"); - } - if (SourceComputerId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "SourceComputerId"); - } - if (MachineName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "MachineName"); - } - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/OnPremiseSqlResourceDetails.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/OnPremiseSqlResourceDetails.cs deleted file mode 100644 index 084f5df0f1b6..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/OnPremiseSqlResourceDetails.cs +++ /dev/null @@ -1,90 +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.Security.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Details of the On Premise Sql resource that was assessed - /// - [Newtonsoft.Json.JsonObject("OnPremiseSql")] - public partial class OnPremiseSqlResourceDetails : OnPremiseResourceDetails - { - /// - /// Initializes a new instance of the OnPremiseSqlResourceDetails - /// class. - /// - public OnPremiseSqlResourceDetails() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the OnPremiseSqlResourceDetails - /// class. - /// - /// Azure resource Id of the workspace the - /// machine is attached to - /// The unique Id of the machine - /// The oms agent Id installed on the - /// machine - /// The name of the machine - /// The Sql server name installed on the - /// machine - /// The Sql database name installed on the - /// machine - public OnPremiseSqlResourceDetails(string workspaceId, string vmuuid, string sourceComputerId, string machineName, string serverName, string databaseName) - : base(workspaceId, vmuuid, sourceComputerId, machineName) - { - ServerName = serverName; - DatabaseName = databaseName; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the Sql server name installed on the machine - /// - [JsonProperty(PropertyName = "serverName")] - public string ServerName { get; set; } - - /// - /// Gets or sets the Sql database name installed on the machine - /// - [JsonProperty(PropertyName = "databaseName")] - public string DatabaseName { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - if (ServerName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ServerName"); - } - if (DatabaseName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "DatabaseName"); - } - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Operation.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Operation.cs deleted file mode 100644 index ca7b8be3c64a..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Operation.cs +++ /dev/null @@ -1,65 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Possible operation in the REST API of Microsoft.Security - /// - public partial class Operation - { - /// - /// Initializes a new instance of the Operation class. - /// - public Operation() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the Operation class. - /// - /// Name of the operation - /// Where the operation is originated - public Operation(string name = default(string), string origin = default(string), OperationDisplay display = default(OperationDisplay)) - { - Name = name; - Origin = origin; - Display = display; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets name of the operation - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } - - /// - /// Gets where the operation is originated - /// - [JsonProperty(PropertyName = "origin")] - public string Origin { get; private set; } - - /// - /// - [JsonProperty(PropertyName = "display")] - public OperationDisplay Display { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/OperationDisplay.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/OperationDisplay.cs deleted file mode 100644 index 0da7bfb68a89..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/OperationDisplay.cs +++ /dev/null @@ -1,78 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Security operation display - /// - public partial class OperationDisplay - { - /// - /// Initializes a new instance of the OperationDisplay class. - /// - public OperationDisplay() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the OperationDisplay class. - /// - /// The resource provider for the - /// operation. - /// The display name of the resource the - /// operation applies to. - /// The display name of the security - /// operation. - /// The description of the operation. - public OperationDisplay(string provider = default(string), string resource = default(string), string operation = default(string), string description = default(string)) - { - Provider = provider; - Resource = resource; - Operation = operation; - Description = description; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the resource provider for the operation. - /// - [JsonProperty(PropertyName = "provider")] - public string Provider { get; private set; } - - /// - /// Gets the display name of the resource the operation applies to. - /// - [JsonProperty(PropertyName = "resource")] - public string Resource { get; private set; } - - /// - /// Gets the display name of the security operation. - /// - [JsonProperty(PropertyName = "operation")] - public string Operation { get; private set; } - - /// - /// Gets the description of the operation. - /// - [JsonProperty(PropertyName = "description")] - public string Description { get; private set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/OperatorModel.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/OperatorModel.cs deleted file mode 100644 index 2f7657382ce4..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/OperatorModel.cs +++ /dev/null @@ -1,56 +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.Security.Models -{ - - /// - /// Defines values for OperatorModel. - /// - public static class OperatorModel - { - /// - /// Applies for decimal and non-decimal operands - /// - public const string Equals = "Equals"; - /// - /// Applies only for decimal operands - /// - public const string GreaterThan = "GreaterThan"; - /// - /// Applies only for decimal operands - /// - public const string GreaterThanOrEqualTo = "GreaterThanOrEqualTo"; - /// - /// Applies only for decimal operands - /// - public const string LesserThan = "LesserThan"; - /// - /// Applies only for decimal operands - /// - public const string LesserThanOrEqualTo = "LesserThanOrEqualTo"; - /// - /// Applies for decimal and non-decimal operands - /// - public const string NotEquals = "NotEquals"; - /// - /// Applies only for non-decimal operands - /// - public const string Contains = "Contains"; - /// - /// Applies only for non-decimal operands - /// - public const string StartsWith = "StartsWith"; - /// - /// Applies only for non-decimal operands - /// - public const string EndsWith = "EndsWith"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Page.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Page.cs deleted file mode 100644 index 3fd68902cfcb..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Page.cs +++ /dev/null @@ -1,53 +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.Security.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - - /// - /// Defines a page in Azure responses. - /// - /// Type of the page content items - [JsonObject] - public class Page : IPage - { - /// - /// Gets the link to the next page. - /// - [JsonProperty("nextLink")] - public string NextPageLink { get; private set; } - - [JsonProperty("value")] - private IList Items{ get; set; } - - /// - /// Returns an enumerator that iterates through the collection. - /// - /// A an enumerator that can be used to iterate through the collection. - public IEnumerator GetEnumerator() - { - return Items == null ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); - } - - /// - /// Returns an enumerator that iterates through the collection. - /// - /// A an enumerator that can be used to iterate through the collection. - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/PathRecommendation.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/PathRecommendation.cs deleted file mode 100644 index d55253f6d73d..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/PathRecommendation.cs +++ /dev/null @@ -1,125 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Represents a path that is recommended to be allowed and its properties - /// - public partial class PathRecommendation - { - /// - /// Initializes a new instance of the PathRecommendation class. - /// - public PathRecommendation() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the PathRecommendation class. - /// - /// The full path of the file, or an identifier of - /// the application - /// Possible values include: 'Recommended', 'Add', - /// 'Remove' - /// Possible values include: 'File', 'FileHash', - /// 'PublisherSignature', 'ProductSignature', 'BinarySignature', - /// 'VersionAndAboveSignature' - /// Whether the application is commonly run on the - /// machine - /// Possible values include: 'Exe', 'Dll', - /// 'Msi', 'Script', 'Executable', 'Unknown' - /// Possible values include: - /// 'Configured', 'NotConfigured', 'InProgress', 'Failed', - /// 'NoStatus' - public PathRecommendation(string path = default(string), string action = default(string), string type = default(string), PublisherInfo publisherInfo = default(PublisherInfo), bool? common = default(bool?), IList userSids = default(IList), IList usernames = default(IList), string fileType = default(string), string configurationStatus = default(string)) - { - Path = path; - Action = action; - Type = type; - PublisherInfo = publisherInfo; - Common = common; - UserSids = userSids; - Usernames = usernames; - FileType = fileType; - ConfigurationStatus = configurationStatus; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the full path of the file, or an identifier of the - /// application - /// - [JsonProperty(PropertyName = "path")] - public string Path { get; set; } - - /// - /// Gets or sets possible values include: 'Recommended', 'Add', - /// 'Remove' - /// - [JsonProperty(PropertyName = "action")] - public string Action { get; set; } - - /// - /// Gets or sets possible values include: 'File', 'FileHash', - /// 'PublisherSignature', 'ProductSignature', 'BinarySignature', - /// 'VersionAndAboveSignature' - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; set; } - - /// - /// - [JsonProperty(PropertyName = "publisherInfo")] - public PublisherInfo PublisherInfo { get; set; } - - /// - /// Gets or sets whether the application is commonly run on the machine - /// - [JsonProperty(PropertyName = "common")] - public bool? Common { get; set; } - - /// - /// - [JsonProperty(PropertyName = "userSids")] - public IList UserSids { get; set; } - - /// - /// - [JsonProperty(PropertyName = "usernames")] - public IList Usernames { get; set; } - - /// - /// Gets or sets possible values include: 'Exe', 'Dll', 'Msi', - /// 'Script', 'Executable', 'Unknown' - /// - [JsonProperty(PropertyName = "fileType")] - public string FileType { get; set; } - - /// - /// Gets or sets possible values include: 'Configured', - /// 'NotConfigured', 'InProgress', 'Failed', 'NoStatus' - /// - [JsonProperty(PropertyName = "configurationStatus")] - public string ConfigurationStatus { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/PermissionProperty.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/PermissionProperty.cs deleted file mode 100644 index 0e08aa9fcd72..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/PermissionProperty.cs +++ /dev/null @@ -1,40 +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.Security.Models -{ - - /// - /// Defines values for PermissionProperty. - /// - public static class PermissionProperty - { - /// - /// This permission provides read only access to AWS Security Hub - /// resources. - /// - public const string AWSAWSSecurityHubReadOnlyAccess = "AWS::AWSSecurityHubReadOnlyAccess"; - /// - /// This permission grants access to read security configuration - /// metadata. - /// - public const string AWSSecurityAudit = "AWS::SecurityAudit"; - /// - /// The permission provides for EC2 Automation service to execute - /// activities defined within Automation documents. - /// - public const string AWSAmazonSSMAutomationRole = "AWS::AmazonSSMAutomationRole"; - /// - /// This permission provides read only access to GCP Security Command - /// Center. - /// - public const string GCPSecurityCenterAdminViewer = "GCP::Security Center Admin Viewer"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Pricing.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Pricing.cs index 145fa72a76b7..f81bf3647b16 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Pricing.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Pricing.cs @@ -44,13 +44,18 @@ public Pricing() /// Resource Id /// Resource name /// Resource type + /// The sub-plan selected for a Standard pricing + /// configuration, when more than one sub-plan is available. Each + /// sub-plan enables a set of security features. When not specified, + /// full plan is applied. /// The duration left for the /// subscriptions free trial period - in ISO 8601 format (e.g. /// P3Y6M4DT12H30M5S). - public Pricing(string pricingTier, string id = default(string), string name = default(string), string type = default(string), System.TimeSpan? freeTrialRemainingTime = default(System.TimeSpan?)) + public Pricing(string pricingTier, string id = default(string), string name = default(string), string type = default(string), string subPlan = default(string), System.TimeSpan? freeTrialRemainingTime = default(System.TimeSpan?)) : base(id, name, type) { PricingTier = pricingTier; + SubPlan = subPlan; FreeTrialRemainingTime = freeTrialRemainingTime; CustomInit(); } @@ -70,6 +75,15 @@ public Pricing() [JsonProperty(PropertyName = "properties.pricingTier")] public string PricingTier { get; set; } + /// + /// Gets or sets the sub-plan selected for a Standard pricing + /// configuration, when more than one sub-plan is available. Each + /// sub-plan enables a set of security features. When not specified, + /// full plan is applied. + /// + [JsonProperty(PropertyName = "properties.subPlan")] + public string SubPlan { get; set; } + /// /// Gets the duration left for the subscriptions free trial period - in /// ISO 8601 format (e.g. P3Y6M4DT12H30M5S). diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ProcessNotAllowed.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ProcessNotAllowed.cs deleted file mode 100644 index a69d3dc5f932..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ProcessNotAllowed.cs +++ /dev/null @@ -1,65 +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.Security.Models -{ - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Execution of a process that isn't allowed. Allow list consists of - /// process names to allow. - /// - public partial class ProcessNotAllowed : AllowlistCustomAlertRule - { - /// - /// Initializes a new instance of the ProcessNotAllowed class. - /// - public ProcessNotAllowed() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ProcessNotAllowed class. - /// - /// Status of the custom alert. - /// The values to allow. The format of - /// the values depends on the rule type. - /// The display name of the custom - /// alert. - /// The description of the custom - /// alert. - /// The value type of the items in the list. - /// Possible values include: 'IpCidr', 'String' - public ProcessNotAllowed(bool isEnabled, IList allowlistValues, string displayName = default(string), string description = default(string), string valueType = default(string)) - : base(isEnabled, allowlistValues, displayName, description, valueType) - { - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/PropertyType.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/PropertyType.cs deleted file mode 100644 index 2cc27d136067..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/PropertyType.cs +++ /dev/null @@ -1,24 +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.Security.Models -{ - - /// - /// Defines values for PropertyType. - /// - public static class PropertyType - { - public const string String = "String"; - public const string Integer = "Integer"; - public const string Number = "Number"; - public const string Boolean = "Boolean"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ProtectionMode.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ProtectionMode.cs deleted file mode 100644 index 620558e29e99..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ProtectionMode.cs +++ /dev/null @@ -1,80 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// The protection mode of the collection/file types. Exe/Msi/Script are - /// used for Windows, Executable is used for Linux. - /// - public partial class ProtectionMode - { - /// - /// Initializes a new instance of the ProtectionMode class. - /// - public ProtectionMode() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ProtectionMode class. - /// - /// Possible values include: 'Audit', 'Enforce', - /// 'None' - /// Possible values include: 'Audit', 'Enforce', - /// 'None' - /// Possible values include: 'Audit', 'Enforce', - /// 'None' - /// Possible values include: 'Audit', - /// 'Enforce', 'None' - public ProtectionMode(string exe = default(string), string msi = default(string), string script = default(string), string executable = default(string)) - { - Exe = exe; - Msi = msi; - Script = script; - Executable = executable; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets possible values include: 'Audit', 'Enforce', 'None' - /// - [JsonProperty(PropertyName = "exe")] - public string Exe { get; set; } - - /// - /// Gets or sets possible values include: 'Audit', 'Enforce', 'None' - /// - [JsonProperty(PropertyName = "msi")] - public string Msi { get; set; } - - /// - /// Gets or sets possible values include: 'Audit', 'Enforce', 'None' - /// - [JsonProperty(PropertyName = "script")] - public string Script { get; set; } - - /// - /// Gets or sets possible values include: 'Audit', 'Enforce', 'None' - /// - [JsonProperty(PropertyName = "executable")] - public string Executable { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Protocol.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Protocol.cs deleted file mode 100644 index e73c096a0219..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Protocol.cs +++ /dev/null @@ -1,23 +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.Security.Models -{ - - /// - /// Defines values for Protocol. - /// - public static class Protocol - { - public const string TCP = "TCP"; - public const string UDP = "UDP"; - public const string All = "*"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ProvisioningState.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ProvisioningState.cs deleted file mode 100644 index 3402e79694b0..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ProvisioningState.cs +++ /dev/null @@ -1,23 +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.Security.Models -{ - - /// - /// Defines values for ProvisioningState. - /// - public static class ProvisioningState - { - public const string Succeeded = "Succeeded"; - public const string Failed = "Failed"; - public const string Updating = "Updating"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ProxyServerProperties.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ProxyServerProperties.cs deleted file mode 100644 index 2f0253d64a38..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ProxyServerProperties.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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// For a non-Azure machine that is not connected directly to the internet, - /// specify a proxy server that the non-Azure machine can use. - /// - public partial class ProxyServerProperties - { - /// - /// Initializes a new instance of the ProxyServerProperties class. - /// - public ProxyServerProperties() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ProxyServerProperties class. - /// - /// Proxy server IP - /// Proxy server port - public ProxyServerProperties(string ip = default(string), string port = default(string)) - { - Ip = ip; - Port = port; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets proxy server IP - /// - [JsonProperty(PropertyName = "ip")] - public string Ip { get; set; } - - /// - /// Gets or sets proxy server port - /// - [JsonProperty(PropertyName = "port")] - public string Port { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/PublisherInfo.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/PublisherInfo.cs deleted file mode 100644 index 2ddd5dc41bc4..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/PublisherInfo.cs +++ /dev/null @@ -1,86 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Represents the publisher information of a process/rule - /// - public partial class PublisherInfo - { - /// - /// Initializes a new instance of the PublisherInfo class. - /// - public PublisherInfo() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the PublisherInfo class. - /// - /// The Subject field of the x.509 - /// certificate used to sign the code, using the following fields - O - /// = Organization, L = Locality, S = State or Province, and C = - /// Country - /// The product name taken from the file's - /// version resource - /// The "OriginalName" field taken from the - /// file's version resource - /// The binary file version taken from the file's - /// version resource - public PublisherInfo(string publisherName = default(string), string productName = default(string), string binaryName = default(string), string version = default(string)) - { - PublisherName = publisherName; - ProductName = productName; - BinaryName = binaryName; - Version = version; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the Subject field of the x.509 certificate used to - /// sign the code, using the following fields - O = Organization, L = - /// Locality, S = State or Province, and C = Country - /// - [JsonProperty(PropertyName = "publisherName")] - public string PublisherName { get; set; } - - /// - /// Gets or sets the product name taken from the file's version - /// resource - /// - [JsonProperty(PropertyName = "productName")] - public string ProductName { get; set; } - - /// - /// Gets or sets the "OriginalName" field taken from the file's version - /// resource - /// - [JsonProperty(PropertyName = "binaryName")] - public string BinaryName { get; set; } - - /// - /// Gets or sets the binary file version taken from the file's version - /// resource - /// - [JsonProperty(PropertyName = "version")] - public string Version { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/QueryCheck.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/QueryCheck.cs deleted file mode 100644 index 3150c3f2832b..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/QueryCheck.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.Security.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The rule query details. - /// - public partial class QueryCheck - { - /// - /// Initializes a new instance of the QueryCheck class. - /// - public QueryCheck() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the QueryCheck class. - /// - /// The rule query. - /// Expected result. - /// Column names of expected result. - public QueryCheck(string query = default(string), IList> expectedResult = default(IList>), IList columnNames = default(IList)) - { - Query = query; - ExpectedResult = expectedResult; - ColumnNames = columnNames; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the rule query. - /// - [JsonProperty(PropertyName = "query")] - public string Query { get; set; } - - /// - /// Gets or sets expected result. - /// - [JsonProperty(PropertyName = "expectedResult")] - public IList> ExpectedResult { get; set; } - - /// - /// Gets or sets column names of expected result. - /// - [JsonProperty(PropertyName = "columnNames")] - public IList ColumnNames { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/QueuePurgesNotInAllowedRange.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/QueuePurgesNotInAllowedRange.cs deleted file mode 100644 index 6845776d0aed..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/QueuePurgesNotInAllowedRange.cs +++ /dev/null @@ -1,64 +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.Security.Models -{ - using System.Linq; - - /// - /// Number of device queue purges is not in allowed range. - /// - public partial class QueuePurgesNotInAllowedRange : TimeWindowCustomAlertRule - { - /// - /// Initializes a new instance of the QueuePurgesNotInAllowedRange - /// class. - /// - public QueuePurgesNotInAllowedRange() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the QueuePurgesNotInAllowedRange - /// class. - /// - /// Status of the custom alert. - /// The minimum threshold. - /// The maximum threshold. - /// The time window size in iso8601 - /// format. - /// The display name of the custom - /// alert. - /// The description of the custom - /// alert. - public QueuePurgesNotInAllowedRange(bool isEnabled, int minThreshold, int maxThreshold, System.TimeSpan timeWindowSize, string displayName = default(string), string description = default(string)) - : base(isEnabled, minThreshold, maxThreshold, timeWindowSize, displayName, description) - { - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Rank.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Rank.cs deleted file mode 100644 index a3b52881e9ca..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Rank.cs +++ /dev/null @@ -1,78 +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.Security.Models -{ - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; - - /// - /// Defines values for Rank. - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum Rank - { - [EnumMember(Value = "None")] - None, - [EnumMember(Value = "Low")] - Low, - [EnumMember(Value = "Medium")] - Medium, - [EnumMember(Value = "High")] - High, - [EnumMember(Value = "Critical")] - Critical - } - internal static class RankEnumExtension - { - internal static string ToSerializedValue(this Rank? value) - { - return value == null ? null : ((Rank)value).ToSerializedValue(); - } - - internal static string ToSerializedValue(this Rank value) - { - switch( value ) - { - case Rank.None: - return "None"; - case Rank.Low: - return "Low"; - case Rank.Medium: - return "Medium"; - case Rank.High: - return "High"; - case Rank.Critical: - return "Critical"; - } - return null; - } - - internal static Rank? ParseRank(this string value) - { - switch( value ) - { - case "None": - return Rank.None; - case "Low": - return Rank.Low; - case "Medium": - return Rank.Medium; - case "High": - return Rank.High; - case "Critical": - return Rank.Critical; - } - return null; - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RecommendationConfigStatus.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RecommendationConfigStatus.cs deleted file mode 100644 index 43bb6bcde242..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RecommendationConfigStatus.cs +++ /dev/null @@ -1,22 +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.Security.Models -{ - - /// - /// Defines values for RecommendationConfigStatus. - /// - public static class RecommendationConfigStatus - { - public const string Disabled = "Disabled"; - public const string Enabled = "Enabled"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RecommendationConfigurationProperties.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RecommendationConfigurationProperties.cs deleted file mode 100644 index 8f915c231964..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RecommendationConfigurationProperties.cs +++ /dev/null @@ -1,107 +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.Security.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// The type of IoT Security recommendation. - /// - public partial class RecommendationConfigurationProperties - { - /// - /// Initializes a new instance of the - /// RecommendationConfigurationProperties class. - /// - public RecommendationConfigurationProperties() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// RecommendationConfigurationProperties class. - /// - /// The type of IoT Security - /// recommendation. Possible values include: 'IoT_ACRAuthentication', - /// 'IoT_AgentSendsUnutilizedMessages', 'IoT_Baseline', - /// 'IoT_EdgeHubMemOptimize', 'IoT_EdgeLoggingOptions', - /// 'IoT_InconsistentModuleSettings', 'IoT_InstallAgent', - /// 'IoT_IPFilter_DenyAll', 'IoT_IPFilter_PermissiveRule', - /// 'IoT_OpenPorts', 'IoT_PermissiveFirewallPolicy', - /// 'IoT_PermissiveInputFirewallRules', - /// 'IoT_PermissiveOutputFirewallRules', 'IoT_PrivilegedDockerOptions', - /// 'IoT_SharedCredentials', 'IoT_VulnerableTLSCipherSuite' - /// Recommendation status. When the recommendation - /// status is disabled recommendations are not generated. Possible - /// values include: 'Disabled', 'Enabled' - public RecommendationConfigurationProperties(string recommendationType, string status, string name = default(string)) - { - RecommendationType = recommendationType; - Name = name; - Status = status; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the type of IoT Security recommendation. Possible - /// values include: 'IoT_ACRAuthentication', - /// 'IoT_AgentSendsUnutilizedMessages', 'IoT_Baseline', - /// 'IoT_EdgeHubMemOptimize', 'IoT_EdgeLoggingOptions', - /// 'IoT_InconsistentModuleSettings', 'IoT_InstallAgent', - /// 'IoT_IPFilter_DenyAll', 'IoT_IPFilter_PermissiveRule', - /// 'IoT_OpenPorts', 'IoT_PermissiveFirewallPolicy', - /// 'IoT_PermissiveInputFirewallRules', - /// 'IoT_PermissiveOutputFirewallRules', 'IoT_PrivilegedDockerOptions', - /// 'IoT_SharedCredentials', 'IoT_VulnerableTLSCipherSuite' - /// - [JsonProperty(PropertyName = "recommendationType")] - public string RecommendationType { get; set; } - - /// - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } - - /// - /// Gets or sets recommendation status. When the recommendation status - /// is disabled recommendations are not generated. Possible values - /// include: 'Disabled', 'Enabled' - /// - [JsonProperty(PropertyName = "status")] - public string Status { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (RecommendationType == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "RecommendationType"); - } - if (Status == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Status"); - } - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RecommendationType.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RecommendationType.cs deleted file mode 100644 index 325aab5eebae..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RecommendationType.cs +++ /dev/null @@ -1,101 +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.Security.Models -{ - - /// - /// Defines values for RecommendationType. - /// - public static class RecommendationType - { - /// - /// Authentication schema used for pull an edge module from an ACR - /// repository does not use Service Principal Authentication. - /// - public const string IoTACRAuthentication = "IoT_ACRAuthentication"; - /// - /// IoT agent message size capacity is currently underutilized, causing - /// an increase in the number of sent messages. Adjust message - /// intervals for better utilization. - /// - public const string IoTAgentSendsUnutilizedMessages = "IoT_AgentSendsUnutilizedMessages"; - /// - /// Identified security related system configuration issues. - /// - public const string IoTBaseline = "IoT_Baseline"; - /// - /// You can optimize Edge Hub memory usage by turning off protocol - /// heads for any protocols not used by Edge modules in your solution. - /// - public const string IoTEdgeHubMemOptimize = "IoT_EdgeHubMemOptimize"; - /// - /// Logging is disabled for this edge module. - /// - public const string IoTEdgeLoggingOptions = "IoT_EdgeLoggingOptions"; - /// - /// A minority within a device security group has inconsistent Edge - /// Module settings with the rest of their group. - /// - public const string IoTInconsistentModuleSettings = "IoT_InconsistentModuleSettings"; - /// - /// Install the Azure Security of Things Agent. - /// - public const string IoTInstallAgent = "IoT_InstallAgent"; - /// - /// IP Filter Configuration should have rules defined for allowed - /// traffic and should deny all other traffic by default. - /// - public const string IoTIPFilterDenyAll = "IoT_IPFilter_DenyAll"; - /// - /// An Allow IP Filter rules source IP range is too large. Overly - /// permissive rules might expose your IoT hub to malicious intenders. - /// - public const string IoTIPFilterPermissiveRule = "IoT_IPFilter_PermissiveRule"; - /// - /// A listening endpoint was found on the device. - /// - public const string IoTOpenPorts = "IoT_OpenPorts"; - /// - /// An Allowed firewall policy was found (INPUT/OUTPUT). The policy - /// should Deny all traffic by default and define rules to allow - /// necessary communication to/from the device. - /// - public const string IoTPermissiveFirewallPolicy = "IoT_PermissiveFirewallPolicy"; - /// - /// A rule in the firewall has been found that contains a permissive - /// pattern for a wide range of IP addresses or Ports. - /// - public const string IoTPermissiveInputFirewallRules = "IoT_PermissiveInputFirewallRules"; - /// - /// A rule in the firewall has been found that contains a permissive - /// pattern for a wide range of IP addresses or Ports. - /// - public const string IoTPermissiveOutputFirewallRules = "IoT_PermissiveOutputFirewallRules"; - /// - /// Edge module is configured to run in privileged mode, with extensive - /// Linux capabilities or with host-level network access (send/receive - /// data to host machine). - /// - public const string IoTPrivilegedDockerOptions = "IoT_PrivilegedDockerOptions"; - /// - /// Same authentication credentials to the IoT Hub used by multiple - /// devices. This could indicate an illegitimate device impersonating a - /// legitimate device. It also exposes the risk of device impersonation - /// by an attacker. - /// - public const string IoTSharedCredentials = "IoT_SharedCredentials"; - /// - /// Insecure TLS configurations detected. Immediate upgrade - /// recommended. - /// - public const string IoTVulnerableTLSCipherSuite = "IoT_VulnerableTLSCipherSuite"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RegulatoryComplianceAssessment.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RegulatoryComplianceAssessment.cs deleted file mode 100644 index 35ebdfade6fc..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RegulatoryComplianceAssessment.cs +++ /dev/null @@ -1,134 +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.Security.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Regulatory compliance assessment details and state - /// - [Rest.Serialization.JsonTransformation] - public partial class RegulatoryComplianceAssessment : Resource - { - /// - /// Initializes a new instance of the RegulatoryComplianceAssessment - /// class. - /// - public RegulatoryComplianceAssessment() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the RegulatoryComplianceAssessment - /// class. - /// - /// Resource Id - /// Resource name - /// Resource type - /// The description of the regulatory - /// compliance assessment - /// The expected type of assessment - /// contained in the AssessmentDetailsLink - /// Link to more detailed - /// assessment results data. The response type will be according to the - /// assessmentType field - /// Aggregative state based on the assessment's - /// scanned resources states. Possible values include: 'Passed', - /// 'Failed', 'Skipped', 'Unsupported' - /// The given assessment's related - /// resources count with passed state. - /// The given assessment's related - /// resources count with failed state. - /// The given assessment's related - /// resources count with skipped state. - /// The given assessment's related - /// resources count with unsupported state. - public RegulatoryComplianceAssessment(string id = default(string), string name = default(string), string type = default(string), string description = default(string), string assessmentType = default(string), string assessmentDetailsLink = default(string), string state = default(string), int? passedResources = default(int?), int? failedResources = default(int?), int? skippedResources = default(int?), int? unsupportedResources = default(int?)) - : base(id, name, type) - { - Description = description; - AssessmentType = assessmentType; - AssessmentDetailsLink = assessmentDetailsLink; - State = state; - PassedResources = passedResources; - FailedResources = failedResources; - SkippedResources = skippedResources; - UnsupportedResources = unsupportedResources; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the description of the regulatory compliance assessment - /// - [JsonProperty(PropertyName = "properties.description")] - public string Description { get; private set; } - - /// - /// Gets the expected type of assessment contained in the - /// AssessmentDetailsLink - /// - [JsonProperty(PropertyName = "properties.assessmentType")] - public string AssessmentType { get; private set; } - - /// - /// Gets link to more detailed assessment results data. The response - /// type will be according to the assessmentType field - /// - [JsonProperty(PropertyName = "properties.assessmentDetailsLink")] - public string AssessmentDetailsLink { get; private set; } - - /// - /// Gets or sets aggregative state based on the assessment's scanned - /// resources states. Possible values include: 'Passed', 'Failed', - /// 'Skipped', 'Unsupported' - /// - [JsonProperty(PropertyName = "properties.state")] - public string State { get; set; } - - /// - /// Gets the given assessment's related resources count with passed - /// state. - /// - [JsonProperty(PropertyName = "properties.passedResources")] - public int? PassedResources { get; private set; } - - /// - /// Gets the given assessment's related resources count with failed - /// state. - /// - [JsonProperty(PropertyName = "properties.failedResources")] - public int? FailedResources { get; private set; } - - /// - /// Gets the given assessment's related resources count with skipped - /// state. - /// - [JsonProperty(PropertyName = "properties.skippedResources")] - public int? SkippedResources { get; private set; } - - /// - /// Gets the given assessment's related resources count with - /// unsupported state. - /// - [JsonProperty(PropertyName = "properties.unsupportedResources")] - public int? UnsupportedResources { get; private set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RegulatoryComplianceControl.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RegulatoryComplianceControl.cs deleted file mode 100644 index 0d66fb6f07b5..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RegulatoryComplianceControl.cs +++ /dev/null @@ -1,106 +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.Security.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Regulatory compliance control details and state - /// - [Rest.Serialization.JsonTransformation] - public partial class RegulatoryComplianceControl : Resource - { - /// - /// Initializes a new instance of the RegulatoryComplianceControl - /// class. - /// - public RegulatoryComplianceControl() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the RegulatoryComplianceControl - /// class. - /// - /// Resource Id - /// Resource name - /// Resource type - /// The description of the regulatory - /// compliance control - /// Aggregative state based on the control's - /// supported assessments states. Possible values include: 'Passed', - /// 'Failed', 'Skipped', 'Unsupported' - /// The number of supported regulatory - /// compliance assessments of the given control with a passed - /// state - /// The number of supported regulatory - /// compliance assessments of the given control with a failed - /// state - /// The number of supported regulatory - /// compliance assessments of the given control with a skipped - /// state - public RegulatoryComplianceControl(string id = default(string), string name = default(string), string type = default(string), string description = default(string), string state = default(string), int? passedAssessments = default(int?), int? failedAssessments = default(int?), int? skippedAssessments = default(int?)) - : base(id, name, type) - { - Description = description; - State = state; - PassedAssessments = passedAssessments; - FailedAssessments = failedAssessments; - SkippedAssessments = skippedAssessments; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the description of the regulatory compliance control - /// - [JsonProperty(PropertyName = "properties.description")] - public string Description { get; private set; } - - /// - /// Gets or sets aggregative state based on the control's supported - /// assessments states. Possible values include: 'Passed', 'Failed', - /// 'Skipped', 'Unsupported' - /// - [JsonProperty(PropertyName = "properties.state")] - public string State { get; set; } - - /// - /// Gets the number of supported regulatory compliance assessments of - /// the given control with a passed state - /// - [JsonProperty(PropertyName = "properties.passedAssessments")] - public int? PassedAssessments { get; private set; } - - /// - /// Gets the number of supported regulatory compliance assessments of - /// the given control with a failed state - /// - [JsonProperty(PropertyName = "properties.failedAssessments")] - public int? FailedAssessments { get; private set; } - - /// - /// Gets the number of supported regulatory compliance assessments of - /// the given control with a skipped state - /// - [JsonProperty(PropertyName = "properties.skippedAssessments")] - public int? SkippedAssessments { get; private set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RegulatoryComplianceStandard.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RegulatoryComplianceStandard.cs deleted file mode 100644 index 754f8a0f0488..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RegulatoryComplianceStandard.cs +++ /dev/null @@ -1,108 +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.Security.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Regulatory compliance standard details and state - /// - [Rest.Serialization.JsonTransformation] - public partial class RegulatoryComplianceStandard : Resource - { - /// - /// Initializes a new instance of the RegulatoryComplianceStandard - /// class. - /// - public RegulatoryComplianceStandard() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the RegulatoryComplianceStandard - /// class. - /// - /// Resource Id - /// Resource name - /// Resource type - /// Aggregative state based on the standard's - /// supported controls states. Possible values include: 'Passed', - /// 'Failed', 'Skipped', 'Unsupported' - /// The number of supported regulatory - /// compliance controls of the given standard with a passed - /// state - /// The number of supported regulatory - /// compliance controls of the given standard with a failed - /// state - /// The number of supported regulatory - /// compliance controls of the given standard with a skipped - /// state - /// The number of regulatory - /// compliance controls of the given standard which are unsupported by - /// automated assessments - public RegulatoryComplianceStandard(string id = default(string), string name = default(string), string type = default(string), string state = default(string), int? passedControls = default(int?), int? failedControls = default(int?), int? skippedControls = default(int?), int? unsupportedControls = default(int?)) - : base(id, name, type) - { - State = state; - PassedControls = passedControls; - FailedControls = failedControls; - SkippedControls = skippedControls; - UnsupportedControls = unsupportedControls; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets aggregative state based on the standard's supported - /// controls states. Possible values include: 'Passed', 'Failed', - /// 'Skipped', 'Unsupported' - /// - [JsonProperty(PropertyName = "properties.state")] - public string State { get; set; } - - /// - /// Gets the number of supported regulatory compliance controls of the - /// given standard with a passed state - /// - [JsonProperty(PropertyName = "properties.passedControls")] - public int? PassedControls { get; private set; } - - /// - /// Gets the number of supported regulatory compliance controls of the - /// given standard with a failed state - /// - [JsonProperty(PropertyName = "properties.failedControls")] - public int? FailedControls { get; private set; } - - /// - /// Gets the number of supported regulatory compliance controls of the - /// given standard with a skipped state - /// - [JsonProperty(PropertyName = "properties.skippedControls")] - public int? SkippedControls { get; private set; } - - /// - /// Gets the number of regulatory compliance controls of the given - /// standard which are unsupported by automated assessments - /// - [JsonProperty(PropertyName = "properties.unsupportedControls")] - public int? UnsupportedControls { get; private set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Remediation.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Remediation.cs deleted file mode 100644 index 16eb64f95179..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Remediation.cs +++ /dev/null @@ -1,78 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Remediation details. - /// - public partial class Remediation - { - /// - /// Initializes a new instance of the Remediation class. - /// - public Remediation() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the Remediation class. - /// - /// Remediation description. - /// Remediation script. - /// Is remediation automated. - /// Optional link to remediate in Azure - /// Portal. - public Remediation(string description = default(string), IList scripts = default(IList), bool? automated = default(bool?), string portalLink = default(string)) - { - Description = description; - Scripts = scripts; - Automated = automated; - PortalLink = portalLink; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets remediation description. - /// - [JsonProperty(PropertyName = "description")] - public string Description { get; set; } - - /// - /// Gets or sets remediation script. - /// - [JsonProperty(PropertyName = "scripts")] - public IList Scripts { get; set; } - - /// - /// Gets or sets is remediation automated. - /// - [JsonProperty(PropertyName = "automated")] - public bool? Automated { get; set; } - - /// - /// Gets or sets optional link to remediate in Azure Portal. - /// - [JsonProperty(PropertyName = "portalLink")] - public string PortalLink { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ReportedSeverity.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ReportedSeverity.cs deleted file mode 100644 index 95ad7f4efcb8..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ReportedSeverity.cs +++ /dev/null @@ -1,24 +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.Security.Models -{ - - /// - /// Defines values for ReportedSeverity. - /// - public static class ReportedSeverity - { - public const string Informational = "Informational"; - public const string Low = "Low"; - public const string Medium = "Medium"; - public const string High = "High"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ResourceDetails.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ResourceDetails.cs deleted file mode 100644 index 14c1aa733667..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ResourceDetails.cs +++ /dev/null @@ -1,35 +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.Security.Models -{ - using System.Linq; - - /// - /// Details of the resource that was assessed - /// - public partial class ResourceDetails - { - /// - /// Initializes a new instance of the ResourceDetails class. - /// - public ResourceDetails() - { - CustomInit(); - } - - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ResourceIdentifier.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ResourceIdentifier.cs deleted file mode 100644 index bc31b41d1edd..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ResourceIdentifier.cs +++ /dev/null @@ -1,37 +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.Security.Models -{ - using System.Linq; - - /// - /// A resource identifier for an alert which can be used to direct the - /// alert to the right product exposure group (tenant, workspace, - /// subscription etc.). - /// - public partial class ResourceIdentifier - { - /// - /// Initializes a new instance of the ResourceIdentifier class. - /// - public ResourceIdentifier() - { - CustomInit(); - } - - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ResourceStatus.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ResourceStatus.cs deleted file mode 100644 index 72433f55bfed..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ResourceStatus.cs +++ /dev/null @@ -1,36 +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.Security.Models -{ - - /// - /// Defines values for ResourceStatus. - /// - public static class ResourceStatus - { - /// - /// This assessment on the resource is healthy - /// - public const string Healthy = "Healthy"; - /// - /// This assessment is not applicable to this resource - /// - public const string NotApplicable = "NotApplicable"; - /// - /// This assessment is turned off by policy on this subscription - /// - public const string OffByPolicy = "OffByPolicy"; - /// - /// This assessment on the resource is not healthy - /// - public const string NotHealthy = "NotHealthy"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Rule.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Rule.cs deleted file mode 100644 index 7ca280d9e7c5..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Rule.cs +++ /dev/null @@ -1,93 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Describes remote addresses that is recommended to communicate with the - /// Azure resource on some (Protocol, Port, Direction). All other remote - /// addresses are recommended to be blocked - /// - public partial class Rule - { - /// - /// Initializes a new instance of the Rule class. - /// - public Rule() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the Rule class. - /// - /// The name of the rule - /// The rule's direction. Possible values - /// include: 'Inbound', 'Outbound' - /// The rule's destination port - /// The rule's transport protocols - /// The remote IP addresses that should be - /// able to communicate with the Azure resource on the rule's - /// destination port and protocol - public Rule(string name = default(string), string direction = default(string), int? destinationPort = default(int?), IList protocols = default(IList), IList ipAddresses = default(IList)) - { - Name = name; - Direction = direction; - DestinationPort = destinationPort; - Protocols = protocols; - IpAddresses = ipAddresses; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the name of the rule - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets the rule's direction. Possible values include: - /// 'Inbound', 'Outbound' - /// - [JsonProperty(PropertyName = "direction")] - public string Direction { get; set; } - - /// - /// Gets or sets the rule's destination port - /// - [JsonProperty(PropertyName = "destinationPort")] - public int? DestinationPort { get; set; } - - /// - /// Gets or sets the rule's transport protocols - /// - [JsonProperty(PropertyName = "protocols")] - public IList Protocols { get; set; } - - /// - /// Gets or sets the remote IP addresses that should be able to - /// communicate with the Azure resource on the rule's destination port - /// and protocol - /// - [JsonProperty(PropertyName = "ipAddresses")] - public IList IpAddresses { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RuleResults.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RuleResults.cs deleted file mode 100644 index 6e8fe66927d2..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RuleResults.cs +++ /dev/null @@ -1,53 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Rule results. - /// - public partial class RuleResults : Resource - { - /// - /// Initializes a new instance of the RuleResults class. - /// - public RuleResults() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the RuleResults class. - /// - /// Resource Id - /// Resource name - /// Resource type - public RuleResults(string id = default(string), string name = default(string), string type = default(string), RuleResultsProperties properties = default(RuleResultsProperties)) - : base(id, name, type) - { - Properties = properties; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "properties")] - public RuleResultsProperties Properties { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RuleResultsInput.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RuleResultsInput.cs deleted file mode 100644 index 48175a551b15..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RuleResultsInput.cs +++ /dev/null @@ -1,64 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Rule results input. - /// - public partial class RuleResultsInput - { - /// - /// Initializes a new instance of the RuleResultsInput class. - /// - public RuleResultsInput() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the RuleResultsInput class. - /// - /// Take results from latest scan. - /// Expected results to be inserted into the - /// baseline. - /// Leave this field empty it LatestScan == true. - public RuleResultsInput(bool? latestScan = default(bool?), IList> results = default(IList>)) - { - LatestScan = latestScan; - Results = results; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets take results from latest scan. - /// - [JsonProperty(PropertyName = "latestScan")] - public bool? LatestScan { get; set; } - - /// - /// Gets or sets expected results to be inserted into the baseline. - /// Leave this field empty it LatestScan == true. - /// - [JsonProperty(PropertyName = "results")] - public IList> Results { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RuleResultsProperties.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RuleResultsProperties.cs deleted file mode 100644 index b2ac5f11bd07..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RuleResultsProperties.cs +++ /dev/null @@ -1,53 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Rule results properties. - /// - public partial class RuleResultsProperties - { - /// - /// Initializes a new instance of the RuleResultsProperties class. - /// - public RuleResultsProperties() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the RuleResultsProperties class. - /// - /// Expected results in the baseline. - public RuleResultsProperties(IList> results = default(IList>)) - { - Results = results; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets expected results in the baseline. - /// - [JsonProperty(PropertyName = "results")] - public IList> Results { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RuleSeverity.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RuleSeverity.cs deleted file mode 100644 index b8a0d9d07aa2..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RuleSeverity.cs +++ /dev/null @@ -1,40 +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.Security.Models -{ - - /// - /// Defines values for RuleSeverity. - /// - public static class RuleSeverity - { - /// - /// High - /// - public const string High = "High"; - /// - /// Medium - /// - public const string Medium = "Medium"; - /// - /// Low - /// - public const string Low = "Low"; - /// - /// Informational - /// - public const string Informational = "Informational"; - /// - /// Obsolete - /// - public const string Obsolete = "Obsolete"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RuleState.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RuleState.cs deleted file mode 100644 index 0387421fabb7..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RuleState.cs +++ /dev/null @@ -1,66 +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.Security.Models -{ - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; - - /// - /// Defines values for RuleState. - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum RuleState - { - [EnumMember(Value = "Enabled")] - Enabled, - [EnumMember(Value = "Disabled")] - Disabled, - [EnumMember(Value = "Expired")] - Expired - } - internal static class RuleStateEnumExtension - { - internal static string ToSerializedValue(this RuleState? value) - { - return value == null ? null : ((RuleState)value).ToSerializedValue(); - } - - internal static string ToSerializedValue(this RuleState value) - { - switch( value ) - { - case RuleState.Enabled: - return "Enabled"; - case RuleState.Disabled: - return "Disabled"; - case RuleState.Expired: - return "Expired"; - } - return null; - } - - internal static RuleState? ParseRuleState(this string value) - { - switch( value ) - { - case "Enabled": - return RuleState.Enabled; - case "Disabled": - return RuleState.Disabled; - case "Expired": - return RuleState.Expired; - } - return null; - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RuleStatus.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RuleStatus.cs deleted file mode 100644 index cf84cb6f5d92..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RuleStatus.cs +++ /dev/null @@ -1,32 +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.Security.Models -{ - - /// - /// Defines values for RuleStatus. - /// - public static class RuleStatus - { - /// - /// NonFinding - /// - public const string NonFinding = "NonFinding"; - /// - /// Finding - /// - public const string Finding = "Finding"; - /// - /// InternalError - /// - public const string InternalError = "InternalError"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RuleType.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RuleType.cs deleted file mode 100644 index 994750901819..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RuleType.cs +++ /dev/null @@ -1,36 +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.Security.Models -{ - - /// - /// Defines values for RuleType. - /// - public static class RuleType - { - /// - /// Binary - /// - public const string Binary = "Binary"; - /// - /// BaselineExpected - /// - public const string BaselineExpected = "BaselineExpected"; - /// - /// PositiveList - /// - public const string PositiveList = "PositiveList"; - /// - /// NegativeList - /// - public const string NegativeList = "NegativeList"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RulesResults.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RulesResults.cs deleted file mode 100644 index 6b7f1bacf56e..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RulesResults.cs +++ /dev/null @@ -1,53 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// A list of rules results. - /// - public partial class RulesResults - { - /// - /// Initializes a new instance of the RulesResults class. - /// - public RulesResults() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the RulesResults class. - /// - /// List of rule results. - public RulesResults(IList value = default(IList)) - { - Value = value; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets list of rule results. - /// - [JsonProperty(PropertyName = "value")] - public IList Value { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RulesResultsInput.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RulesResultsInput.cs deleted file mode 100644 index 0a4174ce060e..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/RulesResultsInput.cs +++ /dev/null @@ -1,64 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Rules results input. - /// - public partial class RulesResultsInput - { - /// - /// Initializes a new instance of the RulesResultsInput class. - /// - public RulesResultsInput() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the RulesResultsInput class. - /// - /// Take results from latest scan. - /// Expected results to be inserted into the - /// baseline. - /// Leave this field empty it LatestScan == true. - public RulesResultsInput(bool? latestScan = default(bool?), IDictionary>> results = default(IDictionary>>)) - { - LatestScan = latestScan; - Results = results; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets take results from latest scan. - /// - [JsonProperty(PropertyName = "latestScan")] - public bool? LatestScan { get; set; } - - /// - /// Gets or sets expected results to be inserted into the baseline. - /// Leave this field empty it LatestScan == true. - /// - [JsonProperty(PropertyName = "results")] - public IDictionary>> Results { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Scan.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Scan.cs deleted file mode 100644 index 5df07a4230bf..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Scan.cs +++ /dev/null @@ -1,53 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// A vulnerability assessment scan record. - /// - public partial class Scan : Resource - { - /// - /// Initializes a new instance of the Scan class. - /// - public Scan() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the Scan class. - /// - /// Resource Id - /// Resource name - /// Resource type - public Scan(string id = default(string), string name = default(string), string type = default(string), ScanProperties properties = default(ScanProperties)) - : base(id, name, type) - { - Properties = properties; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "properties")] - public ScanProperties Properties { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ScanProperties.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ScanProperties.cs deleted file mode 100644 index 0ed039291522..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ScanProperties.cs +++ /dev/null @@ -1,167 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// A vulnerability assessment scan record properties. - /// - public partial class ScanProperties - { - /// - /// Initializes a new instance of the ScanProperties class. - /// - public ScanProperties() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ScanProperties class. - /// - /// Possible values include: 'OnDemand', - /// 'Recurring' - /// Possible values include: 'Failed', - /// 'FailedToRun', 'InProgress', 'Passed' - /// The server name. - /// The database name. - /// The SQL version. - /// The scan start time (UTC). - /// Scan results are valid until end time - /// (UTC). - /// The number of failed - /// rules with high severity. - /// The number of failed - /// rules with medium severity. - /// The number of failed - /// rules with low severity. - /// The number of total passed - /// rules. - /// The number of total failed - /// rules. - /// The number of total rules - /// assessed. - /// Baseline created for this database, - /// and has one or more rules. - public ScanProperties(string triggerType = default(string), string state = default(string), string server = default(string), string database = default(string), string sqlVersion = default(string), System.DateTime? startTime = default(System.DateTime?), System.DateTime? endTime = default(System.DateTime?), int? highSeverityFailedRulesCount = default(int?), int? mediumSeverityFailedRulesCount = default(int?), int? lowSeverityFailedRulesCount = default(int?), int? totalPassedRulesCount = default(int?), int? totalFailedRulesCount = default(int?), int? totalRulesCount = default(int?), bool? isBaselineApplied = default(bool?)) - { - TriggerType = triggerType; - State = state; - Server = server; - Database = database; - SqlVersion = sqlVersion; - StartTime = startTime; - EndTime = endTime; - HighSeverityFailedRulesCount = highSeverityFailedRulesCount; - MediumSeverityFailedRulesCount = mediumSeverityFailedRulesCount; - LowSeverityFailedRulesCount = lowSeverityFailedRulesCount; - TotalPassedRulesCount = totalPassedRulesCount; - TotalFailedRulesCount = totalFailedRulesCount; - TotalRulesCount = totalRulesCount; - IsBaselineApplied = isBaselineApplied; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets possible values include: 'OnDemand', 'Recurring' - /// - [JsonProperty(PropertyName = "triggerType")] - public string TriggerType { get; set; } - - /// - /// Gets or sets possible values include: 'Failed', 'FailedToRun', - /// 'InProgress', 'Passed' - /// - [JsonProperty(PropertyName = "state")] - public string State { get; set; } - - /// - /// Gets or sets the server name. - /// - [JsonProperty(PropertyName = "server")] - public string Server { get; set; } - - /// - /// Gets or sets the database name. - /// - [JsonProperty(PropertyName = "database")] - public string Database { get; set; } - - /// - /// Gets or sets the SQL version. - /// - [JsonProperty(PropertyName = "sqlVersion")] - public string SqlVersion { get; set; } - - /// - /// Gets or sets the scan start time (UTC). - /// - [JsonProperty(PropertyName = "startTime")] - public System.DateTime? StartTime { get; set; } - - /// - /// Gets or sets scan results are valid until end time (UTC). - /// - [JsonProperty(PropertyName = "endTime")] - public System.DateTime? EndTime { get; set; } - - /// - /// Gets or sets the number of failed rules with high severity. - /// - [JsonProperty(PropertyName = "highSeverityFailedRulesCount")] - public int? HighSeverityFailedRulesCount { get; set; } - - /// - /// Gets or sets the number of failed rules with medium severity. - /// - [JsonProperty(PropertyName = "mediumSeverityFailedRulesCount")] - public int? MediumSeverityFailedRulesCount { get; set; } - - /// - /// Gets or sets the number of failed rules with low severity. - /// - [JsonProperty(PropertyName = "lowSeverityFailedRulesCount")] - public int? LowSeverityFailedRulesCount { get; set; } - - /// - /// Gets or sets the number of total passed rules. - /// - [JsonProperty(PropertyName = "totalPassedRulesCount")] - public int? TotalPassedRulesCount { get; set; } - - /// - /// Gets or sets the number of total failed rules. - /// - [JsonProperty(PropertyName = "totalFailedRulesCount")] - public int? TotalFailedRulesCount { get; set; } - - /// - /// Gets or sets the number of total rules assessed. - /// - [JsonProperty(PropertyName = "totalRulesCount")] - public int? TotalRulesCount { get; set; } - - /// - /// Gets or sets baseline created for this database, and has one or - /// more rules. - /// - [JsonProperty(PropertyName = "isBaselineApplied")] - public bool? IsBaselineApplied { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ScanResult.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ScanResult.cs deleted file mode 100644 index 1cda1f43e431..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ScanResult.cs +++ /dev/null @@ -1,53 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// A vulnerability assessment scan result for a single rule. - /// - public partial class ScanResult : Resource - { - /// - /// Initializes a new instance of the ScanResult class. - /// - public ScanResult() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ScanResult class. - /// - /// Resource Id - /// Resource name - /// Resource type - public ScanResult(string id = default(string), string name = default(string), string type = default(string), ScanResultProperties properties = default(ScanResultProperties)) - : base(id, name, type) - { - Properties = properties; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "properties")] - public ScanResultProperties Properties { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ScanResultProperties.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ScanResultProperties.cs deleted file mode 100644 index 8693056eed0e..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ScanResultProperties.cs +++ /dev/null @@ -1,100 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// A vulnerability assessment scan result properties for a single rule. - /// - public partial class ScanResultProperties - { - /// - /// Initializes a new instance of the ScanResultProperties class. - /// - public ScanResultProperties() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ScanResultProperties class. - /// - /// The rule Id. - /// Possible values include: 'NonFinding', - /// 'Finding', 'InternalError' - /// Indicated whether the results specified - /// here are trimmed. - /// The results of the query that was - /// run. - public ScanResultProperties(string ruleId = default(string), string status = default(string), bool? isTrimmed = default(bool?), IList> queryResults = default(IList>), Remediation remediation = default(Remediation), BaselineAdjustedResult baselineAdjustedResult = default(BaselineAdjustedResult), VaRule ruleMetadata = default(VaRule)) - { - RuleId = ruleId; - Status = status; - IsTrimmed = isTrimmed; - QueryResults = queryResults; - Remediation = remediation; - BaselineAdjustedResult = baselineAdjustedResult; - RuleMetadata = ruleMetadata; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the rule Id. - /// - [JsonProperty(PropertyName = "ruleId")] - public string RuleId { get; set; } - - /// - /// Gets or sets possible values include: 'NonFinding', 'Finding', - /// 'InternalError' - /// - [JsonProperty(PropertyName = "status")] - public string Status { get; set; } - - /// - /// Gets or sets indicated whether the results specified here are - /// trimmed. - /// - [JsonProperty(PropertyName = "isTrimmed")] - public bool? IsTrimmed { get; set; } - - /// - /// Gets or sets the results of the query that was run. - /// - [JsonProperty(PropertyName = "queryResults")] - public IList> QueryResults { get; set; } - - /// - /// - [JsonProperty(PropertyName = "remediation")] - public Remediation Remediation { get; set; } - - /// - /// - [JsonProperty(PropertyName = "baselineAdjustedResult")] - public BaselineAdjustedResult BaselineAdjustedResult { get; set; } - - /// - /// - [JsonProperty(PropertyName = "ruleMetadata")] - public VaRule RuleMetadata { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ScanResults.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ScanResults.cs deleted file mode 100644 index 82b3c05f7285..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ScanResults.cs +++ /dev/null @@ -1,54 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// A list of vulnerability assessment scan results. - /// - public partial class ScanResults - { - /// - /// Initializes a new instance of the ScanResults class. - /// - public ScanResults() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ScanResults class. - /// - /// List of vulnerability assessment scan - /// results. - public ScanResults(IList value = default(IList)) - { - Value = value; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets list of vulnerability assessment scan results. - /// - [JsonProperty(PropertyName = "value")] - public IList Value { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ScanState.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ScanState.cs deleted file mode 100644 index ccda47c95700..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ScanState.cs +++ /dev/null @@ -1,36 +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.Security.Models -{ - - /// - /// Defines values for ScanState. - /// - public static class ScanState - { - /// - /// Failed - /// - public const string Failed = "Failed"; - /// - /// FailedToRun - /// - public const string FailedToRun = "FailedToRun"; - /// - /// InProgress - /// - public const string InProgress = "InProgress"; - /// - /// Passed - /// - public const string Passed = "Passed"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ScanTriggerType.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ScanTriggerType.cs deleted file mode 100644 index 5ffd2c8c6dfe..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ScanTriggerType.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.Security.Models -{ - - /// - /// Defines values for ScanTriggerType. - /// - public static class ScanTriggerType - { - /// - /// OnDemand - /// - public const string OnDemand = "OnDemand"; - /// - /// Recurring - /// - public const string Recurring = "Recurring"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Scans.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Scans.cs deleted file mode 100644 index 4ccc0445a988..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Scans.cs +++ /dev/null @@ -1,54 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// A list of vulnerability assessment scan records. - /// - public partial class Scans - { - /// - /// Initializes a new instance of the Scans class. - /// - public Scans() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the Scans class. - /// - /// List of vulnerability assessment scan - /// records. - public Scans(IList value = default(IList)) - { - Value = value; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets list of vulnerability assessment scan records. - /// - [JsonProperty(PropertyName = "value")] - public IList Value { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ScopeElement.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ScopeElement.cs deleted file mode 100644 index c7c0bd533565..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ScopeElement.cs +++ /dev/null @@ -1,63 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// A more specific scope used to identify the alerts to suppress. - /// - public partial class ScopeElement - { - /// - /// Initializes a new instance of the ScopeElement class. - /// - public ScopeElement() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ScopeElement class. - /// - /// Unmatched properties from the - /// message are deserialized this collection - /// The alert entity type to suppress by. - public ScopeElement(IDictionary additionalProperties = default(IDictionary), string field = default(string)) - { - AdditionalProperties = additionalProperties; - Field = field; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets unmatched properties from the message are deserialized - /// this collection - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - - /// - /// Gets or sets the alert entity type to suppress by. - /// - [JsonProperty(PropertyName = "field")] - public string Field { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecureScoreControlDefinitionItem.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecureScoreControlDefinitionItem.cs deleted file mode 100644 index b00aa0b76545..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecureScoreControlDefinitionItem.cs +++ /dev/null @@ -1,123 +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.Security.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Information about the security control. - /// - [Rest.Serialization.JsonTransformation] - public partial class SecureScoreControlDefinitionItem : Resource - { - /// - /// Initializes a new instance of the SecureScoreControlDefinitionItem - /// class. - /// - public SecureScoreControlDefinitionItem() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the SecureScoreControlDefinitionItem - /// class. - /// - /// Resource Id - /// Resource name - /// Resource type - /// User friendly display name of the - /// control - /// User friendly description of the - /// control - /// Maximum control score (0..10) - /// Source object from which the control was - /// created - /// Array of assessments metadata - /// IDs that are included in this security control - public SecureScoreControlDefinitionItem(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), string description = default(string), int? maxScore = default(int?), SecureScoreControlDefinitionSource source = default(SecureScoreControlDefinitionSource), IList assessmentDefinitions = default(IList)) - : base(id, name, type) - { - DisplayName = displayName; - Description = description; - MaxScore = maxScore; - Source = source; - AssessmentDefinitions = assessmentDefinitions; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets user friendly display name of the control - /// - [JsonProperty(PropertyName = "properties.displayName")] - public string DisplayName { get; private set; } - - /// - /// Gets user friendly description of the control - /// - [JsonProperty(PropertyName = "properties.description")] - public string Description { get; private set; } - - /// - /// Gets maximum control score (0..10) - /// - [JsonProperty(PropertyName = "properties.maxScore")] - public int? MaxScore { get; private set; } - - /// - /// Gets source object from which the control was created - /// - [JsonProperty(PropertyName = "properties.source")] - public SecureScoreControlDefinitionSource Source { get; private set; } - - /// - /// Gets array of assessments metadata IDs that are included in this - /// security control - /// - [JsonProperty(PropertyName = "properties.assessmentDefinitions")] - public IList AssessmentDefinitions { get; private set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Description != null) - { - if (Description.Length > 256) - { - throw new ValidationException(ValidationRules.MaxLength, "Description", 256); - } - } - if (MaxScore > 10) - { - throw new ValidationException(ValidationRules.InclusiveMaximum, "MaxScore", 10); - } - if (MaxScore < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "MaxScore", 0); - } - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecureScoreControlDefinitionSource.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecureScoreControlDefinitionSource.cs deleted file mode 100644 index b7b1aed385e0..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecureScoreControlDefinitionSource.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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// The type of the security control (For example, BuiltIn) - /// - public partial class SecureScoreControlDefinitionSource - { - /// - /// Initializes a new instance of the - /// SecureScoreControlDefinitionSource class. - /// - public SecureScoreControlDefinitionSource() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// SecureScoreControlDefinitionSource class. - /// - /// The type of security control (for example, - /// BuiltIn). Possible values include: 'BuiltIn', 'Custom' - public SecureScoreControlDefinitionSource(string sourceType = default(string)) - { - SourceType = sourceType; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the type of security control (for example, BuiltIn). - /// Possible values include: 'BuiltIn', 'Custom' - /// - [JsonProperty(PropertyName = "sourceType")] - public string SourceType { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecureScoreControlDetails.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecureScoreControlDetails.cs deleted file mode 100644 index 731ad402ecdc..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecureScoreControlDetails.cs +++ /dev/null @@ -1,164 +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.Security.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Details of the security control, its score, and the health status of - /// the relevant resources. - /// - [Rest.Serialization.JsonTransformation] - public partial class SecureScoreControlDetails : Resource - { - /// - /// Initializes a new instance of the SecureScoreControlDetails class. - /// - public SecureScoreControlDetails() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the SecureScoreControlDetails class. - /// - /// Resource Id - /// Resource name - /// Resource type - /// User friendly display name of the - /// control - /// Maximum score available - /// Current score - /// Ratio of the current score divided by the - /// maximum. Rounded to 4 digits after the decimal point - /// Number of healthy resources in - /// the control - /// Number of unhealthy resources - /// in the control - /// Number of not applicable - /// resources in the control - /// The relative weight for this specific control - /// in each of your subscriptions. Used when calculating an aggregated - /// score for this control across all of your subscriptions. - public SecureScoreControlDetails(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), int? max = default(int?), double? current = default(double?), double? percentage = default(double?), int? healthyResourceCount = default(int?), int? unhealthyResourceCount = default(int?), int? notApplicableResourceCount = default(int?), long? weight = default(long?), SecureScoreControlDefinitionItem definition = default(SecureScoreControlDefinitionItem)) - : base(id, name, type) - { - DisplayName = displayName; - Max = max; - Current = current; - Percentage = percentage; - HealthyResourceCount = healthyResourceCount; - UnhealthyResourceCount = unhealthyResourceCount; - NotApplicableResourceCount = notApplicableResourceCount; - Weight = weight; - Definition = definition; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets user friendly display name of the control - /// - [JsonProperty(PropertyName = "properties.displayName")] - public string DisplayName { get; private set; } - - /// - /// Gets maximum score available - /// - [JsonProperty(PropertyName = "properties.score.max")] - public int? Max { get; private set; } - - /// - /// Gets current score - /// - [JsonProperty(PropertyName = "properties.score.current")] - public double? Current { get; private set; } - - /// - /// Gets ratio of the current score divided by the maximum. Rounded to - /// 4 digits after the decimal point - /// - [JsonProperty(PropertyName = "properties.score.percentage")] - public double? Percentage { get; private set; } - - /// - /// Gets number of healthy resources in the control - /// - [JsonProperty(PropertyName = "properties.healthyResourceCount")] - public int? HealthyResourceCount { get; private set; } - - /// - /// Gets number of unhealthy resources in the control - /// - [JsonProperty(PropertyName = "properties.unhealthyResourceCount")] - public int? UnhealthyResourceCount { get; private set; } - - /// - /// Gets number of not applicable resources in the control - /// - [JsonProperty(PropertyName = "properties.notApplicableResourceCount")] - public int? NotApplicableResourceCount { get; private set; } - - /// - /// Gets the relative weight for this specific control in each of your - /// subscriptions. Used when calculating an aggregated score for this - /// control across all of your subscriptions. - /// - [JsonProperty(PropertyName = "properties.weight")] - public long? Weight { get; private set; } - - /// - /// - [JsonProperty(PropertyName = "properties.definition")] - public SecureScoreControlDefinitionItem Definition { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Max < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Max", 0); - } - if (Current < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Current", 0); - } - if (Percentage > 1) - { - throw new ValidationException(ValidationRules.InclusiveMaximum, "Percentage", 1); - } - if (Percentage < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Percentage", 0); - } - if (Weight < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Weight", 0); - } - if (Definition != null) - { - Definition.Validate(); - } - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecureScoreControlScore.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecureScoreControlScore.cs deleted file mode 100644 index 0c5bcb1169af..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecureScoreControlScore.cs +++ /dev/null @@ -1,107 +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.Security.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Calculation result data - /// - public partial class SecureScoreControlScore - { - /// - /// Initializes a new instance of the SecureScoreControlScore class. - /// - public SecureScoreControlScore() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the SecureScoreControlScore class. - /// - /// Maximum control score (0..10) - /// Actual score for the control = (achieved - /// points / total points) * max score. if total points is zeroed, the - /// return number is 0.00 - /// Ratio of the current score divided by the - /// maximum. Rounded to 4 digits after the decimal point - public SecureScoreControlScore(int? max = default(int?), double? current = default(double?), double? percentage = default(double?)) - { - Max = max; - Current = current; - Percentage = percentage; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets maximum control score (0..10) - /// - [JsonProperty(PropertyName = "max")] - public int? Max { get; private set; } - - /// - /// Gets actual score for the control = (achieved points / total - /// points) * max score. if total points is zeroed, the return number - /// is 0.00 - /// - [JsonProperty(PropertyName = "current")] - public double? Current { get; private set; } - - /// - /// Gets ratio of the current score divided by the maximum. Rounded to - /// 4 digits after the decimal point - /// - [JsonProperty(PropertyName = "percentage")] - public double? Percentage { get; private set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Max > 10) - { - throw new ValidationException(ValidationRules.InclusiveMaximum, "Max", 10); - } - if (Max < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Max", 0); - } - if (Current > 10) - { - throw new ValidationException(ValidationRules.InclusiveMaximum, "Current", 10); - } - if (Current < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Current", 0); - } - if (Percentage > 1) - { - throw new ValidationException(ValidationRules.InclusiveMaximum, "Percentage", 1); - } - if (Percentage < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Percentage", 0); - } - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecureScoreItem.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecureScoreItem.cs deleted file mode 100644 index eef77dd1344f..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecureScoreItem.cs +++ /dev/null @@ -1,124 +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.Security.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Secure score item data model - /// - [Rest.Serialization.JsonTransformation] - public partial class SecureScoreItem : Resource - { - /// - /// Initializes a new instance of the SecureScoreItem class. - /// - public SecureScoreItem() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the SecureScoreItem class. - /// - /// Resource Id - /// Resource name - /// Resource type - /// The initiative’s name - /// Maximum score available - /// Current score - /// Ratio of the current score divided by the - /// maximum. Rounded to 4 digits after the decimal point - /// The relative weight for each subscription. - /// Used when calculating an aggregated secure score for multiple - /// subscriptions. - public SecureScoreItem(string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), int? max = default(int?), double? current = default(double?), double? percentage = default(double?), long? weight = default(long?)) - : base(id, name, type) - { - DisplayName = displayName; - Max = max; - Current = current; - Percentage = percentage; - Weight = weight; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the initiative’s name - /// - [JsonProperty(PropertyName = "properties.displayName")] - public string DisplayName { get; private set; } - - /// - /// Gets maximum score available - /// - [JsonProperty(PropertyName = "properties.score.max")] - public int? Max { get; private set; } - - /// - /// Gets current score - /// - [JsonProperty(PropertyName = "properties.score.current")] - public double? Current { get; private set; } - - /// - /// Gets ratio of the current score divided by the maximum. Rounded to - /// 4 digits after the decimal point - /// - [JsonProperty(PropertyName = "properties.score.percentage")] - public double? Percentage { get; private set; } - - /// - /// Gets the relative weight for each subscription. Used when - /// calculating an aggregated secure score for multiple subscriptions. - /// - [JsonProperty(PropertyName = "properties.weight")] - public long? Weight { get; private set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Max < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Max", 0); - } - if (Current < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Current", 0); - } - if (Percentage > 1) - { - throw new ValidationException(ValidationRules.InclusiveMaximum, "Percentage", 1); - } - if (Percentage < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Percentage", 0); - } - if (Weight < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Weight", 0); - } - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecurityAssessment.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecurityAssessment.cs deleted file mode 100644 index 2b4a650f6330..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecurityAssessment.cs +++ /dev/null @@ -1,129 +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.Security.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Security assessment on a resource - /// - [Rest.Serialization.JsonTransformation] - public partial class SecurityAssessment : Resource - { - /// - /// Initializes a new instance of the SecurityAssessment class. - /// - public SecurityAssessment() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the SecurityAssessment class. - /// - /// Resource Id - /// Resource name - /// Resource type - /// User friendly display name of the - /// assessment - /// Additional data regarding the - /// assessment - public SecurityAssessment(ResourceDetails resourceDetails, AssessmentStatus status, string id = default(string), string name = default(string), string type = default(string), string displayName = default(string), IDictionary additionalData = default(IDictionary), AssessmentLinks links = default(AssessmentLinks), SecurityAssessmentMetadataProperties metadata = default(SecurityAssessmentMetadataProperties), SecurityAssessmentPartnerData partnersData = default(SecurityAssessmentPartnerData)) - : base(id, name, type) - { - ResourceDetails = resourceDetails; - DisplayName = displayName; - Status = status; - AdditionalData = additionalData; - Links = links; - Metadata = metadata; - PartnersData = partnersData; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "properties.resourceDetails")] - public ResourceDetails ResourceDetails { get; set; } - - /// - /// Gets user friendly display name of the assessment - /// - [JsonProperty(PropertyName = "properties.displayName")] - public string DisplayName { get; private set; } - - /// - /// - [JsonProperty(PropertyName = "properties.status")] - public AssessmentStatus Status { get; set; } - - /// - /// Gets or sets additional data regarding the assessment - /// - [JsonProperty(PropertyName = "properties.additionalData")] - public IDictionary AdditionalData { get; set; } - - /// - /// - [JsonProperty(PropertyName = "properties.links")] - public AssessmentLinks Links { get; set; } - - /// - /// - [JsonProperty(PropertyName = "properties.metadata")] - public SecurityAssessmentMetadataProperties Metadata { get; set; } - - /// - /// - [JsonProperty(PropertyName = "properties.partnersData")] - public SecurityAssessmentPartnerData PartnersData { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (ResourceDetails == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ResourceDetails"); - } - if (Status == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Status"); - } - if (Status != null) - { - Status.Validate(); - } - if (Metadata != null) - { - Metadata.Validate(); - } - if (PartnersData != null) - { - PartnersData.Validate(); - } - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecurityAssessmentMetadata.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecurityAssessmentMetadata.cs deleted file mode 100644 index 6e117714f897..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecurityAssessmentMetadata.cs +++ /dev/null @@ -1,187 +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.Security.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Security assessment metadata - /// - [Rest.Serialization.JsonTransformation] - public partial class SecurityAssessmentMetadata : Resource - { - /// - /// Initializes a new instance of the SecurityAssessmentMetadata class. - /// - public SecurityAssessmentMetadata() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the SecurityAssessmentMetadata class. - /// - /// User friendly display name of the - /// assessment - /// The severity level of the assessment. - /// Possible values include: 'Low', 'Medium', 'High' - /// BuiltIn if the assessment based on - /// built-in Azure Policy definition, Custom if the assessment based on - /// custom Azure Policy definition. Possible values include: 'BuiltIn', - /// 'CustomPolicy', 'CustomerManaged', 'VerifiedPartner' - /// Resource Id - /// Resource name - /// Resource type - /// Azure resource ID of the policy - /// definition that turns this assessment calculation on - /// Human readable description of the - /// assessment - /// Human readable description of - /// what you should do to mitigate this security issue - /// The user impact of the assessment. - /// Possible values include: 'Low', 'Moderate', 'High' - /// The implementation effort - /// required to remediate this assessment. Possible values include: - /// 'Low', 'Moderate', 'High' - /// True if this assessment is in preview release - /// status - public SecurityAssessmentMetadata(string displayName, string severity, string assessmentType, string id = default(string), string name = default(string), string type = default(string), string policyDefinitionId = default(string), string description = default(string), string remediationDescription = default(string), IList categories = default(IList), string userImpact = default(string), string implementationEffort = default(string), IList threats = default(IList), bool? preview = default(bool?), SecurityAssessmentMetadataPartnerData partnerData = default(SecurityAssessmentMetadataPartnerData)) - : base(id, name, type) - { - DisplayName = displayName; - PolicyDefinitionId = policyDefinitionId; - Description = description; - RemediationDescription = remediationDescription; - Categories = categories; - Severity = severity; - UserImpact = userImpact; - ImplementationEffort = implementationEffort; - Threats = threats; - Preview = preview; - AssessmentType = assessmentType; - PartnerData = partnerData; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets user friendly display name of the assessment - /// - [JsonProperty(PropertyName = "properties.displayName")] - public string DisplayName { get; set; } - - /// - /// Gets azure resource ID of the policy definition that turns this - /// assessment calculation on - /// - [JsonProperty(PropertyName = "properties.policyDefinitionId")] - public string PolicyDefinitionId { get; private set; } - - /// - /// Gets or sets human readable description of the assessment - /// - [JsonProperty(PropertyName = "properties.description")] - public string Description { get; set; } - - /// - /// Gets or sets human readable description of what you should do to - /// mitigate this security issue - /// - [JsonProperty(PropertyName = "properties.remediationDescription")] - public string RemediationDescription { get; set; } - - /// - /// - [JsonProperty(PropertyName = "properties.categories")] - public IList Categories { get; set; } - - /// - /// Gets or sets the severity level of the assessment. Possible values - /// include: 'Low', 'Medium', 'High' - /// - [JsonProperty(PropertyName = "properties.severity")] - public string Severity { get; set; } - - /// - /// Gets or sets the user impact of the assessment. Possible values - /// include: 'Low', 'Moderate', 'High' - /// - [JsonProperty(PropertyName = "properties.userImpact")] - public string UserImpact { get; set; } - - /// - /// Gets or sets the implementation effort required to remediate this - /// assessment. Possible values include: 'Low', 'Moderate', 'High' - /// - [JsonProperty(PropertyName = "properties.implementationEffort")] - public string ImplementationEffort { get; set; } - - /// - /// - [JsonProperty(PropertyName = "properties.threats")] - public IList Threats { get; set; } - - /// - /// Gets or sets true if this assessment is in preview release status - /// - [JsonProperty(PropertyName = "properties.preview")] - public bool? Preview { get; set; } - - /// - /// Gets or sets builtIn if the assessment based on built-in Azure - /// Policy definition, Custom if the assessment based on custom Azure - /// Policy definition. Possible values include: 'BuiltIn', - /// 'CustomPolicy', 'CustomerManaged', 'VerifiedPartner' - /// - [JsonProperty(PropertyName = "properties.assessmentType")] - public string AssessmentType { get; set; } - - /// - /// - [JsonProperty(PropertyName = "properties.partnerData")] - public SecurityAssessmentMetadataPartnerData PartnerData { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (DisplayName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "DisplayName"); - } - if (Severity == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Severity"); - } - if (AssessmentType == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "AssessmentType"); - } - if (PartnerData != null) - { - PartnerData.Validate(); - } - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecurityAssessmentMetadataPartnerData.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecurityAssessmentMetadataPartnerData.cs deleted file mode 100644 index 239f0ac190e8..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecurityAssessmentMetadataPartnerData.cs +++ /dev/null @@ -1,92 +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.Security.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Describes the partner that created the assessment - /// - public partial class SecurityAssessmentMetadataPartnerData - { - /// - /// Initializes a new instance of the - /// SecurityAssessmentMetadataPartnerData class. - /// - public SecurityAssessmentMetadataPartnerData() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// SecurityAssessmentMetadataPartnerData class. - /// - /// Name of the company of the - /// partner - /// Secret to authenticate the partner and verify - /// it created the assessment - write only - /// Name of the product of the partner that - /// created the assessment - public SecurityAssessmentMetadataPartnerData(string partnerName, string secret, string productName = default(string)) - { - PartnerName = partnerName; - ProductName = productName; - Secret = secret; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets name of the company of the partner - /// - [JsonProperty(PropertyName = "partnerName")] - public string PartnerName { get; set; } - - /// - /// Gets or sets name of the product of the partner that created the - /// assessment - /// - [JsonProperty(PropertyName = "productName")] - public string ProductName { get; set; } - - /// - /// Gets or sets secret to authenticate the partner and verify it - /// created the assessment - write only - /// - [JsonProperty(PropertyName = "secret")] - public string Secret { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (PartnerName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "PartnerName"); - } - if (Secret == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Secret"); - } - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecurityAssessmentMetadataProperties.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecurityAssessmentMetadataProperties.cs deleted file mode 100644 index 56d202538867..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecurityAssessmentMetadataProperties.cs +++ /dev/null @@ -1,183 +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.Security.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Describes properties of an assessment metadata. - /// - public partial class SecurityAssessmentMetadataProperties - { - /// - /// Initializes a new instance of the - /// SecurityAssessmentMetadataProperties class. - /// - public SecurityAssessmentMetadataProperties() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// SecurityAssessmentMetadataProperties class. - /// - /// User friendly display name of the - /// assessment - /// The severity level of the assessment. - /// Possible values include: 'Low', 'Medium', 'High' - /// BuiltIn if the assessment based on - /// built-in Azure Policy definition, Custom if the assessment based on - /// custom Azure Policy definition. Possible values include: 'BuiltIn', - /// 'CustomPolicy', 'CustomerManaged', 'VerifiedPartner' - /// Azure resource ID of the policy - /// definition that turns this assessment calculation on - /// Human readable description of the - /// assessment - /// Human readable description of - /// what you should do to mitigate this security issue - /// The user impact of the assessment. - /// Possible values include: 'Low', 'Moderate', 'High' - /// The implementation effort - /// required to remediate this assessment. Possible values include: - /// 'Low', 'Moderate', 'High' - /// True if this assessment is in preview release - /// status - public SecurityAssessmentMetadataProperties(string displayName, string severity, string assessmentType, string policyDefinitionId = default(string), string description = default(string), string remediationDescription = default(string), IList categories = default(IList), string userImpact = default(string), string implementationEffort = default(string), IList threats = default(IList), bool? preview = default(bool?), SecurityAssessmentMetadataPartnerData partnerData = default(SecurityAssessmentMetadataPartnerData)) - { - DisplayName = displayName; - PolicyDefinitionId = policyDefinitionId; - Description = description; - RemediationDescription = remediationDescription; - Categories = categories; - Severity = severity; - UserImpact = userImpact; - ImplementationEffort = implementationEffort; - Threats = threats; - Preview = preview; - AssessmentType = assessmentType; - PartnerData = partnerData; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets user friendly display name of the assessment - /// - [JsonProperty(PropertyName = "displayName")] - public string DisplayName { get; set; } - - /// - /// Gets azure resource ID of the policy definition that turns this - /// assessment calculation on - /// - [JsonProperty(PropertyName = "policyDefinitionId")] - public string PolicyDefinitionId { get; private set; } - - /// - /// Gets or sets human readable description of the assessment - /// - [JsonProperty(PropertyName = "description")] - public string Description { get; set; } - - /// - /// Gets or sets human readable description of what you should do to - /// mitigate this security issue - /// - [JsonProperty(PropertyName = "remediationDescription")] - public string RemediationDescription { get; set; } - - /// - /// - [JsonProperty(PropertyName = "categories")] - public IList Categories { get; set; } - - /// - /// Gets or sets the severity level of the assessment. Possible values - /// include: 'Low', 'Medium', 'High' - /// - [JsonProperty(PropertyName = "severity")] - public string Severity { get; set; } - - /// - /// Gets or sets the user impact of the assessment. Possible values - /// include: 'Low', 'Moderate', 'High' - /// - [JsonProperty(PropertyName = "userImpact")] - public string UserImpact { get; set; } - - /// - /// Gets or sets the implementation effort required to remediate this - /// assessment. Possible values include: 'Low', 'Moderate', 'High' - /// - [JsonProperty(PropertyName = "implementationEffort")] - public string ImplementationEffort { get; set; } - - /// - /// - [JsonProperty(PropertyName = "threats")] - public IList Threats { get; set; } - - /// - /// Gets or sets true if this assessment is in preview release status - /// - [JsonProperty(PropertyName = "preview")] - public bool? Preview { get; set; } - - /// - /// Gets or sets builtIn if the assessment based on built-in Azure - /// Policy definition, Custom if the assessment based on custom Azure - /// Policy definition. Possible values include: 'BuiltIn', - /// 'CustomPolicy', 'CustomerManaged', 'VerifiedPartner' - /// - [JsonProperty(PropertyName = "assessmentType")] - public string AssessmentType { get; set; } - - /// - /// - [JsonProperty(PropertyName = "partnerData")] - public SecurityAssessmentMetadataPartnerData PartnerData { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (DisplayName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "DisplayName"); - } - if (Severity == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Severity"); - } - if (AssessmentType == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "AssessmentType"); - } - if (PartnerData != null) - { - PartnerData.Validate(); - } - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecurityAssessmentPartnerData.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecurityAssessmentPartnerData.cs deleted file mode 100644 index a5111cfc592e..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecurityAssessmentPartnerData.cs +++ /dev/null @@ -1,81 +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.Security.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Data regarding 3rd party partner integration - /// - public partial class SecurityAssessmentPartnerData - { - /// - /// Initializes a new instance of the SecurityAssessmentPartnerData - /// class. - /// - public SecurityAssessmentPartnerData() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the SecurityAssessmentPartnerData - /// class. - /// - /// Name of the company of the - /// partner - /// secret to authenticate the partner - write - /// only - public SecurityAssessmentPartnerData(string partnerName, string secret) - { - PartnerName = partnerName; - Secret = secret; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets name of the company of the partner - /// - [JsonProperty(PropertyName = "partnerName")] - public string PartnerName { get; set; } - - /// - /// Gets or sets secret to authenticate the partner - write only - /// - [JsonProperty(PropertyName = "secret")] - public string Secret { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (PartnerName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "PartnerName"); - } - if (Secret == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Secret"); - } - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecurityContact.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecurityContact.cs deleted file mode 100644 index 74cfac436c2d..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecurityContact.cs +++ /dev/null @@ -1,110 +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.Security.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Contact details for security issues - /// - [Rest.Serialization.JsonTransformation] - public partial class SecurityContact : Resource - { - /// - /// Initializes a new instance of the SecurityContact class. - /// - public SecurityContact() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the SecurityContact class. - /// - /// The email of this security contact - /// Whether to send security alerts - /// notifications to the security contact. Possible values include: - /// 'On', 'Off' - /// Whether to send security alerts - /// notifications to subscription admins. Possible values include: - /// 'On', 'Off' - /// Resource Id - /// Resource name - /// Resource type - /// The phone number of this security - /// contact - public SecurityContact(string email, string alertNotifications, string alertsToAdmins, string id = default(string), string name = default(string), string type = default(string), string phone = default(string)) - : base(id, name, type) - { - Email = email; - Phone = phone; - AlertNotifications = alertNotifications; - AlertsToAdmins = alertsToAdmins; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the email of this security contact - /// - [JsonProperty(PropertyName = "properties.email")] - public string Email { get; set; } - - /// - /// Gets or sets the phone number of this security contact - /// - [JsonProperty(PropertyName = "properties.phone")] - public string Phone { get; set; } - - /// - /// Gets or sets whether to send security alerts notifications to the - /// security contact. Possible values include: 'On', 'Off' - /// - [JsonProperty(PropertyName = "properties.alertNotifications")] - public string AlertNotifications { get; set; } - - /// - /// Gets or sets whether to send security alerts notifications to - /// subscription admins. Possible values include: 'On', 'Off' - /// - [JsonProperty(PropertyName = "properties.alertsToAdmins")] - public string AlertsToAdmins { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Email == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Email"); - } - if (AlertNotifications == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "AlertNotifications"); - } - if (AlertsToAdmins == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "AlertsToAdmins"); - } - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecurityFamily.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecurityFamily.cs deleted file mode 100644 index 5c56967d3c07..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecurityFamily.cs +++ /dev/null @@ -1,24 +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.Security.Models -{ - - /// - /// Defines values for SecurityFamily. - /// - public static class SecurityFamily - { - public const string Waf = "Waf"; - public const string Ngfw = "Ngfw"; - public const string SaasWaf = "SaasWaf"; - public const string Va = "Va"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecuritySolution.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecuritySolution.cs deleted file mode 100644 index 3b11e243b80e..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecuritySolution.cs +++ /dev/null @@ -1,140 +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.Security.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - [Rest.Serialization.JsonTransformation] - public partial class SecuritySolution - { - /// - /// Initializes a new instance of the SecuritySolution class. - /// - public SecuritySolution() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the SecuritySolution class. - /// - /// The security family of the security - /// solution. Possible values include: 'Waf', 'Ngfw', 'SaasWaf', - /// 'Va' - /// The security family provisioning - /// State. Possible values include: 'Succeeded', 'Failed', - /// 'Updating' - /// The security solutions' template - /// The security solutions' - /// status - /// Resource Id - /// Resource name - /// Resource type - /// Location where the resource is - /// stored - public SecuritySolution(string securityFamily, string provisioningState, string template, string protectionStatus, string id = default(string), string name = default(string), string type = default(string), string location = default(string)) - { - Id = id; - Name = name; - Type = type; - Location = location; - SecurityFamily = securityFamily; - ProvisioningState = provisioningState; - Template = template; - ProtectionStatus = protectionStatus; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets resource Id - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } - - /// - /// Gets resource name - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } - - /// - /// Gets resource type - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } - - /// - /// Gets location where the resource is stored - /// - [JsonProperty(PropertyName = "location")] - public string Location { get; private set; } - - /// - /// Gets or sets the security family of the security solution. Possible - /// values include: 'Waf', 'Ngfw', 'SaasWaf', 'Va' - /// - [JsonProperty(PropertyName = "properties.securityFamily")] - public string SecurityFamily { get; set; } - - /// - /// Gets or sets the security family provisioning State. Possible - /// values include: 'Succeeded', 'Failed', 'Updating' - /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; set; } - - /// - /// Gets or sets the security solutions' template - /// - [JsonProperty(PropertyName = "properties.template")] - public string Template { get; set; } - - /// - /// Gets or sets the security solutions' status - /// - [JsonProperty(PropertyName = "properties.protectionStatus")] - public string ProtectionStatus { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (SecurityFamily == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "SecurityFamily"); - } - if (ProvisioningState == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ProvisioningState"); - } - if (Template == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Template"); - } - if (ProtectionStatus == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ProtectionStatus"); - } - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecuritySolutionStatus.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecuritySolutionStatus.cs deleted file mode 100644 index 04aa23861a3e..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecuritySolutionStatus.cs +++ /dev/null @@ -1,22 +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.Security.Models -{ - - /// - /// Defines values for SecuritySolutionStatus. - /// - public static class SecuritySolutionStatus - { - public const string Enabled = "Enabled"; - public const string Disabled = "Disabled"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecuritySolutionsReferenceData.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecuritySolutionsReferenceData.cs deleted file mode 100644 index fb9f193a9b77..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecuritySolutionsReferenceData.cs +++ /dev/null @@ -1,178 +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.Security.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - [Rest.Serialization.JsonTransformation] - public partial class SecuritySolutionsReferenceData - { - /// - /// Initializes a new instance of the SecuritySolutionsReferenceData - /// class. - /// - public SecuritySolutionsReferenceData() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the SecuritySolutionsReferenceData - /// class. - /// - /// The security family of the security - /// solution. Possible values include: 'Waf', 'Ngfw', 'SaasWaf', - /// 'Va' - /// The security solutions' vendor - /// name - /// The security solutions' package info - /// url - /// The security solutions' product - /// name - /// The security solutions' publisher - /// The security solutions' - /// publisher display name - /// The security solutions' template - /// Resource Id - /// Resource name - /// Resource type - /// Location where the resource is - /// stored - public SecuritySolutionsReferenceData(string securityFamily, string alertVendorName, string packageInfoUrl, string productName, string publisher, string publisherDisplayName, string template, string id = default(string), string name = default(string), string type = default(string), string location = default(string)) - { - Id = id; - Name = name; - Type = type; - Location = location; - SecurityFamily = securityFamily; - AlertVendorName = alertVendorName; - PackageInfoUrl = packageInfoUrl; - ProductName = productName; - Publisher = publisher; - PublisherDisplayName = publisherDisplayName; - Template = template; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets resource Id - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } - - /// - /// Gets resource name - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } - - /// - /// Gets resource type - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } - - /// - /// Gets location where the resource is stored - /// - [JsonProperty(PropertyName = "location")] - public string Location { get; private set; } - - /// - /// Gets or sets the security family of the security solution. Possible - /// values include: 'Waf', 'Ngfw', 'SaasWaf', 'Va' - /// - [JsonProperty(PropertyName = "properties.securityFamily")] - public string SecurityFamily { get; set; } - - /// - /// Gets or sets the security solutions' vendor name - /// - [JsonProperty(PropertyName = "properties.alertVendorName")] - public string AlertVendorName { get; set; } - - /// - /// Gets or sets the security solutions' package info url - /// - [JsonProperty(PropertyName = "properties.packageInfoUrl")] - public string PackageInfoUrl { get; set; } - - /// - /// Gets or sets the security solutions' product name - /// - [JsonProperty(PropertyName = "properties.productName")] - public string ProductName { get; set; } - - /// - /// Gets or sets the security solutions' publisher - /// - [JsonProperty(PropertyName = "properties.publisher")] - public string Publisher { get; set; } - - /// - /// Gets or sets the security solutions' publisher display name - /// - [JsonProperty(PropertyName = "properties.publisherDisplayName")] - public string PublisherDisplayName { get; set; } - - /// - /// Gets or sets the security solutions' template - /// - [JsonProperty(PropertyName = "properties.template")] - public string Template { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (SecurityFamily == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "SecurityFamily"); - } - if (AlertVendorName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "AlertVendorName"); - } - if (PackageInfoUrl == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "PackageInfoUrl"); - } - if (ProductName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ProductName"); - } - if (Publisher == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Publisher"); - } - if (PublisherDisplayName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "PublisherDisplayName"); - } - if (Template == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Template"); - } - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecuritySolutionsReferenceDataList.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecuritySolutionsReferenceDataList.cs deleted file mode 100644 index 9f49c1c98659..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecuritySolutionsReferenceDataList.cs +++ /dev/null @@ -1,50 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - public partial class SecuritySolutionsReferenceDataList - { - /// - /// Initializes a new instance of the - /// SecuritySolutionsReferenceDataList class. - /// - public SecuritySolutionsReferenceDataList() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// SecuritySolutionsReferenceDataList class. - /// - public SecuritySolutionsReferenceDataList(IList value = default(IList)) - { - Value = value; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "value")] - public IList Value { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecuritySubAssessment.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecuritySubAssessment.cs deleted file mode 100644 index 36c19a3ee77c..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecuritySubAssessment.cs +++ /dev/null @@ -1,129 +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.Security.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Security sub-assessment on a resource - /// - [Rest.Serialization.JsonTransformation] - public partial class SecuritySubAssessment : Resource - { - /// - /// Initializes a new instance of the SecuritySubAssessment class. - /// - public SecuritySubAssessment() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the SecuritySubAssessment class. - /// - /// Resource Id - /// Resource name - /// Resource type - /// Vulnerability ID - /// User friendly display name of the - /// sub-assessment - /// Information on how to remediate this - /// sub-assessment - /// Description of the impact of this - /// sub-assessment - /// Category of the sub-assessment - /// Human readable description of the - /// assessment status - /// The date and time the sub-assessment - /// was generated - public SecuritySubAssessment(string id = default(string), string name = default(string), string type = default(string), string securitySubAssessmentId = default(string), string displayName = default(string), SubAssessmentStatus status = default(SubAssessmentStatus), string remediation = default(string), string impact = default(string), string category = default(string), string description = default(string), System.DateTime? timeGenerated = default(System.DateTime?), ResourceDetails resourceDetails = default(ResourceDetails), AdditionalData additionalData = default(AdditionalData)) - : base(id, name, type) - { - SecuritySubAssessmentId = securitySubAssessmentId; - DisplayName = displayName; - Status = status; - Remediation = remediation; - Impact = impact; - Category = category; - Description = description; - TimeGenerated = timeGenerated; - ResourceDetails = resourceDetails; - AdditionalData = additionalData; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets vulnerability ID - /// - [JsonProperty(PropertyName = "properties.id")] - public string SecuritySubAssessmentId { get; private set; } - - /// - /// Gets user friendly display name of the sub-assessment - /// - [JsonProperty(PropertyName = "properties.displayName")] - public string DisplayName { get; private set; } - - /// - /// - [JsonProperty(PropertyName = "properties.status")] - public SubAssessmentStatus Status { get; set; } - - /// - /// Gets information on how to remediate this sub-assessment - /// - [JsonProperty(PropertyName = "properties.remediation")] - public string Remediation { get; private set; } - - /// - /// Gets description of the impact of this sub-assessment - /// - [JsonProperty(PropertyName = "properties.impact")] - public string Impact { get; private set; } - - /// - /// Gets category of the sub-assessment - /// - [JsonProperty(PropertyName = "properties.category")] - public string Category { get; private set; } - - /// - /// Gets human readable description of the assessment status - /// - [JsonProperty(PropertyName = "properties.description")] - public string Description { get; private set; } - - /// - /// Gets the date and time the sub-assessment was generated - /// - [JsonProperty(PropertyName = "properties.timeGenerated")] - public System.DateTime? TimeGenerated { get; private set; } - - /// - /// - [JsonProperty(PropertyName = "properties.resourceDetails")] - public ResourceDetails ResourceDetails { get; set; } - - /// - /// - [JsonProperty(PropertyName = "properties.additionalData")] - public AdditionalData AdditionalData { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecurityTask.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecurityTask.cs deleted file mode 100644 index c220f050da08..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecurityTask.cs +++ /dev/null @@ -1,92 +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.Security.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Security task that we recommend to do in order to strengthen security - /// - [Rest.Serialization.JsonTransformation] - public partial class SecurityTask : Resource - { - /// - /// Initializes a new instance of the SecurityTask class. - /// - public SecurityTask() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the SecurityTask class. - /// - /// Resource Id - /// Resource name - /// Resource type - /// State of the task (Active, Resolved - /// etc.) - /// The time this task was discovered in - /// UTC - /// The time this task's details - /// were last changed in UTC - /// Additional data on the state of the - /// task - public SecurityTask(string id = default(string), string name = default(string), string type = default(string), string state = default(string), System.DateTime? creationTimeUtc = default(System.DateTime?), SecurityTaskParameters securityTaskParameters = default(SecurityTaskParameters), System.DateTime? lastStateChangeTimeUtc = default(System.DateTime?), string subState = default(string)) - : base(id, name, type) - { - State = state; - CreationTimeUtc = creationTimeUtc; - SecurityTaskParameters = securityTaskParameters; - LastStateChangeTimeUtc = lastStateChangeTimeUtc; - SubState = subState; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets state of the task (Active, Resolved etc.) - /// - [JsonProperty(PropertyName = "properties.state")] - public string State { get; private set; } - - /// - /// Gets the time this task was discovered in UTC - /// - [JsonProperty(PropertyName = "properties.creationTimeUtc")] - public System.DateTime? CreationTimeUtc { get; private set; } - - /// - /// - [JsonProperty(PropertyName = "properties.securityTaskParameters")] - public SecurityTaskParameters SecurityTaskParameters { get; set; } - - /// - /// Gets the time this task's details were last changed in UTC - /// - [JsonProperty(PropertyName = "properties.lastStateChangeTimeUtc")] - public System.DateTime? LastStateChangeTimeUtc { get; private set; } - - /// - /// Gets additional data on the state of the task - /// - [JsonProperty(PropertyName = "properties.subState")] - public string SubState { get; private set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecurityTaskParameters.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecurityTaskParameters.cs deleted file mode 100644 index c4fe6ec39563..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecurityTaskParameters.cs +++ /dev/null @@ -1,64 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Changing set of properties, depending on the task type that is derived - /// from the name field - /// - public partial class SecurityTaskParameters - { - /// - /// Initializes a new instance of the SecurityTaskParameters class. - /// - public SecurityTaskParameters() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the SecurityTaskParameters class. - /// - /// Unmatched properties from the - /// message are deserialized this collection - /// Name of the task type - public SecurityTaskParameters(IDictionary additionalProperties = default(IDictionary), string name = default(string)) - { - AdditionalProperties = additionalProperties; - Name = name; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets unmatched properties from the message are deserialized - /// this collection - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - - /// - /// Gets name of the task type - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SensitivityLabel.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SensitivityLabel.cs deleted file mode 100644 index eab74c284f0a..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SensitivityLabel.cs +++ /dev/null @@ -1,88 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// The sensitivity label. - /// - public partial class SensitivityLabel - { - /// - /// Initializes a new instance of the SensitivityLabel class. - /// - public SensitivityLabel() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the SensitivityLabel class. - /// - /// The name of the sensitivity - /// label. - /// The description of the sensitivity - /// label. - /// The rank of the sensitivity label. Possible - /// values include: 'None', 'Low', 'Medium', 'High', 'Critical' - /// The order of the sensitivity label. - /// Indicates whether the label is enabled or - /// not. - public SensitivityLabel(string displayName = default(string), string description = default(string), Rank? rank = default(Rank?), int? order = default(int?), bool? enabled = default(bool?)) - { - DisplayName = displayName; - Description = description; - Rank = rank; - Order = order; - Enabled = enabled; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the name of the sensitivity label. - /// - [JsonProperty(PropertyName = "displayName")] - public string DisplayName { get; set; } - - /// - /// Gets or sets the description of the sensitivity label. - /// - [JsonProperty(PropertyName = "description")] - public string Description { get; set; } - - /// - /// Gets or sets the rank of the sensitivity label. Possible values - /// include: 'None', 'Low', 'Medium', 'High', 'Critical' - /// - [JsonProperty(PropertyName = "rank")] - public Rank? Rank { get; set; } - - /// - /// Gets or sets the order of the sensitivity label. - /// - [JsonProperty(PropertyName = "order")] - public int? Order { get; set; } - - /// - /// Gets or sets indicates whether the label is enabled or not. - /// - [JsonProperty(PropertyName = "enabled")] - public bool? Enabled { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ServerVulnerabilityAssessment.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ServerVulnerabilityAssessment.cs deleted file mode 100644 index b439ebeeee5c..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ServerVulnerabilityAssessment.cs +++ /dev/null @@ -1,65 +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.Security.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Describes the server vulnerability assessment details on a resource - /// - [Rest.Serialization.JsonTransformation] - public partial class ServerVulnerabilityAssessment : Resource - { - /// - /// Initializes a new instance of the ServerVulnerabilityAssessment - /// class. - /// - public ServerVulnerabilityAssessment() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ServerVulnerabilityAssessment - /// class. - /// - /// Resource Id - /// Resource name - /// Resource type - /// The provisioningState of the - /// vulnerability assessment capability on the VM. Possible values - /// include: 'Succeeded', 'Failed', 'Canceled', 'Provisioning', - /// 'Deprovisioning' - public ServerVulnerabilityAssessment(string id = default(string), string name = default(string), string type = default(string), string provisioningState = default(string)) - : base(id, name, type) - { - ProvisioningState = provisioningState; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the provisioningState of the vulnerability assessment - /// capability on the VM. Possible values include: 'Succeeded', - /// 'Failed', 'Canceled', 'Provisioning', 'Deprovisioning' - /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; private set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ServerVulnerabilityAssessmentsList.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ServerVulnerabilityAssessmentsList.cs deleted file mode 100644 index 55aa5f7c97b7..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ServerVulnerabilityAssessmentsList.cs +++ /dev/null @@ -1,53 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// List of server vulnerability assessments - /// - public partial class ServerVulnerabilityAssessmentsList - { - /// - /// Initializes a new instance of the - /// ServerVulnerabilityAssessmentsList class. - /// - public ServerVulnerabilityAssessmentsList() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// ServerVulnerabilityAssessmentsList class. - /// - public ServerVulnerabilityAssessmentsList(IList value = default(IList)) - { - Value = value; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "value")] - public IList Value { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ServerVulnerabilityProperties.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ServerVulnerabilityProperties.cs deleted file mode 100644 index bbfe28e93d43..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ServerVulnerabilityProperties.cs +++ /dev/null @@ -1,106 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Additional context fields for server vulnerability assessment - /// - [Newtonsoft.Json.JsonObject("ServerVulnerabilityAssessment")] - public partial class ServerVulnerabilityProperties : AdditionalData - { - /// - /// Initializes a new instance of the ServerVulnerabilityProperties - /// class. - /// - public ServerVulnerabilityProperties() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ServerVulnerabilityProperties - /// class. - /// - /// Vulnerability Type. e.g: Vulnerability, - /// Potential Vulnerability, Information Gathered - /// Dictionary from cvss version to cvss details - /// object - /// Indicates whether a patch is available or - /// not - /// List of CVEs - /// Threat name - /// Published time - public ServerVulnerabilityProperties(string type = default(string), IDictionary cvss = default(IDictionary), bool? patchable = default(bool?), IList cve = default(IList), string threat = default(string), System.DateTime? publishedTime = default(System.DateTime?), IList vendorReferences = default(IList)) - { - Type = type; - Cvss = cvss; - Patchable = patchable; - Cve = cve; - Threat = threat; - PublishedTime = publishedTime; - VendorReferences = vendorReferences; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets vulnerability Type. e.g: Vulnerability, Potential - /// Vulnerability, Information Gathered - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } - - /// - /// Gets dictionary from cvss version to cvss details object - /// - [JsonProperty(PropertyName = "cvss")] - public IDictionary Cvss { get; private set; } - - /// - /// Gets indicates whether a patch is available or not - /// - [JsonProperty(PropertyName = "patchable")] - public bool? Patchable { get; private set; } - - /// - /// Gets list of CVEs - /// - [JsonProperty(PropertyName = "cve")] - public IList Cve { get; private set; } - - /// - /// Gets threat name - /// - [JsonProperty(PropertyName = "threat")] - public string Threat { get; private set; } - - /// - /// Gets published time - /// - [JsonProperty(PropertyName = "publishedTime")] - public System.DateTime? PublishedTime { get; private set; } - - /// - /// - [JsonProperty(PropertyName = "vendorReferences")] - public IList VendorReferences { get; private set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ServicePrincipalProperties.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ServicePrincipalProperties.cs deleted file mode 100644 index 974632976de4..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ServicePrincipalProperties.cs +++ /dev/null @@ -1,64 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Details of the service principal. - /// - public partial class ServicePrincipalProperties - { - /// - /// Initializes a new instance of the ServicePrincipalProperties class. - /// - public ServicePrincipalProperties() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ServicePrincipalProperties class. - /// - /// Application ID of service - /// principal. - /// A secret string that the application uses to - /// prove its identity, also can be referred to as application password - /// (write only). - public ServicePrincipalProperties(string applicationId = default(string), string secret = default(string)) - { - ApplicationId = applicationId; - Secret = secret; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets application ID of service principal. - /// - [JsonProperty(PropertyName = "applicationId")] - public string ApplicationId { get; set; } - - /// - /// Gets or sets a secret string that the application uses to prove its - /// identity, also can be referred to as application password (write - /// only). - /// - [JsonProperty(PropertyName = "secret")] - public string Secret { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Setting.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Setting.cs deleted file mode 100644 index 6b8f43e31e7d..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Setting.cs +++ /dev/null @@ -1,46 +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.Security.Models -{ - using System.Linq; - - /// - /// The kind of the security setting - /// - public partial class Setting : Resource - { - /// - /// Initializes a new instance of the Setting class. - /// - public Setting() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the Setting class. - /// - /// Resource Id - /// Resource name - /// Resource type - public Setting(string id = default(string), string name = default(string), string type = default(string)) - : base(id, name, type) - { - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Severity.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Severity.cs deleted file mode 100644 index d8fe3d2429fd..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Severity.cs +++ /dev/null @@ -1,23 +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.Security.Models -{ - - /// - /// Defines values for Severity. - /// - public static class Severity - { - public const string Low = "Low"; - public const string Medium = "Medium"; - public const string High = "High"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Software.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Software.cs deleted file mode 100644 index fd19673fdb03..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Software.cs +++ /dev/null @@ -1,136 +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.Security.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Represents a software data - /// - [Rest.Serialization.JsonTransformation] - public partial class Software : Resource - { - /// - /// Initializes a new instance of the Software class. - /// - public Software() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the Software class. - /// - /// Resource Id - /// Resource name - /// Resource type - /// Unique identifier for the virtual machine in - /// the service. - /// Platform of the operating system running - /// on the device. - /// Name of the software vendor. - /// Name of the software product. - /// Version number of the software - /// product. - /// End of support status. Possible - /// values include: 'None', 'noLongerSupported', - /// 'versionNoLongerSupported', 'upcomingNoLongerSupported', - /// 'upcomingVersionNoLongerSupported' - /// The end of support date in case the - /// product is upcoming end of support. - /// Number of - /// weaknesses. - /// First time that the software was seen in - /// the device. - public Software(string id = default(string), string name = default(string), string type = default(string), string deviceId = default(string), string osPlatform = default(string), string vendor = default(string), string softwareName = default(string), string version = default(string), string endOfSupportStatus = default(string), string endOfSupportDate = default(string), int? numberOfKnownVulnerabilities = default(int?), string firstSeenAt = default(string)) - : base(id, name, type) - { - DeviceId = deviceId; - OsPlatform = osPlatform; - Vendor = vendor; - SoftwareName = softwareName; - Version = version; - EndOfSupportStatus = endOfSupportStatus; - EndOfSupportDate = endOfSupportDate; - NumberOfKnownVulnerabilities = numberOfKnownVulnerabilities; - FirstSeenAt = firstSeenAt; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets unique identifier for the virtual machine in the - /// service. - /// - [JsonProperty(PropertyName = "properties.deviceId")] - public string DeviceId { get; set; } - - /// - /// Gets or sets platform of the operating system running on the - /// device. - /// - [JsonProperty(PropertyName = "properties.osPlatform")] - public string OsPlatform { get; set; } - - /// - /// Gets or sets name of the software vendor. - /// - [JsonProperty(PropertyName = "properties.vendor")] - public string Vendor { get; set; } - - /// - /// Gets or sets name of the software product. - /// - [JsonProperty(PropertyName = "properties.softwareName")] - public string SoftwareName { get; set; } - - /// - /// Gets or sets version number of the software product. - /// - [JsonProperty(PropertyName = "properties.version")] - public string Version { get; set; } - - /// - /// Gets or sets end of support status. Possible values include: - /// 'None', 'noLongerSupported', 'versionNoLongerSupported', - /// 'upcomingNoLongerSupported', 'upcomingVersionNoLongerSupported' - /// - [JsonProperty(PropertyName = "properties.endOfSupportStatus")] - public string EndOfSupportStatus { get; set; } - - /// - /// Gets or sets the end of support date in case the product is - /// upcoming end of support. - /// - [JsonProperty(PropertyName = "properties.endOfSupportDate")] - public string EndOfSupportDate { get; set; } - - /// - /// Gets or sets number of weaknesses. - /// - [JsonProperty(PropertyName = "properties.numberOfKnownVulnerabilities")] - public int? NumberOfKnownVulnerabilities { get; set; } - - /// - /// Gets or sets first time that the software was seen in the device. - /// - [JsonProperty(PropertyName = "properties.firstSeenAt")] - public string FirstSeenAt { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SqlServerVulnerabilityProperties.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SqlServerVulnerabilityProperties.cs deleted file mode 100644 index f4e6a8943968..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SqlServerVulnerabilityProperties.cs +++ /dev/null @@ -1,66 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Details of the resource that was assessed - /// - [Newtonsoft.Json.JsonObject("SqlServerVulnerability")] - public partial class SqlServerVulnerabilityProperties : AdditionalData - { - /// - /// Initializes a new instance of the SqlServerVulnerabilityProperties - /// class. - /// - public SqlServerVulnerabilityProperties() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the SqlServerVulnerabilityProperties - /// class. - /// - /// The resource type the sub assessment refers to - /// in its resource details - /// The T-SQL query that runs on your SQL database - /// to perform the particular check - public SqlServerVulnerabilityProperties(string type = default(string), string query = default(string)) - { - Type = type; - Query = query; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the resource type the sub assessment refers to in its resource - /// details - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } - - /// - /// Gets the T-SQL query that runs on your SQL database to perform the - /// particular check - /// - [JsonProperty(PropertyName = "query")] - public string Query { get; private set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/State.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/State.cs deleted file mode 100644 index 705d4a8a9390..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/State.cs +++ /dev/null @@ -1,39 +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.Security.Models -{ - - /// - /// Defines values for State. - /// - public static class State - { - /// - /// All supported regulatory compliance controls in the given standard - /// have a passed state - /// - public const string Passed = "Passed"; - /// - /// At least one supported regulatory compliance control in the given - /// standard has a state of failed - /// - public const string Failed = "Failed"; - /// - /// All supported regulatory compliance controls in the given standard - /// have a state of skipped - /// - public const string Skipped = "Skipped"; - /// - /// No supported regulatory compliance data for the given standard - /// - public const string Unsupported = "Unsupported"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Status.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Status.cs deleted file mode 100644 index 73043aabe2a4..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Status.cs +++ /dev/null @@ -1,22 +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.Security.Models -{ - - /// - /// Defines values for Status. - /// - public static class Status - { - public const string Revoked = "Revoked"; - public const string Initiated = "Initiated"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/StatusReason.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/StatusReason.cs deleted file mode 100644 index 05827e56b0e3..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/StatusReason.cs +++ /dev/null @@ -1,23 +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.Security.Models -{ - - /// - /// Defines values for StatusReason. - /// - public static class StatusReason - { - public const string Expired = "Expired"; - public const string UserRequested = "UserRequested"; - public const string NewerRequestInitiated = "NewerRequestInitiated"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SubAssessmentStatus.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SubAssessmentStatus.cs deleted file mode 100644 index 6135ab7b906f..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SubAssessmentStatus.cs +++ /dev/null @@ -1,82 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Status of the sub-assessment - /// - public partial class SubAssessmentStatus - { - /// - /// Initializes a new instance of the SubAssessmentStatus class. - /// - public SubAssessmentStatus() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the SubAssessmentStatus class. - /// - /// Programmatic code for the status of the - /// assessment. Possible values include: 'Healthy', 'Unhealthy', - /// 'NotApplicable' - /// Programmatic code for the cause of the - /// assessment status - /// Human readable description of the - /// assessment status - /// The sub-assessment severity level. Possible - /// values include: 'Low', 'Medium', 'High' - public SubAssessmentStatus(string code = default(string), string cause = default(string), string description = default(string), string severity = default(string)) - { - Code = code; - Cause = cause; - Description = description; - Severity = severity; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets programmatic code for the status of the assessment. Possible - /// values include: 'Healthy', 'Unhealthy', 'NotApplicable' - /// - [JsonProperty(PropertyName = "code")] - public string Code { get; private set; } - - /// - /// Gets programmatic code for the cause of the assessment status - /// - [JsonProperty(PropertyName = "cause")] - public string Cause { get; private set; } - - /// - /// Gets human readable description of the assessment status - /// - [JsonProperty(PropertyName = "description")] - public string Description { get; private set; } - - /// - /// Gets the sub-assessment severity level. Possible values include: - /// 'Low', 'Medium', 'High' - /// - [JsonProperty(PropertyName = "severity")] - public string Severity { get; private set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SubAssessmentStatusCode.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SubAssessmentStatusCode.cs deleted file mode 100644 index 29a2701497c4..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SubAssessmentStatusCode.cs +++ /dev/null @@ -1,32 +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.Security.Models -{ - - /// - /// Defines values for SubAssessmentStatusCode. - /// - public static class SubAssessmentStatusCode - { - /// - /// The resource is healthy - /// - public const string Healthy = "Healthy"; - /// - /// The resource has a security issue that needs to be addressed - /// - public const string Unhealthy = "Unhealthy"; - /// - /// Assessment for this resource did not happen - /// - public const string NotApplicable = "NotApplicable"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SuppressionAlertsScope.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SuppressionAlertsScope.cs deleted file mode 100644 index e60a2338735c..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SuppressionAlertsScope.cs +++ /dev/null @@ -1,66 +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.Security.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - public partial class SuppressionAlertsScope - { - /// - /// Initializes a new instance of the SuppressionAlertsScope class. - /// - public SuppressionAlertsScope() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the SuppressionAlertsScope class. - /// - /// All the conditions inside need to be true in - /// order to suppress the alert - public SuppressionAlertsScope(IList allOf) - { - AllOf = allOf; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets all the conditions inside need to be true in order to - /// suppress the alert - /// - [JsonProperty(PropertyName = "allOf")] - public IList AllOf { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (AllOf == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "AllOf"); - } - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SystemData.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SystemData.cs deleted file mode 100644 index 07d83ce36f45..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SystemData.cs +++ /dev/null @@ -1,103 +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.Security.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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/TagsResource.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/TagsResource.cs deleted file mode 100644 index 66212bd8fb3a..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/TagsResource.cs +++ /dev/null @@ -1,54 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// A container holding only the Tags for a resource, allowing the user to - /// update the tags. - /// - public partial class TagsResource - { - /// - /// Initializes a new instance of the TagsResource class. - /// - public TagsResource() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the TagsResource class. - /// - /// Resource tags - public TagsResource(IDictionary tags = default(IDictionary)) - { - Tags = tags; - 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; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Threats.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Threats.cs deleted file mode 100644 index 599f07219ffb..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Threats.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.Security.Models -{ - - /// - /// Defines values for Threats. - /// - public static class Threats - { - public const string AccountBreach = "accountBreach"; - public const string DataExfiltration = "dataExfiltration"; - public const string DataSpillage = "dataSpillage"; - public const string MaliciousInsider = "maliciousInsider"; - public const string ElevationOfPrivilege = "elevationOfPrivilege"; - public const string ThreatResistance = "threatResistance"; - public const string MissingCoverage = "missingCoverage"; - public const string DenialOfService = "denialOfService"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ThresholdCustomAlertRule.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ThresholdCustomAlertRule.cs deleted file mode 100644 index 47f1dfdf2e8f..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ThresholdCustomAlertRule.cs +++ /dev/null @@ -1,76 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// A custom alert rule that checks if a value (depends on the custom alert - /// type) is within the given range. - /// - public partial class ThresholdCustomAlertRule : CustomAlertRule - { - /// - /// Initializes a new instance of the ThresholdCustomAlertRule class. - /// - public ThresholdCustomAlertRule() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ThresholdCustomAlertRule class. - /// - /// Status of the custom alert. - /// The minimum threshold. - /// The maximum threshold. - /// The display name of the custom - /// alert. - /// The description of the custom - /// alert. - public ThresholdCustomAlertRule(bool isEnabled, int minThreshold, int maxThreshold, string displayName = default(string), string description = default(string)) - : base(isEnabled, displayName, description) - { - MinThreshold = minThreshold; - MaxThreshold = maxThreshold; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the minimum threshold. - /// - [JsonProperty(PropertyName = "minThreshold")] - public int MinThreshold { get; set; } - - /// - /// Gets or sets the maximum threshold. - /// - [JsonProperty(PropertyName = "maxThreshold")] - public int MaxThreshold { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/TimeWindowCustomAlertRule.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/TimeWindowCustomAlertRule.cs deleted file mode 100644 index e6fdc3230f94..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/TimeWindowCustomAlertRule.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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// A custom alert rule that checks if the number of activities (depends on - /// the custom alert type) in a time window is within the given range. - /// - public partial class TimeWindowCustomAlertRule : ThresholdCustomAlertRule - { - /// - /// Initializes a new instance of the TimeWindowCustomAlertRule class. - /// - public TimeWindowCustomAlertRule() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the TimeWindowCustomAlertRule class. - /// - /// Status of the custom alert. - /// The minimum threshold. - /// The maximum threshold. - /// The time window size in iso8601 - /// format. - /// The display name of the custom - /// alert. - /// The description of the custom - /// alert. - public TimeWindowCustomAlertRule(bool isEnabled, int minThreshold, int maxThreshold, System.TimeSpan timeWindowSize, string displayName = default(string), string description = default(string)) - : base(isEnabled, minThreshold, maxThreshold, displayName, description) - { - TimeWindowSize = timeWindowSize; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the time window size in iso8601 format. - /// - [JsonProperty(PropertyName = "timeWindowSize")] - public System.TimeSpan TimeWindowSize { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/TopologyResource.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/TopologyResource.cs deleted file mode 100644 index 0b7bb6c3c668..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/TopologyResource.cs +++ /dev/null @@ -1,96 +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.Security.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - [Rest.Serialization.JsonTransformation] - public partial class TopologyResource - { - /// - /// Initializes a new instance of the TopologyResource class. - /// - public TopologyResource() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the TopologyResource class. - /// - /// Resource Id - /// Resource name - /// Resource type - /// Location where the resource is - /// stored - /// The UTC time on which the topology - /// was calculated - /// Azure resources which are part of - /// this topology resource - public TopologyResource(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.DateTime? calculatedDateTime = default(System.DateTime?), IList topologyResources = default(IList)) - { - Id = id; - Name = name; - Type = type; - Location = location; - CalculatedDateTime = calculatedDateTime; - TopologyResources = topologyResources; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets resource Id - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } - - /// - /// Gets resource name - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } - - /// - /// Gets resource type - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } - - /// - /// Gets location where the resource is stored - /// - [JsonProperty(PropertyName = "location")] - public string Location { get; private set; } - - /// - /// Gets the UTC time on which the topology was calculated - /// - [JsonProperty(PropertyName = "properties.calculatedDateTime")] - public System.DateTime? CalculatedDateTime { get; private set; } - - /// - /// Gets azure resources which are part of this topology resource - /// - [JsonProperty(PropertyName = "properties.topologyResources")] - public IList TopologyResources { get; private set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/TopologySingleResource.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/TopologySingleResource.cs deleted file mode 100644 index 389401335b55..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/TopologySingleResource.cs +++ /dev/null @@ -1,115 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - public partial class TopologySingleResource - { - /// - /// Initializes a new instance of the TopologySingleResource class. - /// - public TopologySingleResource() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the TopologySingleResource class. - /// - /// Azure resource id - /// The security severity of the - /// resource - /// Indicates if the resource has - /// security recommendations - /// Indicates the resource connectivity - /// level to the Internet (InternetFacing, Internal ,etc.) - /// Score of the resource based on its - /// security severity - /// The location of this resource - /// Azure resources connected to this resource - /// which are in higher level in the topology view - /// Azure resources connected to this resource - /// which are in lower level in the topology view - public TopologySingleResource(string resourceId = default(string), string severity = default(string), bool? recommendationsExist = default(bool?), string networkZones = default(string), int? topologyScore = default(int?), string location = default(string), IList parents = default(IList), IList children = default(IList)) - { - ResourceId = resourceId; - Severity = severity; - RecommendationsExist = recommendationsExist; - NetworkZones = networkZones; - TopologyScore = topologyScore; - Location = location; - Parents = parents; - Children = children; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets azure resource id - /// - [JsonProperty(PropertyName = "resourceId")] - public string ResourceId { get; private set; } - - /// - /// Gets the security severity of the resource - /// - [JsonProperty(PropertyName = "severity")] - public string Severity { get; private set; } - - /// - /// Gets indicates if the resource has security recommendations - /// - [JsonProperty(PropertyName = "recommendationsExist")] - public bool? RecommendationsExist { get; private set; } - - /// - /// Gets indicates the resource connectivity level to the Internet - /// (InternetFacing, Internal ,etc.) - /// - [JsonProperty(PropertyName = "networkZones")] - public string NetworkZones { get; private set; } - - /// - /// Gets score of the resource based on its security severity - /// - [JsonProperty(PropertyName = "topologyScore")] - public int? TopologyScore { get; private set; } - - /// - /// Gets the location of this resource - /// - [JsonProperty(PropertyName = "location")] - public string Location { get; private set; } - - /// - /// Gets azure resources connected to this resource which are in higher - /// level in the topology view - /// - [JsonProperty(PropertyName = "parents")] - public IList Parents { get; private set; } - - /// - /// Gets azure resources connected to this resource which are in lower - /// level in the topology view - /// - [JsonProperty(PropertyName = "children")] - public IList Children { get; private set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/TopologySingleResourceChild.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/TopologySingleResourceChild.cs deleted file mode 100644 index 186ba225522b..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/TopologySingleResourceChild.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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - public partial class TopologySingleResourceChild - { - /// - /// Initializes a new instance of the TopologySingleResourceChild - /// class. - /// - public TopologySingleResourceChild() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the TopologySingleResourceChild - /// class. - /// - /// Azure resource id which serves as child - /// resource in topology view - public TopologySingleResourceChild(string resourceId = default(string)) - { - ResourceId = resourceId; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets azure resource id which serves as child resource in topology - /// view - /// - [JsonProperty(PropertyName = "resourceId")] - public string ResourceId { get; private set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/TopologySingleResourceParent.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/TopologySingleResourceParent.cs deleted file mode 100644 index 6d3f5e55d010..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/TopologySingleResourceParent.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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - public partial class TopologySingleResourceParent - { - /// - /// Initializes a new instance of the TopologySingleResourceParent - /// class. - /// - public TopologySingleResourceParent() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the TopologySingleResourceParent - /// class. - /// - /// Azure resource id which serves as parent - /// resource in topology view - public TopologySingleResourceParent(string resourceId = default(string)) - { - ResourceId = resourceId; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets azure resource id which serves as parent resource in topology - /// view - /// - [JsonProperty(PropertyName = "resourceId")] - public string ResourceId { get; private set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/TransportProtocol.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/TransportProtocol.cs deleted file mode 100644 index 6471d37ae648..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/TransportProtocol.cs +++ /dev/null @@ -1,22 +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.Security.Models -{ - - /// - /// Defines values for TransportProtocol. - /// - public static class TransportProtocol - { - public const string TCP = "TCP"; - public const string UDP = "UDP"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/TwinUpdatesNotInAllowedRange.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/TwinUpdatesNotInAllowedRange.cs deleted file mode 100644 index 047ed484cb7e..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/TwinUpdatesNotInAllowedRange.cs +++ /dev/null @@ -1,64 +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.Security.Models -{ - using System.Linq; - - /// - /// Number of twin updates is not in allowed range. - /// - public partial class TwinUpdatesNotInAllowedRange : TimeWindowCustomAlertRule - { - /// - /// Initializes a new instance of the TwinUpdatesNotInAllowedRange - /// class. - /// - public TwinUpdatesNotInAllowedRange() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the TwinUpdatesNotInAllowedRange - /// class. - /// - /// Status of the custom alert. - /// The minimum threshold. - /// The maximum threshold. - /// The time window size in iso8601 - /// format. - /// The display name of the custom - /// alert. - /// The description of the custom - /// alert. - public TwinUpdatesNotInAllowedRange(bool isEnabled, int minThreshold, int maxThreshold, System.TimeSpan timeWindowSize, string displayName = default(string), string description = default(string)) - : base(isEnabled, minThreshold, maxThreshold, timeWindowSize, displayName, description) - { - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/UnauthorizedOperationsNotInAllowedRange.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/UnauthorizedOperationsNotInAllowedRange.cs deleted file mode 100644 index 757b89fe6a5f..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/UnauthorizedOperationsNotInAllowedRange.cs +++ /dev/null @@ -1,64 +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.Security.Models -{ - using System.Linq; - - /// - /// Number of unauthorized operations is not in allowed range. - /// - public partial class UnauthorizedOperationsNotInAllowedRange : TimeWindowCustomAlertRule - { - /// - /// Initializes a new instance of the - /// UnauthorizedOperationsNotInAllowedRange class. - /// - public UnauthorizedOperationsNotInAllowedRange() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// UnauthorizedOperationsNotInAllowedRange class. - /// - /// Status of the custom alert. - /// The minimum threshold. - /// The maximum threshold. - /// The time window size in iso8601 - /// format. - /// The display name of the custom - /// alert. - /// The description of the custom - /// alert. - public UnauthorizedOperationsNotInAllowedRange(bool isEnabled, int minThreshold, int maxThreshold, System.TimeSpan timeWindowSize, string displayName = default(string), string description = default(string)) - : base(isEnabled, minThreshold, maxThreshold, timeWindowSize, displayName, description) - { - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/UnmaskedIpLoggingStatus.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/UnmaskedIpLoggingStatus.cs deleted file mode 100644 index 3e10ac3c9d4a..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/UnmaskedIpLoggingStatus.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.Security.Models -{ - - /// - /// Defines values for UnmaskedIpLoggingStatus. - /// - public static class UnmaskedIpLoggingStatus - { - /// - /// Unmasked IP logging is disabled - /// - public const string Disabled = "Disabled"; - /// - /// Unmasked IP logging is enabled - /// - public const string Enabled = "Enabled"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/UpdateIotSecuritySolutionData.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/UpdateIotSecuritySolutionData.cs deleted file mode 100644 index f789fd59b1e1..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/UpdateIotSecuritySolutionData.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.Security.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - [Rest.Serialization.JsonTransformation] - public partial class UpdateIotSecuritySolutionData : TagsResource - { - /// - /// Initializes a new instance of the UpdateIotSecuritySolutionData - /// class. - /// - public UpdateIotSecuritySolutionData() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the UpdateIotSecuritySolutionData - /// class. - /// - /// Resource tags - public UpdateIotSecuritySolutionData(IDictionary tags = default(IDictionary), UserDefinedResourcesProperties userDefinedResources = default(UserDefinedResourcesProperties), IList recommendationsConfiguration = default(IList)) - : base(tags) - { - UserDefinedResources = userDefinedResources; - RecommendationsConfiguration = recommendationsConfiguration; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// - [JsonProperty(PropertyName = "properties.userDefinedResources")] - public UserDefinedResourcesProperties UserDefinedResources { get; set; } - - /// - /// - [JsonProperty(PropertyName = "properties.recommendationsConfiguration")] - public IList RecommendationsConfiguration { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (UserDefinedResources != null) - { - UserDefinedResources.Validate(); - } - if (RecommendationsConfiguration != null) - { - foreach (var element in RecommendationsConfiguration) - { - if (element != null) - { - element.Validate(); - } - } - } - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/UserDefinedResourcesProperties.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/UserDefinedResourcesProperties.cs deleted file mode 100644 index 509f38822ff6..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/UserDefinedResourcesProperties.cs +++ /dev/null @@ -1,87 +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.Security.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Properties of the IoT Security solution's user defined resources. - /// - public partial class UserDefinedResourcesProperties - { - /// - /// Initializes a new instance of the UserDefinedResourcesProperties - /// class. - /// - public UserDefinedResourcesProperties() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the UserDefinedResourcesProperties - /// class. - /// - /// Azure Resource Graph query which represents the - /// security solution's user defined resources. Required to start with - /// "where type != "Microsoft.Devices/IotHubs"" - /// List of Azure subscription ids on - /// which the user defined resources query should be executed. - public UserDefinedResourcesProperties(string query, IList querySubscriptions) - { - Query = query; - QuerySubscriptions = querySubscriptions; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets azure Resource Graph query which represents the - /// security solution's user defined resources. Required to start with - /// "where type != "Microsoft.Devices/IotHubs"" - /// - [JsonProperty(PropertyName = "query")] - public string Query { get; set; } - - /// - /// Gets or sets list of Azure subscription ids on which the user - /// defined resources query should be executed. - /// - [JsonProperty(PropertyName = "querySubscriptions")] - public IList QuerySubscriptions { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Query == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Query"); - } - if (QuerySubscriptions == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "QuerySubscriptions"); - } - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/UserImpact.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/UserImpact.cs deleted file mode 100644 index f8467055956b..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/UserImpact.cs +++ /dev/null @@ -1,23 +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.Security.Models -{ - - /// - /// Defines values for UserImpact. - /// - public static class UserImpact - { - public const string Low = "Low"; - public const string Moderate = "Moderate"; - public const string High = "High"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/UserRecommendation.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/UserRecommendation.cs deleted file mode 100644 index 2fb025f28d4b..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/UserRecommendation.cs +++ /dev/null @@ -1,63 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Represents a user that is recommended to be allowed for a certain rule - /// - public partial class UserRecommendation - { - /// - /// Initializes a new instance of the UserRecommendation class. - /// - public UserRecommendation() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the UserRecommendation class. - /// - /// Represents a user that is recommended to be - /// allowed for a certain rule - /// Possible values include: - /// 'Recommended', 'Add', 'Remove' - public UserRecommendation(string username = default(string), string recommendationAction = default(string)) - { - Username = username; - RecommendationAction = recommendationAction; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets represents a user that is recommended to be allowed - /// for a certain rule - /// - [JsonProperty(PropertyName = "username")] - public string Username { get; set; } - - /// - /// Gets or sets possible values include: 'Recommended', 'Add', - /// 'Remove' - /// - [JsonProperty(PropertyName = "recommendationAction")] - public string RecommendationAction { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/VaRule.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/VaRule.cs deleted file mode 100644 index 8aa624d21d9a..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/VaRule.cs +++ /dev/null @@ -1,119 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// vulnerability assessment rule metadata details. - /// - public partial class VaRule - { - /// - /// Initializes a new instance of the VaRule class. - /// - public VaRule() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the VaRule class. - /// - /// The rule Id. - /// Possible values include: 'High', 'Medium', - /// 'Low', 'Informational', 'Obsolete' - /// The rule category. - /// Possible values include: 'Binary', - /// 'BaselineExpected', 'PositiveList', 'NegativeList' - /// The rule title. - /// The rule description. - /// The rule rationale. - /// The benchmark references. - public VaRule(string ruleId = default(string), string severity = default(string), string category = default(string), string ruleType = default(string), string title = default(string), string description = default(string), string rationale = default(string), QueryCheck queryCheck = default(QueryCheck), IList benchmarkReferences = default(IList)) - { - RuleId = ruleId; - Severity = severity; - Category = category; - RuleType = ruleType; - Title = title; - Description = description; - Rationale = rationale; - QueryCheck = queryCheck; - BenchmarkReferences = benchmarkReferences; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the rule Id. - /// - [JsonProperty(PropertyName = "ruleId")] - public string RuleId { get; set; } - - /// - /// Gets or sets possible values include: 'High', 'Medium', 'Low', - /// 'Informational', 'Obsolete' - /// - [JsonProperty(PropertyName = "severity")] - public string Severity { get; set; } - - /// - /// Gets or sets the rule category. - /// - [JsonProperty(PropertyName = "category")] - public string Category { get; set; } - - /// - /// Gets or sets possible values include: 'Binary', 'BaselineExpected', - /// 'PositiveList', 'NegativeList' - /// - [JsonProperty(PropertyName = "ruleType")] - public string RuleType { get; set; } - - /// - /// Gets or sets the rule title. - /// - [JsonProperty(PropertyName = "title")] - public string Title { get; set; } - - /// - /// Gets or sets the rule description. - /// - [JsonProperty(PropertyName = "description")] - public string Description { get; set; } - - /// - /// Gets or sets the rule rationale. - /// - [JsonProperty(PropertyName = "rationale")] - public string Rationale { get; set; } - - /// - /// - [JsonProperty(PropertyName = "queryCheck")] - public QueryCheck QueryCheck { get; set; } - - /// - /// Gets or sets the benchmark references. - /// - [JsonProperty(PropertyName = "benchmarkReferences")] - public IList BenchmarkReferences { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ValueType.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ValueType.cs deleted file mode 100644 index 555342f47de3..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ValueType.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.Security.Models -{ - - /// - /// Defines values for ValueType. - /// - public static class ValueType - { - /// - /// An IP range in CIDR format (e.g. '192.168.0.1/8'). - /// - public const string IpCidr = "IpCidr"; - /// - /// Any string value. - /// - public const string String = "String"; - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/VendorReference.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/VendorReference.cs deleted file mode 100644 index 09c28c8f0fe7..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/VendorReference.cs +++ /dev/null @@ -1,59 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Vendor reference - /// - public partial class VendorReference - { - /// - /// Initializes a new instance of the VendorReference class. - /// - public VendorReference() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the VendorReference class. - /// - /// Link title - /// Link url - public VendorReference(string title = default(string), string link = default(string)) - { - Title = title; - Link = link; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets link title - /// - [JsonProperty(PropertyName = "title")] - public string Title { get; private set; } - - /// - /// Gets link url - /// - [JsonProperty(PropertyName = "link")] - public string Link { get; private set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/VmRecommendation.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/VmRecommendation.cs deleted file mode 100644 index d9ffe6372bac..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/VmRecommendation.cs +++ /dev/null @@ -1,80 +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.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Represents a machine that is part of a machine group - /// - public partial class VmRecommendation - { - /// - /// Initializes a new instance of the VmRecommendation class. - /// - public VmRecommendation() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the VmRecommendation class. - /// - /// Possible values include: - /// 'Configured', 'NotConfigured', 'InProgress', 'Failed', - /// 'NoStatus' - /// Possible values include: - /// 'Recommended', 'Add', 'Remove' - /// Possible values include: - /// 'Supported', 'NotSupported', 'Unknown' - public VmRecommendation(string configurationStatus = default(string), string recommendationAction = default(string), string resourceId = default(string), string enforcementSupport = default(string)) - { - ConfigurationStatus = configurationStatus; - RecommendationAction = recommendationAction; - ResourceId = resourceId; - EnforcementSupport = enforcementSupport; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets possible values include: 'Configured', - /// 'NotConfigured', 'InProgress', 'Failed', 'NoStatus' - /// - [JsonProperty(PropertyName = "configurationStatus")] - public string ConfigurationStatus { get; set; } - - /// - /// Gets or sets possible values include: 'Recommended', 'Add', - /// 'Remove' - /// - [JsonProperty(PropertyName = "recommendationAction")] - public string RecommendationAction { get; set; } - - /// - /// - [JsonProperty(PropertyName = "resourceId")] - public string ResourceId { get; set; } - - /// - /// Gets or sets possible values include: 'Supported', 'NotSupported', - /// 'Unknown' - /// - [JsonProperty(PropertyName = "enforcementSupport")] - public string EnforcementSupport { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/WorkspaceSetting.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/WorkspaceSetting.cs deleted file mode 100644 index a3d55c0c0494..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/WorkspaceSetting.cs +++ /dev/null @@ -1,89 +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.Security.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Configures where to store the OMS agent data for workspaces under a - /// scope - /// - [Rest.Serialization.JsonTransformation] - public partial class WorkspaceSetting : Resource - { - /// - /// Initializes a new instance of the WorkspaceSetting class. - /// - public WorkspaceSetting() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the WorkspaceSetting class. - /// - /// The full Azure ID of the workspace to - /// save the data in - /// All the VMs in this scope will send their - /// security data to the mentioned workspace unless overridden by a - /// setting with more specific scope - /// Resource Id - /// Resource name - /// Resource type - public WorkspaceSetting(string workspaceId, string scope, string id = default(string), string name = default(string), string type = default(string)) - : base(id, name, type) - { - WorkspaceId = workspaceId; - Scope = scope; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the full Azure ID of the workspace to save the data in - /// - [JsonProperty(PropertyName = "properties.workspaceId")] - public string WorkspaceId { get; set; } - - /// - /// Gets or sets all the VMs in this scope will send their security - /// data to the mentioned workspace unless overridden by a setting with - /// more specific scope - /// - [JsonProperty(PropertyName = "properties.scope")] - public string Scope { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (WorkspaceId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "WorkspaceId"); - } - if (Scope == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Scope"); - } - } - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Operations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Operations.cs deleted file mode 100644 index 98734535b88e..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Operations.cs +++ /dev/null @@ -1,392 +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.Security -{ - 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; - - /// - /// Operations operations. - /// - internal partial class Operations : IServiceOperations, IOperations - { - /// - /// Initializes a new instance of the Operations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal Operations(SecurityCenterClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SecurityCenterClient - /// - public SecurityCenterClient Client { get; private set; } - - /// - /// Exposes all available operations for discovery purposes. - /// - /// - /// 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 - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - string apiVersion = "2015-06-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - 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("/") ? "" : "/")), "providers/Microsoft.Security/operations").ToString(); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Exposes all available operations for discovery purposes. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/OperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/OperationsExtensions.cs deleted file mode 100644 index 3c376d08fd0d..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/OperationsExtensions.cs +++ /dev/null @@ -1,87 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for Operations. - /// - public static partial class OperationsExtensions - { - /// - /// Exposes all available operations for discovery purposes. - /// - /// - /// The operations group for this extension method. - /// - public static IPage List(this IOperations operations) - { - return operations.ListAsync().GetAwaiter().GetResult(); - } - - /// - /// Exposes all available operations for discovery purposes. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Exposes all available operations for discovery purposes. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Exposes all available operations for discovery purposes. - /// - /// - /// 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 IOperations 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/PricingsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/PricingsOperations.cs index 40be7023380e..b558fe4b10a8 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/PricingsOperations.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/PricingsOperations.cs @@ -76,6 +76,10 @@ internal PricingsOperations(SecurityCenterClient client) /// 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.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -87,7 +91,6 @@ internal PricingsOperations(SecurityCenterClient client) throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); } } - string apiVersion = "2018-06-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -95,7 +98,6 @@ internal PricingsOperations(SecurityCenterClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } @@ -104,9 +106,9 @@ internal PricingsOperations(SecurityCenterClient client) var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -262,6 +264,10 @@ internal PricingsOperations(SecurityCenterClient client) /// public async Task> GetWithHttpMessagesAsync(string pricingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -277,7 +283,6 @@ internal PricingsOperations(SecurityCenterClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "pricingName"); } - string apiVersion = "2018-06-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -285,7 +290,6 @@ internal PricingsOperations(SecurityCenterClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("pricingName", pricingName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); @@ -296,9 +300,9 @@ internal PricingsOperations(SecurityCenterClient client) _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{pricingName}", System.Uri.EscapeDataString(pricingName)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -439,6 +443,11 @@ internal PricingsOperations(SecurityCenterClient client) /// free tier offers basic security features. Possible values include: 'Free', /// 'Standard' /// + /// + /// The sub-plan selected for a Standard pricing configuration, when more than + /// one sub-plan is available. Each sub-plan enables a set of security + /// features. When not specified, full plan is applied. + /// /// /// Headers that will be added to request. /// @@ -460,8 +469,12 @@ internal PricingsOperations(SecurityCenterClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string pricingName, string pricingTier, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string pricingName, string pricingTier, string subPlan = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -481,11 +494,11 @@ internal PricingsOperations(SecurityCenterClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "pricingTier"); } - string apiVersion = "2018-06-01"; Pricing pricing = new Pricing(); - if (pricingTier != null) + if (pricingTier != null || subPlan != null) { pricing.PricingTier = pricingTier; + pricing.SubPlan = subPlan; } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -494,7 +507,6 @@ internal PricingsOperations(SecurityCenterClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("pricingName", pricingName); tracingParameters.Add("pricing", pricing); tracingParameters.Add("cancellationToken", cancellationToken); @@ -506,9 +518,9 @@ internal PricingsOperations(SecurityCenterClient client) _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{pricingName}", System.Uri.EscapeDataString(pricingName)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/PricingsOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/PricingsOperationsExtensions.cs index 7e17c1a59785..733303ef9a55 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/PricingsOperationsExtensions.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/PricingsOperationsExtensions.cs @@ -100,9 +100,14 @@ public static Pricing Get(this IPricingsOperations operations, string pricingNam /// free tier offers basic security features. Possible values include: 'Free', /// 'Standard' /// - public static Pricing Update(this IPricingsOperations operations, string pricingName, string pricingTier) + /// + /// The sub-plan selected for a Standard pricing configuration, when more than + /// one sub-plan is available. Each sub-plan enables a set of security + /// features. When not specified, full plan is applied. + /// + public static Pricing Update(this IPricingsOperations operations, string pricingName, string pricingTier, string subPlan = default(string)) { - return operations.UpdateAsync(pricingName, pricingTier).GetAwaiter().GetResult(); + return operations.UpdateAsync(pricingName, pricingTier, subPlan).GetAwaiter().GetResult(); } /// @@ -122,12 +127,17 @@ public static Pricing Update(this IPricingsOperations operations, string pricing /// free tier offers basic security features. Possible values include: 'Free', /// 'Standard' /// + /// + /// The sub-plan selected for a Standard pricing configuration, when more than + /// one sub-plan is available. Each sub-plan enables a set of security + /// features. When not specified, full plan is applied. + /// /// /// The cancellation token. /// - public static async Task UpdateAsync(this IPricingsOperations operations, string pricingName, string pricingTier, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IPricingsOperations operations, string pricingName, string pricingTier, string subPlan = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.UpdateWithHttpMessagesAsync(pricingName, pricingTier, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.UpdateWithHttpMessagesAsync(pricingName, pricingTier, subPlan, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/RegulatoryComplianceAssessmentsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/RegulatoryComplianceAssessmentsOperations.cs deleted file mode 100644 index 46c95fe8d269..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/RegulatoryComplianceAssessmentsOperations.cs +++ /dev/null @@ -1,648 +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.Security -{ - 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; - - /// - /// RegulatoryComplianceAssessmentsOperations operations. - /// - internal partial class RegulatoryComplianceAssessmentsOperations : IServiceOperations, IRegulatoryComplianceAssessmentsOperations - { - /// - /// Initializes a new instance of the RegulatoryComplianceAssessmentsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal RegulatoryComplianceAssessmentsOperations(SecurityCenterClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SecurityCenterClient - /// - public SecurityCenterClient Client { get; private set; } - - /// - /// Details and state of assessments mapped to selected regulatory compliance - /// control - /// - /// - /// Name of the regulatory compliance standard object - /// - /// - /// Name of the regulatory compliance control object - /// - /// - /// OData filter. 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 regulatoryComplianceStandardName, string regulatoryComplianceControlName, string filter = default(string), 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 (regulatoryComplianceStandardName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "regulatoryComplianceStandardName"); - } - if (regulatoryComplianceControlName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "regulatoryComplianceControlName"); - } - string apiVersion = "2019-01-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("regulatoryComplianceStandardName", regulatoryComplianceStandardName); - tracingParameters.Add("regulatoryComplianceControlName", regulatoryComplianceControlName); - tracingParameters.Add("filter", filter); - 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}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}/regulatoryComplianceAssessments").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{regulatoryComplianceStandardName}", System.Uri.EscapeDataString(regulatoryComplianceStandardName)); - _url = _url.Replace("{regulatoryComplianceControlName}", System.Uri.EscapeDataString(regulatoryComplianceControlName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (filter != null) - { - _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); - } - 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; - } - - /// - /// Supported regulatory compliance details and state for selected assessment - /// - /// - /// Name of the regulatory compliance standard object - /// - /// - /// Name of the regulatory compliance control object - /// - /// - /// Name of the regulatory compliance assessment object - /// - /// - /// 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 regulatoryComplianceStandardName, string regulatoryComplianceControlName, string regulatoryComplianceAssessmentName, 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 (regulatoryComplianceStandardName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "regulatoryComplianceStandardName"); - } - if (regulatoryComplianceControlName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "regulatoryComplianceControlName"); - } - if (regulatoryComplianceAssessmentName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "regulatoryComplianceAssessmentName"); - } - string apiVersion = "2019-01-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("regulatoryComplianceStandardName", regulatoryComplianceStandardName); - tracingParameters.Add("regulatoryComplianceControlName", regulatoryComplianceControlName); - tracingParameters.Add("regulatoryComplianceAssessmentName", regulatoryComplianceAssessmentName); - 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}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}/regulatoryComplianceAssessments/{regulatoryComplianceAssessmentName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{regulatoryComplianceStandardName}", System.Uri.EscapeDataString(regulatoryComplianceStandardName)); - _url = _url.Replace("{regulatoryComplianceControlName}", System.Uri.EscapeDataString(regulatoryComplianceControlName)); - _url = _url.Replace("{regulatoryComplianceAssessmentName}", System.Uri.EscapeDataString(regulatoryComplianceAssessmentName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Details and state of assessments mapped to selected regulatory compliance - /// control - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/RegulatoryComplianceAssessmentsOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/RegulatoryComplianceAssessmentsOperationsExtensions.cs deleted file mode 100644 index 481a46a93920..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/RegulatoryComplianceAssessmentsOperationsExtensions.cs +++ /dev/null @@ -1,155 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for RegulatoryComplianceAssessmentsOperations. - /// - public static partial class RegulatoryComplianceAssessmentsOperationsExtensions - { - /// - /// Details and state of assessments mapped to selected regulatory compliance - /// control - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the regulatory compliance standard object - /// - /// - /// Name of the regulatory compliance control object - /// - /// - /// OData filter. Optional. - /// - public static IPage List(this IRegulatoryComplianceAssessmentsOperations operations, string regulatoryComplianceStandardName, string regulatoryComplianceControlName, string filter = default(string)) - { - return operations.ListAsync(regulatoryComplianceStandardName, regulatoryComplianceControlName, filter).GetAwaiter().GetResult(); - } - - /// - /// Details and state of assessments mapped to selected regulatory compliance - /// control - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the regulatory compliance standard object - /// - /// - /// Name of the regulatory compliance control object - /// - /// - /// OData filter. Optional. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IRegulatoryComplianceAssessmentsOperations operations, string regulatoryComplianceStandardName, string regulatoryComplianceControlName, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(regulatoryComplianceStandardName, regulatoryComplianceControlName, filter, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Supported regulatory compliance details and state for selected assessment - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the regulatory compliance standard object - /// - /// - /// Name of the regulatory compliance control object - /// - /// - /// Name of the regulatory compliance assessment object - /// - public static RegulatoryComplianceAssessment Get(this IRegulatoryComplianceAssessmentsOperations operations, string regulatoryComplianceStandardName, string regulatoryComplianceControlName, string regulatoryComplianceAssessmentName) - { - return operations.GetAsync(regulatoryComplianceStandardName, regulatoryComplianceControlName, regulatoryComplianceAssessmentName).GetAwaiter().GetResult(); - } - - /// - /// Supported regulatory compliance details and state for selected assessment - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the regulatory compliance standard object - /// - /// - /// Name of the regulatory compliance control object - /// - /// - /// Name of the regulatory compliance assessment object - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IRegulatoryComplianceAssessmentsOperations operations, string regulatoryComplianceStandardName, string regulatoryComplianceControlName, string regulatoryComplianceAssessmentName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(regulatoryComplianceStandardName, regulatoryComplianceControlName, regulatoryComplianceAssessmentName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Details and state of assessments mapped to selected regulatory compliance - /// control - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IRegulatoryComplianceAssessmentsOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Details and state of assessments mapped to selected regulatory compliance - /// control - /// - /// - /// 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 IRegulatoryComplianceAssessmentsOperations 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/RegulatoryComplianceControlsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/RegulatoryComplianceControlsOperations.cs deleted file mode 100644 index b1b3046fae67..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/RegulatoryComplianceControlsOperations.cs +++ /dev/null @@ -1,630 +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.Security -{ - 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; - - /// - /// RegulatoryComplianceControlsOperations operations. - /// - internal partial class RegulatoryComplianceControlsOperations : IServiceOperations, IRegulatoryComplianceControlsOperations - { - /// - /// Initializes a new instance of the RegulatoryComplianceControlsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal RegulatoryComplianceControlsOperations(SecurityCenterClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SecurityCenterClient - /// - public SecurityCenterClient Client { get; private set; } - - /// - /// All supported regulatory compliance controls details and state for selected - /// standard - /// - /// - /// Name of the regulatory compliance standard object - /// - /// - /// OData filter. 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 regulatoryComplianceStandardName, string filter = default(string), 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 (regulatoryComplianceStandardName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "regulatoryComplianceStandardName"); - } - string apiVersion = "2019-01-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("regulatoryComplianceStandardName", regulatoryComplianceStandardName); - tracingParameters.Add("filter", filter); - 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}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{regulatoryComplianceStandardName}", System.Uri.EscapeDataString(regulatoryComplianceStandardName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (filter != null) - { - _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); - } - 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; - } - - /// - /// Selected regulatory compliance control details and state - /// - /// - /// Name of the regulatory compliance standard object - /// - /// - /// Name of the regulatory compliance control object - /// - /// - /// 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 regulatoryComplianceStandardName, string regulatoryComplianceControlName, 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 (regulatoryComplianceStandardName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "regulatoryComplianceStandardName"); - } - if (regulatoryComplianceControlName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "regulatoryComplianceControlName"); - } - string apiVersion = "2019-01-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("regulatoryComplianceStandardName", regulatoryComplianceStandardName); - tracingParameters.Add("regulatoryComplianceControlName", regulatoryComplianceControlName); - 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}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{regulatoryComplianceStandardName}", System.Uri.EscapeDataString(regulatoryComplianceStandardName)); - _url = _url.Replace("{regulatoryComplianceControlName}", System.Uri.EscapeDataString(regulatoryComplianceControlName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// All supported regulatory compliance controls details and state for selected - /// standard - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/RegulatoryComplianceControlsOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/RegulatoryComplianceControlsOperationsExtensions.cs deleted file mode 100644 index cd7d6e6df6c2..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/RegulatoryComplianceControlsOperationsExtensions.cs +++ /dev/null @@ -1,143 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for RegulatoryComplianceControlsOperations. - /// - public static partial class RegulatoryComplianceControlsOperationsExtensions - { - /// - /// All supported regulatory compliance controls details and state for selected - /// standard - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the regulatory compliance standard object - /// - /// - /// OData filter. Optional. - /// - public static IPage List(this IRegulatoryComplianceControlsOperations operations, string regulatoryComplianceStandardName, string filter = default(string)) - { - return operations.ListAsync(regulatoryComplianceStandardName, filter).GetAwaiter().GetResult(); - } - - /// - /// All supported regulatory compliance controls details and state for selected - /// standard - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the regulatory compliance standard object - /// - /// - /// OData filter. Optional. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IRegulatoryComplianceControlsOperations operations, string regulatoryComplianceStandardName, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(regulatoryComplianceStandardName, filter, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Selected regulatory compliance control details and state - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the regulatory compliance standard object - /// - /// - /// Name of the regulatory compliance control object - /// - public static RegulatoryComplianceControl Get(this IRegulatoryComplianceControlsOperations operations, string regulatoryComplianceStandardName, string regulatoryComplianceControlName) - { - return operations.GetAsync(regulatoryComplianceStandardName, regulatoryComplianceControlName).GetAwaiter().GetResult(); - } - - /// - /// Selected regulatory compliance control details and state - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the regulatory compliance standard object - /// - /// - /// Name of the regulatory compliance control object - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IRegulatoryComplianceControlsOperations operations, string regulatoryComplianceStandardName, string regulatoryComplianceControlName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(regulatoryComplianceStandardName, regulatoryComplianceControlName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// All supported regulatory compliance controls details and state for selected - /// standard - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IRegulatoryComplianceControlsOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// All supported regulatory compliance controls details and state for selected - /// standard - /// - /// - /// 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 IRegulatoryComplianceControlsOperations 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/RegulatoryComplianceStandardsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/RegulatoryComplianceStandardsOperations.cs deleted file mode 100644 index 8fa85b9d82b4..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/RegulatoryComplianceStandardsOperations.cs +++ /dev/null @@ -1,610 +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.Security -{ - 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; - - /// - /// RegulatoryComplianceStandardsOperations operations. - /// - internal partial class RegulatoryComplianceStandardsOperations : IServiceOperations, IRegulatoryComplianceStandardsOperations - { - /// - /// Initializes a new instance of the RegulatoryComplianceStandardsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal RegulatoryComplianceStandardsOperations(SecurityCenterClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SecurityCenterClient - /// - public SecurityCenterClient Client { get; private set; } - - /// - /// Supported regulatory compliance standards details and state - /// - /// - /// OData filter. 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 filter = default(string), 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}$"); - } - } - string apiVersion = "2019-01-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("filter", filter); - 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}/providers/Microsoft.Security/regulatoryComplianceStandards").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (filter != null) - { - _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); - } - 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; - } - - /// - /// Supported regulatory compliance details state for selected standard - /// - /// - /// Name of the regulatory compliance standard object - /// - /// - /// 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 regulatoryComplianceStandardName, 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 (regulatoryComplianceStandardName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "regulatoryComplianceStandardName"); - } - string apiVersion = "2019-01-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("regulatoryComplianceStandardName", regulatoryComplianceStandardName); - 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}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{regulatoryComplianceStandardName}", System.Uri.EscapeDataString(regulatoryComplianceStandardName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Supported regulatory compliance standards details and state - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/RegulatoryComplianceStandardsOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/RegulatoryComplianceStandardsOperationsExtensions.cs deleted file mode 100644 index 0f1c4822a5a8..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/RegulatoryComplianceStandardsOperationsExtensions.cs +++ /dev/null @@ -1,127 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for RegulatoryComplianceStandardsOperations. - /// - public static partial class RegulatoryComplianceStandardsOperationsExtensions - { - /// - /// Supported regulatory compliance standards details and state - /// - /// - /// The operations group for this extension method. - /// - /// - /// OData filter. Optional. - /// - public static IPage List(this IRegulatoryComplianceStandardsOperations operations, string filter = default(string)) - { - return operations.ListAsync(filter).GetAwaiter().GetResult(); - } - - /// - /// Supported regulatory compliance standards details and state - /// - /// - /// The operations group for this extension method. - /// - /// - /// OData filter. Optional. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IRegulatoryComplianceStandardsOperations operations, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(filter, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Supported regulatory compliance details state for selected standard - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the regulatory compliance standard object - /// - public static RegulatoryComplianceStandard Get(this IRegulatoryComplianceStandardsOperations operations, string regulatoryComplianceStandardName) - { - return operations.GetAsync(regulatoryComplianceStandardName).GetAwaiter().GetResult(); - } - - /// - /// Supported regulatory compliance details state for selected standard - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the regulatory compliance standard object - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IRegulatoryComplianceStandardsOperations operations, string regulatoryComplianceStandardName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(regulatoryComplianceStandardName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Supported regulatory compliance standards details and state - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IRegulatoryComplianceStandardsOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Supported regulatory compliance standards details and state - /// - /// - /// 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 IRegulatoryComplianceStandardsOperations 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SdkInfo_SecurityCenter.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SdkInfo_SecurityCenter.cs index da9ebfb93191..4dc78e71ae86 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SdkInfo_SecurityCenter.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SdkInfo_SecurityCenter.cs @@ -19,65 +19,9 @@ public static IEnumerable> ApiInfo_SecurityCenter { return new Tuple[] { - new Tuple("Security", "AdaptiveApplicationControls", "2020-01-01"), - new Tuple("Security", "AdaptiveNetworkHardenings", "2020-01-01"), - new Tuple("Security", "AdvancedThreatProtection", "2019-01-01"), - new Tuple("Security", "Alerts", "2021-01-01"), - new Tuple("Security", "AlertsSuppressionRules", "2019-01-01-preview"), - new Tuple("Security", "AllowedConnections", "2020-01-01"), - new Tuple("Security", "Assessments", "2020-01-01"), - new Tuple("Security", "AssessmentsMetadata", "2020-01-01"), - new Tuple("Security", "AutoProvisioningSettings", "2017-08-01-preview"), - new Tuple("Security", "Automations", "2019-01-01-preview"), - new Tuple("Security", "ComplianceResults", "2017-08-01"), - new Tuple("Security", "Compliances", "2017-08-01-preview"), - new Tuple("Security", "Connectors", "2020-01-01-preview"), - new Tuple("Security", "DeviceSecurityGroups", "2019-08-01"), - new Tuple("Security", "DiscoveredSecuritySolutions", "2020-01-01"), - new Tuple("Security", "ExternalSecuritySolutions", "2020-01-01"), - new Tuple("Security", "InformationProtectionPolicies", "2017-08-01-preview"), - new Tuple("Security", "IngestionSettings", "2021-01-15-preview"), - new Tuple("Security", "IotSecuritySolution", "2019-08-01"), - new Tuple("Security", "IotSecuritySolutionAnalytics", "2019-08-01"), - new Tuple("Security", "IotSecuritySolutionsAnalyticsAggregatedAlert", "2019-08-01"), - new Tuple("Security", "IotSecuritySolutionsAnalyticsRecommendation", "2019-08-01"), - new Tuple("Security", "JitNetworkAccessPolicies", "2020-01-01"), - new Tuple("Security", "Locations", "2015-06-01-preview"), - new Tuple("Security", "Operations", "2015-06-01-preview"), - new Tuple("Security", "Pricings", "2018-06-01"), - new Tuple("Security", "RegulatoryComplianceAssessments", "2019-01-01-preview"), - new Tuple("Security", "RegulatoryComplianceControls", "2019-01-01-preview"), - new Tuple("Security", "RegulatoryComplianceStandards", "2019-01-01-preview"), - new Tuple("Security", "SecureScoreControlDefinitions", "2020-01-01"), - new Tuple("Security", "SecureScoreControls", "2020-01-01"), - new Tuple("Security", "SecureScores", "2020-01-01"), - new Tuple("Security", "SecurityContacts", "2017-08-01-preview"), - new Tuple("Security", "SecuritySolutions", "2020-01-01"), - new Tuple("Security", "SecuritySolutionsReferenceData", "2020-01-01"), - new Tuple("Security", "ServerVulnerabilityAssessment", "2020-01-01"), - new Tuple("Security", "Settings", "2021-07-01"), - new Tuple("Security", "SoftwareInventories", "2021-05-01-preview"), - new Tuple("Security", "SqlVulnerabilityAssessmentBaselineRules", "2020-07-01-preview"), - new Tuple("Security", "SqlVulnerabilityAssessmentScanResults", "2020-07-01-preview"), - new Tuple("Security", "SqlVulnerabilityAssessmentScans", "2020-07-01-preview"), - new Tuple("Security", "SubAssessments", "2019-01-01-preview"), - new Tuple("Security", "Tasks", "2015-06-01-preview"), - new Tuple("Security", "Topology", "2020-01-01"), - new Tuple("Security", "WorkspaceSettings", "2017-08-01-preview"), - new Tuple("Security", "securitySolutionsReferenceData", "2020-01-01"), + new Tuple("Security", "Pricings", "2022-03-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/security/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=C:\\code\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "c981b81aa26ad4d0d156e034e6782853b4e747a1"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecureScoreControlDefinitionsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecureScoreControlDefinitionsOperations.cs deleted file mode 100644 index d0504ab34dcd..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecureScoreControlDefinitionsOperations.cs +++ /dev/null @@ -1,750 +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.Security -{ - 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; - - /// - /// SecureScoreControlDefinitionsOperations operations. - /// - internal partial class SecureScoreControlDefinitionsOperations : IServiceOperations, ISecureScoreControlDefinitionsOperations - { - /// - /// Initializes a new instance of the SecureScoreControlDefinitionsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal SecureScoreControlDefinitionsOperations(SecurityCenterClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SecurityCenterClient - /// - public SecurityCenterClient Client { get; private set; } - - /// - /// List the available security controls, their assessments, and the max score - /// - /// - /// 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 - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - 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("/") ? "" : "/")), "providers/Microsoft.Security/secureScoreControlDefinitions").ToString(); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// For a specified subscription, list the available security controls, their - /// assessments, and the max score - /// - /// - /// 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>> ListBySubscriptionWithHttpMessagesAsync(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}$"); - } - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScoreControlDefinitions").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// List the available security controls, their assessments, and the max score - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// For a specified subscription, list the available security controls, their - /// assessments, and the max score - /// - /// - /// 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>> ListBySubscriptionNextWithHttpMessagesAsync(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, "ListBySubscriptionNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecureScoreControlDefinitionsOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecureScoreControlDefinitionsOperationsExtensions.cs deleted file mode 100644 index dd3871951067..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecureScoreControlDefinitionsOperationsExtensions.cs +++ /dev/null @@ -1,153 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for SecureScoreControlDefinitionsOperations. - /// - public static partial class SecureScoreControlDefinitionsOperationsExtensions - { - /// - /// List the available security controls, their assessments, and the max score - /// - /// - /// The operations group for this extension method. - /// - public static IPage List(this ISecureScoreControlDefinitionsOperations operations) - { - return operations.ListAsync().GetAwaiter().GetResult(); - } - - /// - /// List the available security controls, their assessments, and the max score - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this ISecureScoreControlDefinitionsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// For a specified subscription, list the available security controls, their - /// assessments, and the max score - /// - /// - /// The operations group for this extension method. - /// - public static IPage ListBySubscription(this ISecureScoreControlDefinitionsOperations operations) - { - return operations.ListBySubscriptionAsync().GetAwaiter().GetResult(); - } - - /// - /// For a specified subscription, list the available security controls, their - /// assessments, and the max score - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListBySubscriptionAsync(this ISecureScoreControlDefinitionsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// List the available security controls, their assessments, and the max score - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this ISecureScoreControlDefinitionsOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// List the available security controls, their assessments, and the max score - /// - /// - /// 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 ISecureScoreControlDefinitionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// For a specified subscription, list the available security controls, their - /// assessments, and the max score - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListBySubscriptionNext(this ISecureScoreControlDefinitionsOperations operations, string nextPageLink) - { - return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// For a specified subscription, list the available security controls, their - /// assessments, and the max score - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListBySubscriptionNextAsync(this ISecureScoreControlDefinitionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecureScoreControlsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecureScoreControlsOperations.cs deleted file mode 100644 index 68b0ca1ac12f..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecureScoreControlsOperations.cs +++ /dev/null @@ -1,792 +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.Security -{ - 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; - - /// - /// SecureScoreControlsOperations operations. - /// - internal partial class SecureScoreControlsOperations : IServiceOperations, ISecureScoreControlsOperations - { - /// - /// Initializes a new instance of the SecureScoreControlsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal SecureScoreControlsOperations(SecurityCenterClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SecurityCenterClient - /// - public SecurityCenterClient Client { get; private set; } - - /// - /// Get all security controls for a specific initiative within a scope - /// - /// - /// The initiative name. For the ASC Default initiative, use 'ascScore' as in - /// the sample request below. - /// - /// - /// OData expand. Optional. Possible values include: 'definition' - /// - /// - /// 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>> ListBySecureScoreWithHttpMessagesAsync(string secureScoreName, string expand = default(string), 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 (secureScoreName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "secureScoreName"); - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("secureScoreName", secureScoreName); - tracingParameters.Add("expand", expand); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListBySecureScore", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores/{secureScoreName}/secureScoreControls").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{secureScoreName}", System.Uri.EscapeDataString(secureScoreName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (expand != null) - { - _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Get all security controls within a scope - /// - /// - /// OData expand. Optional. Possible values include: 'definition' - /// - /// - /// 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 expand = default(string), 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}$"); - } - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("expand", expand); - 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}/providers/Microsoft.Security/secureScoreControls").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (expand != null) - { - _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Get all security controls for a specific initiative within a scope - /// - /// - /// 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>> ListBySecureScoreNextWithHttpMessagesAsync(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, "ListBySecureScoreNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Get all security controls within a scope - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecureScoreControlsOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecureScoreControlsOperationsExtensions.cs deleted file mode 100644 index 103f6984f1c7..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecureScoreControlsOperationsExtensions.cs +++ /dev/null @@ -1,169 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for SecureScoreControlsOperations. - /// - public static partial class SecureScoreControlsOperationsExtensions - { - /// - /// Get all security controls for a specific initiative within a scope - /// - /// - /// The operations group for this extension method. - /// - /// - /// The initiative name. For the ASC Default initiative, use 'ascScore' as in - /// the sample request below. - /// - /// - /// OData expand. Optional. Possible values include: 'definition' - /// - public static IPage ListBySecureScore(this ISecureScoreControlsOperations operations, string secureScoreName, string expand = default(string)) - { - return operations.ListBySecureScoreAsync(secureScoreName, expand).GetAwaiter().GetResult(); - } - - /// - /// Get all security controls for a specific initiative within a scope - /// - /// - /// The operations group for this extension method. - /// - /// - /// The initiative name. For the ASC Default initiative, use 'ascScore' as in - /// the sample request below. - /// - /// - /// OData expand. Optional. Possible values include: 'definition' - /// - /// - /// The cancellation token. - /// - public static async Task> ListBySecureScoreAsync(this ISecureScoreControlsOperations operations, string secureScoreName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListBySecureScoreWithHttpMessagesAsync(secureScoreName, expand, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get all security controls within a scope - /// - /// - /// The operations group for this extension method. - /// - /// - /// OData expand. Optional. Possible values include: 'definition' - /// - public static IPage List(this ISecureScoreControlsOperations operations, string expand = default(string)) - { - return operations.ListAsync(expand).GetAwaiter().GetResult(); - } - - /// - /// Get all security controls within a scope - /// - /// - /// The operations group for this extension method. - /// - /// - /// OData expand. Optional. Possible values include: 'definition' - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this ISecureScoreControlsOperations operations, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(expand, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get all security controls for a specific initiative within a scope - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListBySecureScoreNext(this ISecureScoreControlsOperations operations, string nextPageLink) - { - return operations.ListBySecureScoreNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Get all security controls for a specific initiative within a scope - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListBySecureScoreNextAsync(this ISecureScoreControlsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListBySecureScoreNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get all security controls within a scope - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this ISecureScoreControlsOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Get all security controls within a scope - /// - /// - /// 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 ISecureScoreControlsOperations 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecureScoresOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecureScoresOperations.cs deleted file mode 100644 index 4c2a94f4f1e5..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecureScoresOperations.cs +++ /dev/null @@ -1,606 +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.Security -{ - 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; - - /// - /// SecureScoresOperations operations. - /// - internal partial class SecureScoresOperations : IServiceOperations, ISecureScoresOperations - { - /// - /// Initializes a new instance of the SecureScoresOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal SecureScoresOperations(SecurityCenterClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SecurityCenterClient - /// - public SecurityCenterClient Client { get; private set; } - - /// - /// List secure scores for all your Security Center initiatives within your - /// current scope. - /// - /// - /// 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(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}$"); - } - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - 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}/providers/Microsoft.Security/secureScores").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Get secure score for a specific Security Center initiative within your - /// current scope. For the ASC Default initiative, use 'ascScore'. - /// - /// - /// The initiative name. For the ASC Default initiative, use 'ascScore' as in - /// the sample request below. - /// - /// - /// 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 secureScoreName, 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 (secureScoreName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "secureScoreName"); - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("secureScoreName", secureScoreName); - 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}/providers/Microsoft.Security/secureScores/{secureScoreName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{secureScoreName}", System.Uri.EscapeDataString(secureScoreName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// List secure scores for all your Security Center initiatives within your - /// current scope. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecureScoresOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecureScoresOperationsExtensions.cs deleted file mode 100644 index 8429cf06bf15..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecureScoresOperationsExtensions.cs +++ /dev/null @@ -1,129 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for SecureScoresOperations. - /// - public static partial class SecureScoresOperationsExtensions - { - /// - /// List secure scores for all your Security Center initiatives within your - /// current scope. - /// - /// - /// The operations group for this extension method. - /// - public static IPage List(this ISecureScoresOperations operations) - { - return operations.ListAsync().GetAwaiter().GetResult(); - } - - /// - /// List secure scores for all your Security Center initiatives within your - /// current scope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this ISecureScoresOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get secure score for a specific Security Center initiative within your - /// current scope. For the ASC Default initiative, use 'ascScore'. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The initiative name. For the ASC Default initiative, use 'ascScore' as in - /// the sample request below. - /// - public static SecureScoreItem Get(this ISecureScoresOperations operations, string secureScoreName) - { - return operations.GetAsync(secureScoreName).GetAwaiter().GetResult(); - } - - /// - /// Get secure score for a specific Security Center initiative within your - /// current scope. For the ASC Default initiative, use 'ascScore'. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The initiative name. For the ASC Default initiative, use 'ascScore' as in - /// the sample request below. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this ISecureScoresOperations operations, string secureScoreName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(secureScoreName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// List secure scores for all your Security Center initiatives within your - /// current scope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this ISecureScoresOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// List secure scores for all your Security Center initiatives within your - /// current scope. - /// - /// - /// 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 ISecureScoresOperations 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecurityCenterClient.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecurityCenterClient.cs index d987a9b88202..67a0fad4128d 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecurityCenterClient.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecurityCenterClient.cs @@ -53,10 +53,9 @@ public partial class SecurityCenterClient : ServiceClient, public string SubscriptionId { get; set; } /// - /// The location where ASC stores the data of the subscription. can be - /// retrieved from Get locations + /// API version for the operation /// - public string AscLocation { get; set; } + public string ApiVersion { get; private set; } /// /// The preferred language for the response. @@ -76,231 +75,11 @@ public partial class SecurityCenterClient : ServiceClient, /// public bool? GenerateClientRequestId { get; set; } - /// - /// Gets the IComplianceResultsOperations. - /// - public virtual IComplianceResultsOperations ComplianceResults { get; private set; } - /// /// Gets the IPricingsOperations. /// public virtual IPricingsOperations Pricings { get; private set; } - /// - /// Gets the IAdvancedThreatProtectionOperations. - /// - public virtual IAdvancedThreatProtectionOperations AdvancedThreatProtection { get; private set; } - - /// - /// Gets the IDeviceSecurityGroupsOperations. - /// - public virtual IDeviceSecurityGroupsOperations DeviceSecurityGroups { get; private set; } - - /// - /// Gets the IIotSecuritySolutionOperations. - /// - public virtual IIotSecuritySolutionOperations IotSecuritySolution { get; private set; } - - /// - /// Gets the IIotSecuritySolutionAnalyticsOperations. - /// - public virtual IIotSecuritySolutionAnalyticsOperations IotSecuritySolutionAnalytics { get; private set; } - - /// - /// Gets the IIotSecuritySolutionsAnalyticsAggregatedAlertOperations. - /// - public virtual IIotSecuritySolutionsAnalyticsAggregatedAlertOperations IotSecuritySolutionsAnalyticsAggregatedAlert { get; private set; } - - /// - /// Gets the IIotSecuritySolutionsAnalyticsRecommendationOperations. - /// - public virtual IIotSecuritySolutionsAnalyticsRecommendationOperations IotSecuritySolutionsAnalyticsRecommendation { get; private set; } - - /// - /// Gets the ILocationsOperations. - /// - public virtual ILocationsOperations Locations { get; private set; } - - /// - /// Gets the IOperations. - /// - public virtual IOperations Operations { get; private set; } - - /// - /// Gets the ITasksOperations. - /// - public virtual ITasksOperations Tasks { get; private set; } - - /// - /// Gets the IAutoProvisioningSettingsOperations. - /// - public virtual IAutoProvisioningSettingsOperations AutoProvisioningSettings { get; private set; } - - /// - /// Gets the ICompliancesOperations. - /// - public virtual ICompliancesOperations Compliances { get; private set; } - - /// - /// Gets the IInformationProtectionPoliciesOperations. - /// - public virtual IInformationProtectionPoliciesOperations InformationProtectionPolicies { get; private set; } - - /// - /// Gets the ISecurityContactsOperations. - /// - public virtual ISecurityContactsOperations SecurityContacts { get; private set; } - - /// - /// Gets the IWorkspaceSettingsOperations. - /// - public virtual IWorkspaceSettingsOperations WorkspaceSettings { get; private set; } - - /// - /// Gets the IRegulatoryComplianceStandardsOperations. - /// - public virtual IRegulatoryComplianceStandardsOperations RegulatoryComplianceStandards { get; private set; } - - /// - /// Gets the IRegulatoryComplianceControlsOperations. - /// - public virtual IRegulatoryComplianceControlsOperations RegulatoryComplianceControls { get; private set; } - - /// - /// Gets the IRegulatoryComplianceAssessmentsOperations. - /// - public virtual IRegulatoryComplianceAssessmentsOperations RegulatoryComplianceAssessments { get; private set; } - - /// - /// Gets the ISubAssessmentsOperations. - /// - public virtual ISubAssessmentsOperations SubAssessments { get; private set; } - - /// - /// Gets the IAutomationsOperations. - /// - public virtual IAutomationsOperations Automations { get; private set; } - - /// - /// Gets the IAlertsSuppressionRulesOperations. - /// - public virtual IAlertsSuppressionRulesOperations AlertsSuppressionRules { get; private set; } - - /// - /// Gets the IServerVulnerabilityAssessmentOperations. - /// - public virtual IServerVulnerabilityAssessmentOperations ServerVulnerabilityAssessment { get; private set; } - - /// - /// Gets the IAssessmentsMetadataOperations. - /// - public virtual IAssessmentsMetadataOperations AssessmentsMetadata { get; private set; } - - /// - /// Gets the IAssessmentsOperations. - /// - public virtual IAssessmentsOperations Assessments { get; private set; } - - /// - /// Gets the IAdaptiveApplicationControlsOperations. - /// - public virtual IAdaptiveApplicationControlsOperations AdaptiveApplicationControls { get; private set; } - - /// - /// Gets the IAdaptiveNetworkHardeningsOperations. - /// - public virtual IAdaptiveNetworkHardeningsOperations AdaptiveNetworkHardenings { get; private set; } - - /// - /// Gets the IAllowedConnectionsOperations. - /// - public virtual IAllowedConnectionsOperations AllowedConnections { get; private set; } - - /// - /// Gets the ITopologyOperations. - /// - public virtual ITopologyOperations Topology { get; private set; } - - /// - /// Gets the IJitNetworkAccessPoliciesOperations. - /// - public virtual IJitNetworkAccessPoliciesOperations JitNetworkAccessPolicies { get; private set; } - - /// - /// Gets the IDiscoveredSecuritySolutionsOperations. - /// - public virtual IDiscoveredSecuritySolutionsOperations DiscoveredSecuritySolutions { get; private set; } - - /// - /// Gets the ISecuritySolutionsReferenceDataOperations. - /// - public virtual ISecuritySolutionsReferenceDataOperations SecuritySolutionsReferenceData { get; private set; } - - /// - /// Gets the IExternalSecuritySolutionsOperations. - /// - public virtual IExternalSecuritySolutionsOperations ExternalSecuritySolutions { get; private set; } - - /// - /// Gets the ISecureScoresOperations. - /// - public virtual ISecureScoresOperations SecureScores { get; private set; } - - /// - /// Gets the ISecureScoreControlsOperations. - /// - public virtual ISecureScoreControlsOperations SecureScoreControls { get; private set; } - - /// - /// Gets the ISecureScoreControlDefinitionsOperations. - /// - public virtual ISecureScoreControlDefinitionsOperations SecureScoreControlDefinitions { get; private set; } - - /// - /// Gets the ISecuritySolutionsOperations. - /// - public virtual ISecuritySolutionsOperations SecuritySolutions { get; private set; } - - /// - /// Gets the IConnectorsOperations. - /// - public virtual IConnectorsOperations Connectors { get; private set; } - - /// - /// Gets the ISqlVulnerabilityAssessmentScansOperations. - /// - public virtual ISqlVulnerabilityAssessmentScansOperations SqlVulnerabilityAssessmentScans { get; private set; } - - /// - /// Gets the ISqlVulnerabilityAssessmentScanResultsOperations. - /// - public virtual ISqlVulnerabilityAssessmentScanResultsOperations SqlVulnerabilityAssessmentScanResults { get; private set; } - - /// - /// Gets the ISqlVulnerabilityAssessmentBaselineRulesOperations. - /// - public virtual ISqlVulnerabilityAssessmentBaselineRulesOperations SqlVulnerabilityAssessmentBaselineRules { get; private set; } - - /// - /// Gets the IAlertsOperations. - /// - public virtual IAlertsOperations Alerts { get; private set; } - - /// - /// Gets the ISettingsOperations. - /// - public virtual ISettingsOperations Settings { get; private set; } - - /// - /// Gets the IIngestionSettingsOperations. - /// - public virtual IIngestionSettingsOperations IngestionSettings { get; private set; } - - /// - /// Gets the ISoftwareInventoriesOperations. - /// - public virtual ISoftwareInventoriesOperations SoftwareInventories { get; private set; } - /// /// Initializes a new instance of the SecurityCenterClient class. /// @@ -542,52 +321,9 @@ public SecurityCenterClient(System.Uri baseUri, ServiceClientCredentials credent /// private void Initialize() { - ComplianceResults = new ComplianceResultsOperations(this); Pricings = new PricingsOperations(this); - AdvancedThreatProtection = new AdvancedThreatProtectionOperations(this); - DeviceSecurityGroups = new DeviceSecurityGroupsOperations(this); - IotSecuritySolution = new IotSecuritySolutionOperations(this); - IotSecuritySolutionAnalytics = new IotSecuritySolutionAnalyticsOperations(this); - IotSecuritySolutionsAnalyticsAggregatedAlert = new IotSecuritySolutionsAnalyticsAggregatedAlertOperations(this); - IotSecuritySolutionsAnalyticsRecommendation = new IotSecuritySolutionsAnalyticsRecommendationOperations(this); - Locations = new LocationsOperations(this); - Operations = new Operations(this); - Tasks = new TasksOperations(this); - AutoProvisioningSettings = new AutoProvisioningSettingsOperations(this); - Compliances = new CompliancesOperations(this); - InformationProtectionPolicies = new InformationProtectionPoliciesOperations(this); - SecurityContacts = new SecurityContactsOperations(this); - WorkspaceSettings = new WorkspaceSettingsOperations(this); - RegulatoryComplianceStandards = new RegulatoryComplianceStandardsOperations(this); - RegulatoryComplianceControls = new RegulatoryComplianceControlsOperations(this); - RegulatoryComplianceAssessments = new RegulatoryComplianceAssessmentsOperations(this); - SubAssessments = new SubAssessmentsOperations(this); - Automations = new AutomationsOperations(this); - AlertsSuppressionRules = new AlertsSuppressionRulesOperations(this); - ServerVulnerabilityAssessment = new ServerVulnerabilityAssessmentOperations(this); - AssessmentsMetadata = new AssessmentsMetadataOperations(this); - Assessments = new AssessmentsOperations(this); - AdaptiveApplicationControls = new AdaptiveApplicationControlsOperations(this); - AdaptiveNetworkHardenings = new AdaptiveNetworkHardeningsOperations(this); - AllowedConnections = new AllowedConnectionsOperations(this); - Topology = new TopologyOperations(this); - JitNetworkAccessPolicies = new JitNetworkAccessPoliciesOperations(this); - DiscoveredSecuritySolutions = new DiscoveredSecuritySolutionsOperations(this); - SecuritySolutionsReferenceData = new SecuritySolutionsReferenceDataOperations(this); - ExternalSecuritySolutions = new ExternalSecuritySolutionsOperations(this); - SecureScores = new SecureScoresOperations(this); - SecureScoreControls = new SecureScoreControlsOperations(this); - SecureScoreControlDefinitions = new SecureScoreControlDefinitionsOperations(this); - SecuritySolutions = new SecuritySolutionsOperations(this); - Connectors = new ConnectorsOperations(this); - SqlVulnerabilityAssessmentScans = new SqlVulnerabilityAssessmentScansOperations(this); - SqlVulnerabilityAssessmentScanResults = new SqlVulnerabilityAssessmentScanResultsOperations(this); - SqlVulnerabilityAssessmentBaselineRules = new SqlVulnerabilityAssessmentBaselineRulesOperations(this); - Alerts = new AlertsOperations(this); - Settings = new SettingsOperations(this); - IngestionSettings = new IngestionSettingsOperations(this); - SoftwareInventories = new SoftwareInventoriesOperations(this); BaseUri = new System.Uri("https://management.azure.com"); + ApiVersion = "2022-03-01"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; @@ -617,24 +353,6 @@ private void Initialize() new Iso8601TimeSpanConverter() } }; - SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("ruleType")); - DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("ruleType")); - SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("source")); - DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("source")); - SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("assessedResourceType")); - DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("assessedResourceType")); - SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("actionType")); - DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("actionType")); - SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("kind")); - DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("kind")); - SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("authenticationType")); - DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("authenticationType")); - SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("type")); - DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("type")); - 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecurityContactsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecurityContactsOperations.cs deleted file mode 100644 index 000a662531e5..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecurityContactsOperations.cs +++ /dev/null @@ -1,1189 +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.Security -{ - 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; - - /// - /// SecurityContactsOperations operations. - /// - internal partial class SecurityContactsOperations : IServiceOperations, ISecurityContactsOperations - { - /// - /// Initializes a new instance of the SecurityContactsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal SecurityContactsOperations(SecurityCenterClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SecurityCenterClient - /// - public SecurityCenterClient Client { get; private set; } - - /// - /// Security contact configurations for the subscription - /// - /// - /// 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(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}$"); - } - } - string apiVersion = "2017-08-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - 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}/providers/Microsoft.Security/securityContacts").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Security contact configurations for the subscription - /// - /// - /// Name of the security contact object - /// - /// - /// 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 securityContactName, 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 (securityContactName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "securityContactName"); - } - string apiVersion = "2017-08-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("securityContactName", securityContactName); - 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}/providers/Microsoft.Security/securityContacts/{securityContactName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{securityContactName}", System.Uri.EscapeDataString(securityContactName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Security contact configurations for the subscription - /// - /// - /// Name of the security contact object - /// - /// - /// Security contact object - /// - /// - /// 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 securityContactName, SecurityContact securityContact, 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 (securityContactName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "securityContactName"); - } - if (securityContact == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "securityContact"); - } - if (securityContact != null) - { - securityContact.Validate(); - } - string apiVersion = "2017-08-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("securityContactName", securityContactName); - tracingParameters.Add("securityContact", securityContact); - 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}/providers/Microsoft.Security/securityContacts/{securityContactName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{securityContactName}", System.Uri.EscapeDataString(securityContactName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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(securityContact != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(securityContact, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Security contact configurations for the subscription - /// - /// - /// Name of the security contact object - /// - /// - /// 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 securityContactName, 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 (securityContactName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "securityContactName"); - } - string apiVersion = "2017-08-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("securityContactName", securityContactName); - 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}/providers/Microsoft.Security/securityContacts/{securityContactName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{securityContactName}", System.Uri.EscapeDataString(securityContactName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 != 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; - } - - /// - /// Security contact configurations for the subscription - /// - /// - /// Name of the security contact object - /// - /// - /// Security contact object - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> UpdateWithHttpMessagesAsync(string securityContactName, SecurityContact securityContact, 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 (securityContactName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "securityContactName"); - } - if (securityContact == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "securityContact"); - } - string apiVersion = "2017-08-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("securityContactName", securityContactName); - tracingParameters.Add("securityContact", securityContact); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{securityContactName}", System.Uri.EscapeDataString(securityContactName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PATCH"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(securityContact != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(securityContact, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Security contact configurations for the subscription - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecurityContactsOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecurityContactsOperationsExtensions.cs deleted file mode 100644 index 41e4dd05d05d..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecurityContactsOperationsExtensions.cs +++ /dev/null @@ -1,232 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for SecurityContactsOperations. - /// - public static partial class SecurityContactsOperationsExtensions - { - /// - /// Security contact configurations for the subscription - /// - /// - /// The operations group for this extension method. - /// - public static IPage List(this ISecurityContactsOperations operations) - { - return operations.ListAsync().GetAwaiter().GetResult(); - } - - /// - /// Security contact configurations for the subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this ISecurityContactsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Security contact configurations for the subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the security contact object - /// - public static SecurityContact Get(this ISecurityContactsOperations operations, string securityContactName) - { - return operations.GetAsync(securityContactName).GetAwaiter().GetResult(); - } - - /// - /// Security contact configurations for the subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the security contact object - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this ISecurityContactsOperations operations, string securityContactName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(securityContactName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Security contact configurations for the subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the security contact object - /// - /// - /// Security contact object - /// - public static SecurityContact Create(this ISecurityContactsOperations operations, string securityContactName, SecurityContact securityContact) - { - return operations.CreateAsync(securityContactName, securityContact).GetAwaiter().GetResult(); - } - - /// - /// Security contact configurations for the subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the security contact object - /// - /// - /// Security contact object - /// - /// - /// The cancellation token. - /// - public static async Task CreateAsync(this ISecurityContactsOperations operations, string securityContactName, SecurityContact securityContact, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateWithHttpMessagesAsync(securityContactName, securityContact, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Security contact configurations for the subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the security contact object - /// - public static void Delete(this ISecurityContactsOperations operations, string securityContactName) - { - operations.DeleteAsync(securityContactName).GetAwaiter().GetResult(); - } - - /// - /// Security contact configurations for the subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the security contact object - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this ISecurityContactsOperations operations, string securityContactName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(securityContactName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Security contact configurations for the subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the security contact object - /// - /// - /// Security contact object - /// - public static SecurityContact Update(this ISecurityContactsOperations operations, string securityContactName, SecurityContact securityContact) - { - return operations.UpdateAsync(securityContactName, securityContact).GetAwaiter().GetResult(); - } - - /// - /// Security contact configurations for the subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the security contact object - /// - /// - /// Security contact object - /// - /// - /// The cancellation token. - /// - public static async Task UpdateAsync(this ISecurityContactsOperations operations, string securityContactName, SecurityContact securityContact, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.UpdateWithHttpMessagesAsync(securityContactName, securityContact, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Security contact configurations for the subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this ISecurityContactsOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Security contact configurations for the subscription - /// - /// - /// 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 ISecurityContactsOperations 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecuritySolutionsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecuritySolutionsOperations.cs deleted file mode 100644 index de7706e3ffbb..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecuritySolutionsOperations.cs +++ /dev/null @@ -1,632 +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.Security -{ - 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; - - /// - /// SecuritySolutionsOperations operations. - /// - internal partial class SecuritySolutionsOperations : IServiceOperations, ISecuritySolutionsOperations - { - /// - /// Initializes a new instance of the SecuritySolutionsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal SecuritySolutionsOperations(SecurityCenterClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SecurityCenterClient - /// - public SecurityCenterClient Client { get; private set; } - - /// - /// Gets a list of Security Solutions for the subscription. - /// - /// - /// 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(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}$"); - } - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - 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}/providers/Microsoft.Security/securitySolutions").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets a specific Security Solution. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// Name of security solution. - /// - /// - /// 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 securitySolutionName, 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 (Client.AscLocation == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.AscLocation"); - } - if (securitySolutionName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "securitySolutionName"); - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("securitySolutionName", securitySolutionName); - tracingParameters.Add("apiVersion", apiVersion); - 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.Security/locations/{ascLocation}/securitySolutions/{securitySolutionName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{ascLocation}", System.Uri.EscapeDataString(Client.AscLocation)); - _url = _url.Replace("{securitySolutionName}", System.Uri.EscapeDataString(securitySolutionName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets a list of Security Solutions for the subscription. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecuritySolutionsOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecuritySolutionsOperationsExtensions.cs deleted file mode 100644 index cceb5464c183..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecuritySolutionsOperationsExtensions.cs +++ /dev/null @@ -1,129 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for SecuritySolutionsOperations. - /// - public static partial class SecuritySolutionsOperationsExtensions - { - /// - /// Gets a list of Security Solutions for the subscription. - /// - /// - /// The operations group for this extension method. - /// - public static IPage List(this ISecuritySolutionsOperations operations) - { - return operations.ListAsync().GetAwaiter().GetResult(); - } - - /// - /// Gets a list of Security Solutions for the subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this ISecuritySolutionsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets a specific Security Solution. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// Name of security solution. - /// - public static SecuritySolution Get(this ISecuritySolutionsOperations operations, string resourceGroupName, string securitySolutionName) - { - return operations.GetAsync(resourceGroupName, securitySolutionName).GetAwaiter().GetResult(); - } - - /// - /// Gets a specific Security Solution. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// Name of security solution. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this ISecuritySolutionsOperations operations, string resourceGroupName, string securitySolutionName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, securitySolutionName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets a list of Security Solutions for the subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this ISecuritySolutionsOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Gets a list of Security Solutions for the subscription. - /// - /// - /// 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 ISecuritySolutionsOperations 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecuritySolutionsReferenceDataOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecuritySolutionsReferenceDataOperations.cs deleted file mode 100644 index c71d1fe5707a..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecuritySolutionsReferenceDataOperations.cs +++ /dev/null @@ -1,426 +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.Security -{ - 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; - - /// - /// SecuritySolutionsReferenceDataOperations operations. - /// - internal partial class SecuritySolutionsReferenceDataOperations : IServiceOperations, ISecuritySolutionsReferenceDataOperations - { - /// - /// Initializes a new instance of the SecuritySolutionsReferenceDataOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal SecuritySolutionsReferenceDataOperations(SecurityCenterClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SecurityCenterClient - /// - public SecurityCenterClient Client { get; private set; } - - /// - /// Gets a list of all supported Security Solutions for the subscription. - /// - /// - /// 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(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}$"); - } - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - 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}/providers/Microsoft.Security/securitySolutionsReferenceData").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets list of all supported Security Solutions for subscription and - /// location. - /// - /// - /// 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> ListByHomeRegionWithHttpMessagesAsync(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 (Client.AscLocation == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.AscLocation"); - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByHomeRegion", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/securitySolutionsReferenceData").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{ascLocation}", System.Uri.EscapeDataString(Client.AscLocation)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecuritySolutionsReferenceDataOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecuritySolutionsReferenceDataOperationsExtensions.cs deleted file mode 100644 index 9209ab0f8048..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecuritySolutionsReferenceDataOperationsExtensions.cs +++ /dev/null @@ -1,83 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for SecuritySolutionsReferenceDataOperations. - /// - public static partial class SecuritySolutionsReferenceDataOperationsExtensions - { - /// - /// Gets a list of all supported Security Solutions for the subscription. - /// - /// - /// The operations group for this extension method. - /// - public static SecuritySolutionsReferenceDataList List(this ISecuritySolutionsReferenceDataOperations operations) - { - return operations.ListAsync().GetAwaiter().GetResult(); - } - - /// - /// Gets a list of all supported Security Solutions for the subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task ListAsync(this ISecuritySolutionsReferenceDataOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets list of all supported Security Solutions for subscription and - /// location. - /// - /// - /// The operations group for this extension method. - /// - public static SecuritySolutionsReferenceDataList ListByHomeRegion(this ISecuritySolutionsReferenceDataOperations operations) - { - return operations.ListByHomeRegionAsync().GetAwaiter().GetResult(); - } - - /// - /// Gets list of all supported Security Solutions for subscription and - /// location. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task ListByHomeRegionAsync(this ISecuritySolutionsReferenceDataOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByHomeRegionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ServerVulnerabilityAssessmentOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ServerVulnerabilityAssessmentOperations.cs deleted file mode 100644 index cee80b002e95..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ServerVulnerabilityAssessmentOperations.cs +++ /dev/null @@ -1,1014 +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.Security -{ - 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; - - /// - /// ServerVulnerabilityAssessmentOperations operations. - /// - internal partial class ServerVulnerabilityAssessmentOperations : IServiceOperations, IServerVulnerabilityAssessmentOperations - { - /// - /// Initializes a new instance of the ServerVulnerabilityAssessmentOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal ServerVulnerabilityAssessmentOperations(SecurityCenterClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SecurityCenterClient - /// - public SecurityCenterClient Client { get; private set; } - - /// - /// Gets a list of server vulnerability assessment onboarding statuses on a - /// given resource. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The Namespace of the resource. - /// - /// - /// The type of the resource. - /// - /// - /// Name of the resource. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> ListByExtendedResourceWithHttpMessagesAsync(string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, 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 (resourceNamespace == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceNamespace"); - } - if (resourceType == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceType"); - } - if (resourceName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("resourceNamespace", resourceNamespace); - tracingParameters.Add("resourceType", resourceType); - tracingParameters.Add("resourceName", resourceName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByExtendedResource", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{resourceNamespace}", System.Uri.EscapeDataString(resourceNamespace)); - _url = _url.Replace("{resourceType}", System.Uri.EscapeDataString(resourceType)); - _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets a server vulnerability assessment onboarding statuses on a given - /// resource. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The Namespace of the resource. - /// - /// - /// The type of the resource. - /// - /// - /// Name of the resource. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, 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 (resourceNamespace == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceNamespace"); - } - if (resourceType == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceType"); - } - if (resourceName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); - } - string serverVulnerabilityAssessment = "default"; - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("resourceNamespace", resourceNamespace); - tracingParameters.Add("resourceType", resourceType); - tracingParameters.Add("resourceName", resourceName); - tracingParameters.Add("serverVulnerabilityAssessment", serverVulnerabilityAssessment); - tracingParameters.Add("apiVersion", apiVersion); - 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/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{resourceNamespace}", System.Uri.EscapeDataString(resourceNamespace)); - _url = _url.Replace("{resourceType}", System.Uri.EscapeDataString(resourceType)); - _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); - _url = _url.Replace("{serverVulnerabilityAssessment}", System.Uri.EscapeDataString(serverVulnerabilityAssessment)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Creating a server vulnerability assessment on a resource, which will - /// onboard a resource for having a vulnerability assessment on it - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The Namespace of the resource. - /// - /// - /// The type of the resource. - /// - /// - /// Name of the resource. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, 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 (resourceNamespace == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceNamespace"); - } - if (resourceType == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceType"); - } - if (resourceName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); - } - string serverVulnerabilityAssessment = "default"; - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("resourceNamespace", resourceNamespace); - tracingParameters.Add("resourceType", resourceType); - tracingParameters.Add("resourceName", resourceName); - tracingParameters.Add("serverVulnerabilityAssessment", serverVulnerabilityAssessment); - tracingParameters.Add("apiVersion", apiVersion); - 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/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{resourceNamespace}", System.Uri.EscapeDataString(resourceNamespace)); - _url = _url.Replace("{resourceType}", System.Uri.EscapeDataString(resourceType)); - _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); - _url = _url.Replace("{serverVulnerabilityAssessment}", System.Uri.EscapeDataString(serverVulnerabilityAssessment)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - // 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 != 202) - { - 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 == 202) - { - _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; - } - - /// - /// Removing server vulnerability assessment from a resource. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The Namespace of the resource. - /// - /// - /// The type of the resource. - /// - /// - /// Name of the resource. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Removing server vulnerability assessment from a resource. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The Namespace of the resource. - /// - /// - /// The type of the resource. - /// - /// - /// Name of the resource. - /// - /// - /// 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 BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, 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 (resourceNamespace == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceNamespace"); - } - if (resourceType == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceType"); - } - if (resourceName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); - } - string serverVulnerabilityAssessment = "default"; - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("resourceNamespace", resourceNamespace); - tracingParameters.Add("resourceType", resourceType); - tracingParameters.Add("resourceName", resourceName); - tracingParameters.Add("serverVulnerabilityAssessment", serverVulnerabilityAssessment); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{resourceNamespace}", System.Uri.EscapeDataString(resourceNamespace)); - _url = _url.Replace("{resourceType}", System.Uri.EscapeDataString(resourceType)); - _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); - _url = _url.Replace("{serverVulnerabilityAssessment}", System.Uri.EscapeDataString(serverVulnerabilityAssessment)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 != 202 && (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; - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ServerVulnerabilityAssessmentOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ServerVulnerabilityAssessmentOperationsExtensions.cs deleted file mode 100644 index fd4c58871da3..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ServerVulnerabilityAssessmentOperationsExtensions.cs +++ /dev/null @@ -1,295 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for ServerVulnerabilityAssessmentOperations. - /// - public static partial class ServerVulnerabilityAssessmentOperationsExtensions - { - /// - /// Gets a list of server vulnerability assessment onboarding statuses on a - /// given 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 Namespace of the resource. - /// - /// - /// The type of the resource. - /// - /// - /// Name of the resource. - /// - public static ServerVulnerabilityAssessmentsList ListByExtendedResource(this IServerVulnerabilityAssessmentOperations operations, string resourceGroupName, string resourceNamespace, string resourceType, string resourceName) - { - return operations.ListByExtendedResourceAsync(resourceGroupName, resourceNamespace, resourceType, resourceName).GetAwaiter().GetResult(); - } - - /// - /// Gets a list of server vulnerability assessment onboarding statuses on a - /// given 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 Namespace of the resource. - /// - /// - /// The type of the resource. - /// - /// - /// Name of the resource. - /// - /// - /// The cancellation token. - /// - public static async Task ListByExtendedResourceAsync(this IServerVulnerabilityAssessmentOperations operations, string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByExtendedResourceWithHttpMessagesAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets a server vulnerability assessment onboarding statuses on a given - /// 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 Namespace of the resource. - /// - /// - /// The type of the resource. - /// - /// - /// Name of the resource. - /// - public static ServerVulnerabilityAssessment Get(this IServerVulnerabilityAssessmentOperations operations, string resourceGroupName, string resourceNamespace, string resourceType, string resourceName) - { - return operations.GetAsync(resourceGroupName, resourceNamespace, resourceType, resourceName).GetAwaiter().GetResult(); - } - - /// - /// Gets a server vulnerability assessment onboarding statuses on a given - /// 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 Namespace of the resource. - /// - /// - /// The type of the resource. - /// - /// - /// Name of the resource. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IServerVulnerabilityAssessmentOperations operations, string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Creating a server vulnerability assessment on a resource, which will - /// onboard a resource for having a vulnerability assessment on it - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The Namespace of the resource. - /// - /// - /// The type of the resource. - /// - /// - /// Name of the resource. - /// - public static ServerVulnerabilityAssessment CreateOrUpdate(this IServerVulnerabilityAssessmentOperations operations, string resourceGroupName, string resourceNamespace, string resourceType, string resourceName) - { - return operations.CreateOrUpdateAsync(resourceGroupName, resourceNamespace, resourceType, resourceName).GetAwaiter().GetResult(); - } - - /// - /// Creating a server vulnerability assessment on a resource, which will - /// onboard a resource for having a vulnerability assessment on it - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The Namespace of the resource. - /// - /// - /// The type of the resource. - /// - /// - /// Name of the resource. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IServerVulnerabilityAssessmentOperations operations, string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Removing server vulnerability assessment from a 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 Namespace of the resource. - /// - /// - /// The type of the resource. - /// - /// - /// Name of the resource. - /// - public static void Delete(this IServerVulnerabilityAssessmentOperations operations, string resourceGroupName, string resourceNamespace, string resourceType, string resourceName) - { - operations.DeleteAsync(resourceGroupName, resourceNamespace, resourceType, resourceName).GetAwaiter().GetResult(); - } - - /// - /// Removing server vulnerability assessment from a 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 Namespace of the resource. - /// - /// - /// The type of the resource. - /// - /// - /// Name of the resource. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IServerVulnerabilityAssessmentOperations operations, string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Removing server vulnerability assessment from a 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 Namespace of the resource. - /// - /// - /// The type of the resource. - /// - /// - /// Name of the resource. - /// - public static void BeginDelete(this IServerVulnerabilityAssessmentOperations operations, string resourceGroupName, string resourceNamespace, string resourceType, string resourceName) - { - operations.BeginDeleteAsync(resourceGroupName, resourceNamespace, resourceType, resourceName).GetAwaiter().GetResult(); - } - - /// - /// Removing server vulnerability assessment from a 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 Namespace of the resource. - /// - /// - /// The type of the resource. - /// - /// - /// Name of the resource. - /// - /// - /// The cancellation token. - /// - public static async Task BeginDeleteAsync(this IServerVulnerabilityAssessmentOperations operations, string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SettingsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SettingsOperations.cs deleted file mode 100644 index 68953ec2e798..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SettingsOperations.cs +++ /dev/null @@ -1,810 +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.Security -{ - 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; - - /// - /// SettingsOperations operations. - /// - internal partial class SettingsOperations : IServiceOperations, ISettingsOperations - { - /// - /// Initializes a new instance of the SettingsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal SettingsOperations(SecurityCenterClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SecurityCenterClient - /// - public SecurityCenterClient Client { get; private set; } - - /// - /// Settings about different configurations in security center - /// - /// - /// 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(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}$"); - } - } - string apiVersion = "2021-07-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - 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}/providers/Microsoft.Security/settings").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Settings of different configurations in security center - /// - /// - /// The name of the setting. Possible values include: 'MCAS', 'WDATP', - /// 'WDATP_EXCLUDE_LINUX_PUBLIC_PREVIEW', 'Sentinel' - /// - /// - /// 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 settingName, 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 (settingName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "settingName"); - } - string apiVersion = "2021-07-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("settingName", settingName); - 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}/providers/Microsoft.Security/settings/{settingName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{settingName}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(settingName, Client.SerializationSettings).Trim('"'))); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// updating settings about different configurations in security center - /// - /// - /// The name of the setting. Possible values include: 'MCAS', 'WDATP', - /// 'WDATP_EXCLUDE_LINUX_PUBLIC_PREVIEW', 'Sentinel' - /// - /// - /// Setting object - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> UpdateWithHttpMessagesAsync(string settingName, Setting setting, 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 (settingName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "settingName"); - } - if (setting == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "setting"); - } - string apiVersion = "2021-07-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("settingName", settingName); - tracingParameters.Add("setting", setting); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{settingName}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(settingName, Client.SerializationSettings).Trim('"'))); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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(setting != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(setting, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Settings about different configurations in security center - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SettingsOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SettingsOperationsExtensions.cs deleted file mode 100644 index 5a07659a7ca4..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SettingsOperationsExtensions.cs +++ /dev/null @@ -1,165 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for SettingsOperations. - /// - public static partial class SettingsOperationsExtensions - { - /// - /// Settings about different configurations in security center - /// - /// - /// The operations group for this extension method. - /// - public static IPage List(this ISettingsOperations operations) - { - return operations.ListAsync().GetAwaiter().GetResult(); - } - - /// - /// Settings about different configurations in security center - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this ISettingsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Settings of different configurations in security center - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the setting. Possible values include: 'MCAS', 'WDATP', - /// 'WDATP_EXCLUDE_LINUX_PUBLIC_PREVIEW', 'Sentinel' - /// - public static Setting Get(this ISettingsOperations operations, string settingName) - { - return operations.GetAsync(settingName).GetAwaiter().GetResult(); - } - - /// - /// Settings of different configurations in security center - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the setting. Possible values include: 'MCAS', 'WDATP', - /// 'WDATP_EXCLUDE_LINUX_PUBLIC_PREVIEW', 'Sentinel' - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this ISettingsOperations operations, string settingName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(settingName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// updating settings about different configurations in security center - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the setting. Possible values include: 'MCAS', 'WDATP', - /// 'WDATP_EXCLUDE_LINUX_PUBLIC_PREVIEW', 'Sentinel' - /// - /// - /// Setting object - /// - public static Setting Update(this ISettingsOperations operations, string settingName, Setting setting) - { - return operations.UpdateAsync(settingName, setting).GetAwaiter().GetResult(); - } - - /// - /// updating settings about different configurations in security center - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the setting. Possible values include: 'MCAS', 'WDATP', - /// 'WDATP_EXCLUDE_LINUX_PUBLIC_PREVIEW', 'Sentinel' - /// - /// - /// Setting object - /// - /// - /// The cancellation token. - /// - public static async Task UpdateAsync(this ISettingsOperations operations, string settingName, Setting setting, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.UpdateWithHttpMessagesAsync(settingName, setting, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Settings about different configurations in security center - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this ISettingsOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Settings about different configurations in security center - /// - /// - /// 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 ISettingsOperations 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SoftwareInventoriesOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SoftwareInventoriesOperations.cs deleted file mode 100644 index 79f3935d59fa..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SoftwareInventoriesOperations.cs +++ /dev/null @@ -1,1062 +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.Security -{ - 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; - - /// - /// SoftwareInventoriesOperations operations. - /// - internal partial class SoftwareInventoriesOperations : IServiceOperations, ISoftwareInventoriesOperations - { - /// - /// Initializes a new instance of the SoftwareInventoriesOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal SoftwareInventoriesOperations(SecurityCenterClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SecurityCenterClient - /// - public SecurityCenterClient Client { get; private set; } - - /// - /// Gets the software inventory of the virtual machine. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The namespace of the resource. - /// - /// - /// The type of the resource. - /// - /// - /// Name of the resource. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListByExtendedResourceWithHttpMessagesAsync(string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, 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 (resourceNamespace == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceNamespace"); - } - if (resourceType == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceType"); - } - if (resourceName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); - } - string apiVersion = "2021-05-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("resourceNamespace", resourceNamespace); - tracingParameters.Add("resourceType", resourceType); - tracingParameters.Add("resourceName", resourceName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByExtendedResource", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/softwareInventories").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{resourceNamespace}", System.Uri.EscapeDataString(resourceNamespace)); - _url = _url.Replace("{resourceType}", System.Uri.EscapeDataString(resourceType)); - _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets the software inventory of all virtual machines in the subscriptions. - /// - /// - /// 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>> ListBySubscriptionWithHttpMessagesAsync(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}$"); - } - } - string apiVersion = "2021-05-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/softwareInventories").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets a single software data of the virtual machine. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The namespace of the resource. - /// - /// - /// The type of the resource. - /// - /// - /// Name of the resource. - /// - /// - /// Name of the installed software. - /// - /// - /// 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 resourceNamespace, string resourceType, string resourceName, string softwareName, 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 (resourceNamespace == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceNamespace"); - } - if (resourceType == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceType"); - } - if (resourceName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); - } - if (softwareName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "softwareName"); - } - string apiVersion = "2021-05-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("resourceNamespace", resourceNamespace); - tracingParameters.Add("resourceType", resourceType); - tracingParameters.Add("resourceName", resourceName); - tracingParameters.Add("softwareName", softwareName); - tracingParameters.Add("apiVersion", apiVersion); - 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/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/softwareInventories/{softwareName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{resourceNamespace}", System.Uri.EscapeDataString(resourceNamespace)); - _url = _url.Replace("{resourceType}", System.Uri.EscapeDataString(resourceType)); - _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); - _url = _url.Replace("{softwareName}", System.Uri.EscapeDataString(softwareName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets the software inventory of the virtual machine. - /// - /// - /// 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>> ListByExtendedResourceNextWithHttpMessagesAsync(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, "ListByExtendedResourceNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets the software inventory of all virtual machines in the subscriptions. - /// - /// - /// 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>> ListBySubscriptionNextWithHttpMessagesAsync(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, "ListBySubscriptionNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SoftwareInventoriesOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SoftwareInventoriesOperationsExtensions.cs deleted file mode 100644 index 622f67f67bc9..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SoftwareInventoriesOperationsExtensions.cs +++ /dev/null @@ -1,235 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for SoftwareInventoriesOperations. - /// - public static partial class SoftwareInventoriesOperationsExtensions - { - /// - /// Gets the software inventory of the virtual machine. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The namespace of the resource. - /// - /// - /// The type of the resource. - /// - /// - /// Name of the resource. - /// - public static IPage ListByExtendedResource(this ISoftwareInventoriesOperations operations, string resourceGroupName, string resourceNamespace, string resourceType, string resourceName) - { - return operations.ListByExtendedResourceAsync(resourceGroupName, resourceNamespace, resourceType, resourceName).GetAwaiter().GetResult(); - } - - /// - /// Gets the software inventory of the virtual machine. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The namespace of the resource. - /// - /// - /// The type of the resource. - /// - /// - /// Name of the resource. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByExtendedResourceAsync(this ISoftwareInventoriesOperations operations, string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByExtendedResourceWithHttpMessagesAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets the software inventory of all virtual machines in the subscriptions. - /// - /// - /// The operations group for this extension method. - /// - public static IPage ListBySubscription(this ISoftwareInventoriesOperations operations) - { - return operations.ListBySubscriptionAsync().GetAwaiter().GetResult(); - } - - /// - /// Gets the software inventory of all virtual machines in the subscriptions. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListBySubscriptionAsync(this ISoftwareInventoriesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets a single software data of the virtual machine. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The namespace of the resource. - /// - /// - /// The type of the resource. - /// - /// - /// Name of the resource. - /// - /// - /// Name of the installed software. - /// - public static Software Get(this ISoftwareInventoriesOperations operations, string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, string softwareName) - { - return operations.GetAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, softwareName).GetAwaiter().GetResult(); - } - - /// - /// Gets a single software data of the virtual machine. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// The namespace of the resource. - /// - /// - /// The type of the resource. - /// - /// - /// Name of the resource. - /// - /// - /// Name of the installed software. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this ISoftwareInventoriesOperations operations, string resourceGroupName, string resourceNamespace, string resourceType, string resourceName, string softwareName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, softwareName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets the software inventory of the virtual machine. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByExtendedResourceNext(this ISoftwareInventoriesOperations operations, string nextPageLink) - { - return operations.ListByExtendedResourceNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Gets the software inventory of the virtual machine. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByExtendedResourceNextAsync(this ISoftwareInventoriesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByExtendedResourceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets the software inventory of all virtual machines in the subscriptions. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListBySubscriptionNext(this ISoftwareInventoriesOperations operations, string nextPageLink) - { - return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Gets the software inventory of all virtual machines in the subscriptions. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListBySubscriptionNextAsync(this ISoftwareInventoriesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SqlVulnerabilityAssessmentBaselineRulesOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SqlVulnerabilityAssessmentBaselineRulesOperations.cs deleted file mode 100644 index a73d325a2059..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SqlVulnerabilityAssessmentBaselineRulesOperations.cs +++ /dev/null @@ -1,1094 +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.Security -{ - 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; - - /// - /// SqlVulnerabilityAssessmentBaselineRulesOperations operations. - /// - internal partial class SqlVulnerabilityAssessmentBaselineRulesOperations : IServiceOperations, ISqlVulnerabilityAssessmentBaselineRulesOperations - { - /// - /// Initializes a new instance of the SqlVulnerabilityAssessmentBaselineRulesOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal SqlVulnerabilityAssessmentBaselineRulesOperations(SecurityCenterClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SecurityCenterClient - /// - public SecurityCenterClient Client { get; private set; } - - /// - /// Creates a Baseline for a rule in a database. Will overwrite any previously - /// existing results. - /// - /// - /// The rule Id. - /// - /// - /// The workspace Id. - /// - /// - /// The api version. - /// - /// - /// The identifier of the resource. - /// - /// - /// Take results from latest scan. - /// - /// - /// Expected results to be inserted into the baseline. - /// Leave this field empty it LatestScan == true. - /// - /// - /// 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 ruleId, string workspaceId, string apiVersion, string resourceId, bool? latestScan = default(bool?), IList> results = default(IList>), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (ruleId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ruleId"); - } - if (workspaceId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "workspaceId"); - } - if (apiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "apiVersion"); - } - if (resourceId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceId"); - } - RuleResultsInput body = default(RuleResultsInput); - if (latestScan != null || results != null) - { - body = new RuleResultsInput(); - body.LatestScan = latestScan; - body.Results = results; - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("ruleId", ruleId); - tracingParameters.Add("workspaceId", workspaceId); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceId", resourceId); - tracingParameters.Add("body", body); - 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("/") ? "" : "/")), "{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}").ToString(); - _url = _url.Replace("{ruleId}", System.Uri.EscapeDataString(ruleId)); - _url = _url.Replace("{resourceId}", resourceId); - List _queryParameters = new List(); - if (workspaceId != null) - { - _queryParameters.Add(string.Format("workspaceId={0}", System.Uri.EscapeDataString(workspaceId))); - } - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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(body != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets the results for a given rule in the Baseline. - /// - /// - /// The rule Id. - /// - /// - /// The workspace Id. - /// - /// - /// The api version. - /// - /// - /// The identifier of the resource. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetWithHttpMessagesAsync(string ruleId, string workspaceId, string apiVersion, string resourceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (ruleId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ruleId"); - } - if (workspaceId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "workspaceId"); - } - if (apiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "apiVersion"); - } - if (resourceId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceId"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("ruleId", ruleId); - tracingParameters.Add("workspaceId", workspaceId); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceId", resourceId); - 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("/") ? "" : "/")), "{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}").ToString(); - _url = _url.Replace("{ruleId}", System.Uri.EscapeDataString(ruleId)); - _url = _url.Replace("{resourceId}", resourceId); - List _queryParameters = new List(); - if (workspaceId != null) - { - _queryParameters.Add(string.Format("workspaceId={0}", System.Uri.EscapeDataString(workspaceId))); - } - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Deletes a rule from the Baseline of a given database. - /// - /// - /// The rule Id. - /// - /// - /// The workspace Id. - /// - /// - /// The api version. - /// - /// - /// The identifier of the resource. - /// - /// - /// 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 ruleId, string workspaceId, string apiVersion, string resourceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (ruleId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ruleId"); - } - if (workspaceId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "workspaceId"); - } - if (apiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "apiVersion"); - } - if (resourceId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceId"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("ruleId", ruleId); - tracingParameters.Add("workspaceId", workspaceId); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceId", resourceId); - 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("/") ? "" : "/")), "{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}").ToString(); - _url = _url.Replace("{ruleId}", System.Uri.EscapeDataString(ruleId)); - _url = _url.Replace("{resourceId}", resourceId); - List _queryParameters = new List(); - if (workspaceId != null) - { - _queryParameters.Add(string.Format("workspaceId={0}", System.Uri.EscapeDataString(workspaceId))); - } - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 the results for all rules in the Baseline. - /// - /// - /// The workspace Id. - /// - /// - /// The api version. - /// - /// - /// The identifier of the resource. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> ListWithHttpMessagesAsync(string workspaceId, string apiVersion, string resourceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (workspaceId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "workspaceId"); - } - if (apiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "apiVersion"); - } - if (resourceId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceId"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("workspaceId", workspaceId); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceId", resourceId); - 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("/") ? "" : "/")), "{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules").ToString(); - _url = _url.Replace("{resourceId}", resourceId); - List _queryParameters = new List(); - if (workspaceId != null) - { - _queryParameters.Add(string.Format("workspaceId={0}", System.Uri.EscapeDataString(workspaceId))); - } - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Add a list of baseline rules. Will overwrite any previously existing - /// results (for all rules). - /// - /// - /// The workspace Id. - /// - /// - /// The api version. - /// - /// - /// The identifier of the resource. - /// - /// - /// Take results from latest scan. - /// - /// - /// Expected results to be inserted into the baseline. - /// Leave this field empty it LatestScan == true. - /// - /// - /// 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> AddWithHttpMessagesAsync(string workspaceId, string apiVersion, string resourceId, bool? latestScan = default(bool?), IDictionary>> results = default(IDictionary>>), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (workspaceId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "workspaceId"); - } - if (apiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "apiVersion"); - } - if (resourceId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceId"); - } - RulesResultsInput body = default(RulesResultsInput); - if (latestScan != null || results != null) - { - body = new RulesResultsInput(); - body.LatestScan = latestScan; - body.Results = results; - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("workspaceId", workspaceId); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceId", resourceId); - tracingParameters.Add("body", body); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Add", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules").ToString(); - _url = _url.Replace("{resourceId}", resourceId); - List _queryParameters = new List(); - if (workspaceId != null) - { - _queryParameters.Add(string.Format("workspaceId={0}", System.Uri.EscapeDataString(workspaceId))); - } - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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(body != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SqlVulnerabilityAssessmentBaselineRulesOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SqlVulnerabilityAssessmentBaselineRulesOperationsExtensions.cs deleted file mode 100644 index 0ed1ee0ba393..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SqlVulnerabilityAssessmentBaselineRulesOperationsExtensions.cs +++ /dev/null @@ -1,304 +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.Security -{ - 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 SqlVulnerabilityAssessmentBaselineRulesOperations. - /// - public static partial class SqlVulnerabilityAssessmentBaselineRulesOperationsExtensions - { - /// - /// Creates a Baseline for a rule in a database. Will overwrite any previously - /// existing results. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The rule Id. - /// - /// - /// The workspace Id. - /// - /// - /// The api version. - /// - /// - /// The identifier of the resource. - /// - /// - /// Take results from latest scan. - /// - /// - /// Expected results to be inserted into the baseline. - /// Leave this field empty it LatestScan == true. - /// - public static RuleResults CreateOrUpdate(this ISqlVulnerabilityAssessmentBaselineRulesOperations operations, string ruleId, string workspaceId, string apiVersion, string resourceId, bool? latestScan = default(bool?), IList> results = default(IList>)) - { - return operations.CreateOrUpdateAsync(ruleId, workspaceId, apiVersion, resourceId, latestScan, results).GetAwaiter().GetResult(); - } - - /// - /// Creates a Baseline for a rule in a database. Will overwrite any previously - /// existing results. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The rule Id. - /// - /// - /// The workspace Id. - /// - /// - /// The api version. - /// - /// - /// The identifier of the resource. - /// - /// - /// Take results from latest scan. - /// - /// - /// Expected results to be inserted into the baseline. - /// Leave this field empty it LatestScan == true. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this ISqlVulnerabilityAssessmentBaselineRulesOperations operations, string ruleId, string workspaceId, string apiVersion, string resourceId, bool? latestScan = default(bool?), IList> results = default(IList>), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(ruleId, workspaceId, apiVersion, resourceId, latestScan, results, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets the results for a given rule in the Baseline. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The rule Id. - /// - /// - /// The workspace Id. - /// - /// - /// The api version. - /// - /// - /// The identifier of the resource. - /// - public static RuleResults Get(this ISqlVulnerabilityAssessmentBaselineRulesOperations operations, string ruleId, string workspaceId, string apiVersion, string resourceId) - { - return operations.GetAsync(ruleId, workspaceId, apiVersion, resourceId).GetAwaiter().GetResult(); - } - - /// - /// Gets the results for a given rule in the Baseline. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The rule Id. - /// - /// - /// The workspace Id. - /// - /// - /// The api version. - /// - /// - /// The identifier of the resource. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this ISqlVulnerabilityAssessmentBaselineRulesOperations operations, string ruleId, string workspaceId, string apiVersion, string resourceId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(ruleId, workspaceId, apiVersion, resourceId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Deletes a rule from the Baseline of a given database. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The rule Id. - /// - /// - /// The workspace Id. - /// - /// - /// The api version. - /// - /// - /// The identifier of the resource. - /// - public static void Delete(this ISqlVulnerabilityAssessmentBaselineRulesOperations operations, string ruleId, string workspaceId, string apiVersion, string resourceId) - { - operations.DeleteAsync(ruleId, workspaceId, apiVersion, resourceId).GetAwaiter().GetResult(); - } - - /// - /// Deletes a rule from the Baseline of a given database. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The rule Id. - /// - /// - /// The workspace Id. - /// - /// - /// The api version. - /// - /// - /// The identifier of the resource. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this ISqlVulnerabilityAssessmentBaselineRulesOperations operations, string ruleId, string workspaceId, string apiVersion, string resourceId, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(ruleId, workspaceId, apiVersion, resourceId, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Gets the results for all rules in the Baseline. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace Id. - /// - /// - /// The api version. - /// - /// - /// The identifier of the resource. - /// - public static RulesResults List(this ISqlVulnerabilityAssessmentBaselineRulesOperations operations, string workspaceId, string apiVersion, string resourceId) - { - return operations.ListAsync(workspaceId, apiVersion, resourceId).GetAwaiter().GetResult(); - } - - /// - /// Gets the results for all rules in the Baseline. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace Id. - /// - /// - /// The api version. - /// - /// - /// The identifier of the resource. - /// - /// - /// The cancellation token. - /// - public static async Task ListAsync(this ISqlVulnerabilityAssessmentBaselineRulesOperations operations, string workspaceId, string apiVersion, string resourceId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(workspaceId, apiVersion, resourceId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Add a list of baseline rules. Will overwrite any previously existing - /// results (for all rules). - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace Id. - /// - /// - /// The api version. - /// - /// - /// The identifier of the resource. - /// - /// - /// Take results from latest scan. - /// - /// - /// Expected results to be inserted into the baseline. - /// Leave this field empty it LatestScan == true. - /// - public static RulesResults Add(this ISqlVulnerabilityAssessmentBaselineRulesOperations operations, string workspaceId, string apiVersion, string resourceId, bool? latestScan = default(bool?), IDictionary>> results = default(IDictionary>>)) - { - return operations.AddAsync(workspaceId, apiVersion, resourceId, latestScan, results).GetAwaiter().GetResult(); - } - - /// - /// Add a list of baseline rules. Will overwrite any previously existing - /// results (for all rules). - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace Id. - /// - /// - /// The api version. - /// - /// - /// The identifier of the resource. - /// - /// - /// Take results from latest scan. - /// - /// - /// Expected results to be inserted into the baseline. - /// Leave this field empty it LatestScan == true. - /// - /// - /// The cancellation token. - /// - public static async Task AddAsync(this ISqlVulnerabilityAssessmentBaselineRulesOperations operations, string workspaceId, string apiVersion, string resourceId, bool? latestScan = default(bool?), IDictionary>> results = default(IDictionary>>), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.AddWithHttpMessagesAsync(workspaceId, apiVersion, resourceId, latestScan, results, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SqlVulnerabilityAssessmentScanResultsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SqlVulnerabilityAssessmentScanResultsOperations.cs deleted file mode 100644 index 5a9f5d770742..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SqlVulnerabilityAssessmentScanResultsOperations.cs +++ /dev/null @@ -1,477 +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.Security -{ - 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; - - /// - /// SqlVulnerabilityAssessmentScanResultsOperations operations. - /// - internal partial class SqlVulnerabilityAssessmentScanResultsOperations : IServiceOperations, ISqlVulnerabilityAssessmentScanResultsOperations - { - /// - /// Initializes a new instance of the SqlVulnerabilityAssessmentScanResultsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal SqlVulnerabilityAssessmentScanResultsOperations(SecurityCenterClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SecurityCenterClient - /// - public SecurityCenterClient Client { get; private set; } - - /// - /// Gets the scan results of a single rule in a scan record. - /// - /// - /// The scan Id. Type 'latest' to get the scan results for the latest scan. - /// - /// - /// The rule Id of the results. - /// - /// - /// The workspace Id. - /// - /// - /// The api version. - /// - /// - /// The identifier of the resource. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetWithHttpMessagesAsync(string scanId, string scanResultId, string workspaceId, string apiVersion, string resourceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (scanId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scanId"); - } - if (scanResultId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scanResultId"); - } - if (workspaceId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "workspaceId"); - } - if (apiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "apiVersion"); - } - if (resourceId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceId"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("scanId", scanId); - tracingParameters.Add("scanResultId", scanResultId); - tracingParameters.Add("workspaceId", workspaceId); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceId", resourceId); - 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("/") ? "" : "/")), "{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId}/scanResults/{scanResultId}").ToString(); - _url = _url.Replace("{scanId}", System.Uri.EscapeDataString(scanId)); - _url = _url.Replace("{scanResultId}", System.Uri.EscapeDataString(scanResultId)); - _url = _url.Replace("{resourceId}", resourceId); - List _queryParameters = new List(); - if (workspaceId != null) - { - _queryParameters.Add(string.Format("workspaceId={0}", System.Uri.EscapeDataString(workspaceId))); - } - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets a list of scan results for a single scan record. - /// - /// - /// The scan Id. Type 'latest' to get the scan results for the latest scan. - /// - /// - /// The workspace Id. - /// - /// - /// The api version. - /// - /// - /// The identifier of the resource. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> ListWithHttpMessagesAsync(string scanId, string workspaceId, string apiVersion, string resourceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (scanId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scanId"); - } - if (workspaceId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "workspaceId"); - } - if (apiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "apiVersion"); - } - if (resourceId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceId"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("scanId", scanId); - tracingParameters.Add("workspaceId", workspaceId); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceId", resourceId); - 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("/") ? "" : "/")), "{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId}/scanResults").ToString(); - _url = _url.Replace("{scanId}", System.Uri.EscapeDataString(scanId)); - _url = _url.Replace("{resourceId}", resourceId); - List _queryParameters = new List(); - if (workspaceId != null) - { - _queryParameters.Add(string.Format("workspaceId={0}", System.Uri.EscapeDataString(workspaceId))); - } - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SqlVulnerabilityAssessmentScanResultsOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SqlVulnerabilityAssessmentScanResultsOperationsExtensions.cs deleted file mode 100644 index d8afab1ab968..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SqlVulnerabilityAssessmentScanResultsOperationsExtensions.cs +++ /dev/null @@ -1,135 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for SqlVulnerabilityAssessmentScanResultsOperations. - /// - public static partial class SqlVulnerabilityAssessmentScanResultsOperationsExtensions - { - /// - /// Gets the scan results of a single rule in a scan record. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The scan Id. Type 'latest' to get the scan results for the latest scan. - /// - /// - /// The rule Id of the results. - /// - /// - /// The workspace Id. - /// - /// - /// The api version. - /// - /// - /// The identifier of the resource. - /// - public static ScanResult Get(this ISqlVulnerabilityAssessmentScanResultsOperations operations, string scanId, string scanResultId, string workspaceId, string apiVersion, string resourceId) - { - return operations.GetAsync(scanId, scanResultId, workspaceId, apiVersion, resourceId).GetAwaiter().GetResult(); - } - - /// - /// Gets the scan results of a single rule in a scan record. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The scan Id. Type 'latest' to get the scan results for the latest scan. - /// - /// - /// The rule Id of the results. - /// - /// - /// The workspace Id. - /// - /// - /// The api version. - /// - /// - /// The identifier of the resource. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this ISqlVulnerabilityAssessmentScanResultsOperations operations, string scanId, string scanResultId, string workspaceId, string apiVersion, string resourceId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(scanId, scanResultId, workspaceId, apiVersion, resourceId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets a list of scan results for a single scan record. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The scan Id. Type 'latest' to get the scan results for the latest scan. - /// - /// - /// The workspace Id. - /// - /// - /// The api version. - /// - /// - /// The identifier of the resource. - /// - public static ScanResults List(this ISqlVulnerabilityAssessmentScanResultsOperations operations, string scanId, string workspaceId, string apiVersion, string resourceId) - { - return operations.ListAsync(scanId, workspaceId, apiVersion, resourceId).GetAwaiter().GetResult(); - } - - /// - /// Gets a list of scan results for a single scan record. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The scan Id. Type 'latest' to get the scan results for the latest scan. - /// - /// - /// The workspace Id. - /// - /// - /// The api version. - /// - /// - /// The identifier of the resource. - /// - /// - /// The cancellation token. - /// - public static async Task ListAsync(this ISqlVulnerabilityAssessmentScanResultsOperations operations, string scanId, string workspaceId, string apiVersion, string resourceId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(scanId, workspaceId, apiVersion, resourceId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SqlVulnerabilityAssessmentScansOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SqlVulnerabilityAssessmentScansOperations.cs deleted file mode 100644 index f7fa62fe09b8..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SqlVulnerabilityAssessmentScansOperations.cs +++ /dev/null @@ -1,459 +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.Security -{ - 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; - - /// - /// SqlVulnerabilityAssessmentScansOperations operations. - /// - internal partial class SqlVulnerabilityAssessmentScansOperations : IServiceOperations, ISqlVulnerabilityAssessmentScansOperations - { - /// - /// Initializes a new instance of the SqlVulnerabilityAssessmentScansOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal SqlVulnerabilityAssessmentScansOperations(SecurityCenterClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SecurityCenterClient - /// - public SecurityCenterClient Client { get; private set; } - - /// - /// Gets the scan details of a single scan record. - /// - /// - /// The scan Id. Type 'latest' to get the scan record for the latest scan. - /// - /// - /// The workspace Id. - /// - /// - /// The api version. - /// - /// - /// The identifier of the resource. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetWithHttpMessagesAsync(string scanId, string workspaceId, string apiVersion, string resourceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (scanId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scanId"); - } - if (workspaceId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "workspaceId"); - } - if (apiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "apiVersion"); - } - if (resourceId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceId"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("scanId", scanId); - tracingParameters.Add("workspaceId", workspaceId); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceId", resourceId); - 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("/") ? "" : "/")), "{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId}").ToString(); - _url = _url.Replace("{scanId}", System.Uri.EscapeDataString(scanId)); - _url = _url.Replace("{resourceId}", resourceId); - List _queryParameters = new List(); - if (workspaceId != null) - { - _queryParameters.Add(string.Format("workspaceId={0}", System.Uri.EscapeDataString(workspaceId))); - } - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets a list of scan records. - /// - /// - /// The workspace Id. - /// - /// - /// The api version. - /// - /// - /// The identifier of the resource. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> ListWithHttpMessagesAsync(string workspaceId, string apiVersion, string resourceId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (workspaceId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "workspaceId"); - } - if (apiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "apiVersion"); - } - if (resourceId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceId"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("workspaceId", workspaceId); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceId", resourceId); - 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("/") ? "" : "/")), "{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans").ToString(); - _url = _url.Replace("{resourceId}", resourceId); - List _queryParameters = new List(); - if (workspaceId != null) - { - _queryParameters.Add(string.Format("workspaceId={0}", System.Uri.EscapeDataString(workspaceId))); - } - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SqlVulnerabilityAssessmentScansOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SqlVulnerabilityAssessmentScansOperationsExtensions.cs deleted file mode 100644 index 43f7145dc144..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SqlVulnerabilityAssessmentScansOperationsExtensions.cs +++ /dev/null @@ -1,123 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for SqlVulnerabilityAssessmentScansOperations. - /// - public static partial class SqlVulnerabilityAssessmentScansOperationsExtensions - { - /// - /// Gets the scan details of a single scan record. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The scan Id. Type 'latest' to get the scan record for the latest scan. - /// - /// - /// The workspace Id. - /// - /// - /// The api version. - /// - /// - /// The identifier of the resource. - /// - public static Scan Get(this ISqlVulnerabilityAssessmentScansOperations operations, string scanId, string workspaceId, string apiVersion, string resourceId) - { - return operations.GetAsync(scanId, workspaceId, apiVersion, resourceId).GetAwaiter().GetResult(); - } - - /// - /// Gets the scan details of a single scan record. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The scan Id. Type 'latest' to get the scan record for the latest scan. - /// - /// - /// The workspace Id. - /// - /// - /// The api version. - /// - /// - /// The identifier of the resource. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this ISqlVulnerabilityAssessmentScansOperations operations, string scanId, string workspaceId, string apiVersion, string resourceId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(scanId, workspaceId, apiVersion, resourceId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets a list of scan records. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace Id. - /// - /// - /// The api version. - /// - /// - /// The identifier of the resource. - /// - public static Scans List(this ISqlVulnerabilityAssessmentScansOperations operations, string workspaceId, string apiVersion, string resourceId) - { - return operations.ListAsync(workspaceId, apiVersion, resourceId).GetAwaiter().GetResult(); - } - - /// - /// Gets a list of scan records. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace Id. - /// - /// - /// The api version. - /// - /// - /// The identifier of the resource. - /// - /// - /// The cancellation token. - /// - public static async Task ListAsync(this ISqlVulnerabilityAssessmentScansOperations operations, string workspaceId, string apiVersion, string resourceId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(workspaceId, apiVersion, resourceId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SubAssessmentsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SubAssessmentsOperations.cs deleted file mode 100644 index e5b502213ff3..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SubAssessmentsOperations.cs +++ /dev/null @@ -1,975 +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.Security -{ - 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; - - /// - /// SubAssessmentsOperations operations. - /// - internal partial class SubAssessmentsOperations : IServiceOperations, ISubAssessmentsOperations - { - /// - /// Initializes a new instance of the SubAssessmentsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal SubAssessmentsOperations(SecurityCenterClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SecurityCenterClient - /// - public SecurityCenterClient Client { get; private set; } - - /// - /// Get security sub-assessments on all your scanned resources inside a - /// subscription scope - /// - /// - /// Scope of the query, can be subscription - /// (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - /// (/providers/Microsoft.Management/managementGroups/mgName). - /// - /// - /// 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>> ListAllWithHttpMessagesAsync(string scope, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (scope == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scope"); - } - string apiVersion = "2019-01-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("scope", scope); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListAll", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.Security/subAssessments").ToString(); - _url = _url.Replace("{scope}", scope); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Get security sub-assessments on all your scanned resources inside a scope - /// - /// - /// Scope of the query, can be subscription - /// (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - /// (/providers/Microsoft.Management/managementGroups/mgName). - /// - /// - /// The Assessment Key - Unique key for the assessment type - /// - /// - /// 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 scope, string assessmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (scope == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scope"); - } - if (assessmentName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "assessmentName"); - } - string apiVersion = "2019-01-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("scope", scope); - tracingParameters.Add("assessmentName", assessmentName); - 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("/") ? "" : "/")), "{scope}/providers/Microsoft.Security/assessments/{assessmentName}/subAssessments").ToString(); - _url = _url.Replace("{scope}", scope); - _url = _url.Replace("{assessmentName}", System.Uri.EscapeDataString(assessmentName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Get a security sub-assessment on your scanned resource - /// - /// - /// Scope of the query, can be subscription - /// (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - /// (/providers/Microsoft.Management/managementGroups/mgName). - /// - /// - /// The Assessment Key - Unique key for the assessment type - /// - /// - /// The Sub-Assessment Key - Unique key for the sub-assessment type - /// - /// - /// 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 scope, string assessmentName, string subAssessmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (scope == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scope"); - } - if (assessmentName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "assessmentName"); - } - if (subAssessmentName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "subAssessmentName"); - } - string apiVersion = "2019-01-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("scope", scope); - tracingParameters.Add("assessmentName", assessmentName); - tracingParameters.Add("subAssessmentName", subAssessmentName); - 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("/") ? "" : "/")), "{scope}/providers/Microsoft.Security/assessments/{assessmentName}/subAssessments/{subAssessmentName}").ToString(); - _url = _url.Replace("{scope}", scope); - _url = _url.Replace("{assessmentName}", System.Uri.EscapeDataString(assessmentName)); - _url = _url.Replace("{subAssessmentName}", System.Uri.EscapeDataString(subAssessmentName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Get security sub-assessments on all your scanned resources inside a - /// subscription scope - /// - /// - /// 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>> ListAllNextWithHttpMessagesAsync(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, "ListAllNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Get security sub-assessments on all your scanned resources inside a scope - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SubAssessmentsOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SubAssessmentsOperationsExtensions.cs deleted file mode 100644 index afe53f2d6811..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SubAssessmentsOperationsExtensions.cs +++ /dev/null @@ -1,229 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for SubAssessmentsOperations. - /// - public static partial class SubAssessmentsOperationsExtensions - { - /// - /// Get security sub-assessments on all your scanned resources inside a - /// subscription scope - /// - /// - /// The operations group for this extension method. - /// - /// - /// Scope of the query, can be subscription - /// (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - /// (/providers/Microsoft.Management/managementGroups/mgName). - /// - public static IPage ListAll(this ISubAssessmentsOperations operations, string scope) - { - return operations.ListAllAsync(scope).GetAwaiter().GetResult(); - } - - /// - /// Get security sub-assessments on all your scanned resources inside a - /// subscription scope - /// - /// - /// The operations group for this extension method. - /// - /// - /// Scope of the query, can be subscription - /// (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - /// (/providers/Microsoft.Management/managementGroups/mgName). - /// - /// - /// The cancellation token. - /// - public static async Task> ListAllAsync(this ISubAssessmentsOperations operations, string scope, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListAllWithHttpMessagesAsync(scope, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get security sub-assessments on all your scanned resources inside a scope - /// - /// - /// The operations group for this extension method. - /// - /// - /// Scope of the query, can be subscription - /// (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - /// (/providers/Microsoft.Management/managementGroups/mgName). - /// - /// - /// The Assessment Key - Unique key for the assessment type - /// - public static IPage List(this ISubAssessmentsOperations operations, string scope, string assessmentName) - { - return operations.ListAsync(scope, assessmentName).GetAwaiter().GetResult(); - } - - /// - /// Get security sub-assessments on all your scanned resources inside a scope - /// - /// - /// The operations group for this extension method. - /// - /// - /// Scope of the query, can be subscription - /// (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - /// (/providers/Microsoft.Management/managementGroups/mgName). - /// - /// - /// The Assessment Key - Unique key for the assessment type - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this ISubAssessmentsOperations operations, string scope, string assessmentName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(scope, assessmentName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get a security sub-assessment on your scanned resource - /// - /// - /// The operations group for this extension method. - /// - /// - /// Scope of the query, can be subscription - /// (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - /// (/providers/Microsoft.Management/managementGroups/mgName). - /// - /// - /// The Assessment Key - Unique key for the assessment type - /// - /// - /// The Sub-Assessment Key - Unique key for the sub-assessment type - /// - public static SecuritySubAssessment Get(this ISubAssessmentsOperations operations, string scope, string assessmentName, string subAssessmentName) - { - return operations.GetAsync(scope, assessmentName, subAssessmentName).GetAwaiter().GetResult(); - } - - /// - /// Get a security sub-assessment on your scanned resource - /// - /// - /// The operations group for this extension method. - /// - /// - /// Scope of the query, can be subscription - /// (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group - /// (/providers/Microsoft.Management/managementGroups/mgName). - /// - /// - /// The Assessment Key - Unique key for the assessment type - /// - /// - /// The Sub-Assessment Key - Unique key for the sub-assessment type - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this ISubAssessmentsOperations operations, string scope, string assessmentName, string subAssessmentName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(scope, assessmentName, subAssessmentName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get security sub-assessments on all your scanned resources inside a - /// subscription scope - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListAllNext(this ISubAssessmentsOperations operations, string nextPageLink) - { - return operations.ListAllNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Get security sub-assessments on all your scanned resources inside a - /// subscription scope - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAllNextAsync(this ISubAssessmentsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListAllNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get security sub-assessments on all your scanned resources inside a scope - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this ISubAssessmentsOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Get security sub-assessments on all your scanned resources inside a scope - /// - /// - /// 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 ISubAssessmentsOperations 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/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/TasksOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/TasksOperations.cs deleted file mode 100644 index c987c9b3155a..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/TasksOperations.cs +++ /dev/null @@ -1,2007 +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.Security -{ - 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; - - /// - /// TasksOperations operations. - /// - internal partial class TasksOperations : IServiceOperations, ITasksOperations - { - /// - /// Initializes a new instance of the TasksOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal TasksOperations(SecurityCenterClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SecurityCenterClient - /// - public SecurityCenterClient Client { get; private set; } - - /// - /// Recommended tasks that will help improve the security of the subscription - /// proactively - /// - /// - /// OData filter. 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 filter = default(string), 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}$"); - } - } - string apiVersion = "2015-06-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("filter", filter); - 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}/providers/Microsoft.Security/tasks").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (filter != null) - { - _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); - } - 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; - } - - /// - /// Recommended tasks that will help improve the security of the subscription - /// proactively - /// - /// - /// OData filter. 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>> ListByHomeRegionWithHttpMessagesAsync(string filter = default(string), 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 (Client.AscLocation == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.AscLocation"); - } - string apiVersion = "2015-06-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("filter", filter); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByHomeRegion", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/tasks").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{ascLocation}", System.Uri.EscapeDataString(Client.AscLocation)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (filter != null) - { - _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); - } - 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; - } - - /// - /// Recommended tasks that will help improve the security of the subscription - /// proactively - /// - /// - /// Name of the task object, will be a 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> GetSubscriptionLevelTaskWithHttpMessagesAsync(string taskName, 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 (Client.AscLocation == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.AscLocation"); - } - if (taskName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "taskName"); - } - string apiVersion = "2015-06-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("taskName", taskName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetSubscriptionLevelTask", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{ascLocation}", System.Uri.EscapeDataString(Client.AscLocation)); - _url = _url.Replace("{taskName}", System.Uri.EscapeDataString(taskName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Recommended tasks that will help improve the security of the subscription - /// proactively - /// - /// - /// Name of the task object, will be a GUID - /// - /// - /// Type of the action to do on the task. Possible values include: 'Activate', - /// 'Dismiss', 'Start', 'Resolve', 'Close' - /// - /// - /// 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 UpdateSubscriptionLevelTaskStateWithHttpMessagesAsync(string taskName, string taskUpdateActionType, 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 (Client.AscLocation == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.AscLocation"); - } - if (taskName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "taskName"); - } - if (taskUpdateActionType == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "taskUpdateActionType"); - } - string apiVersion = "2015-06-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("taskName", taskName); - tracingParameters.Add("taskUpdateActionType", taskUpdateActionType); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "UpdateSubscriptionLevelTaskState", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}/{taskUpdateActionType}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{ascLocation}", System.Uri.EscapeDataString(Client.AscLocation)); - _url = _url.Replace("{taskName}", System.Uri.EscapeDataString(taskName)); - _url = _url.Replace("{taskUpdateActionType}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(taskUpdateActionType, Client.SerializationSettings).Trim('"'))); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 != 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; - } - - /// - /// Recommended tasks that will help improve the security of the subscription - /// proactively - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// OData filter. 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, string filter = default(string), 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 (Client.AscLocation == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.AscLocation"); - } - string apiVersion = "2015-06-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("filter", filter); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", 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.Security/locations/{ascLocation}/tasks").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{ascLocation}", System.Uri.EscapeDataString(Client.AscLocation)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (filter != null) - { - _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); - } - 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; - } - - /// - /// Recommended tasks that will help improve the security of the subscription - /// proactively - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// Name of the task object, will be a 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> GetResourceGroupLevelTaskWithHttpMessagesAsync(string resourceGroupName, string taskName, 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 (Client.AscLocation == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.AscLocation"); - } - if (taskName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "taskName"); - } - string apiVersion = "2015-06-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("taskName", taskName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetResourceGroupLevelTask", 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.Security/locations/{ascLocation}/tasks/{taskName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{ascLocation}", System.Uri.EscapeDataString(Client.AscLocation)); - _url = _url.Replace("{taskName}", System.Uri.EscapeDataString(taskName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Recommended tasks that will help improve the security of the subscription - /// proactively - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// Name of the task object, will be a GUID - /// - /// - /// Type of the action to do on the task. Possible values include: 'Activate', - /// 'Dismiss', 'Start', 'Resolve', 'Close' - /// - /// - /// 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 UpdateResourceGroupLevelTaskStateWithHttpMessagesAsync(string resourceGroupName, string taskName, string taskUpdateActionType, 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 (Client.AscLocation == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.AscLocation"); - } - if (taskName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "taskName"); - } - if (taskUpdateActionType == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "taskUpdateActionType"); - } - string apiVersion = "2015-06-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("taskName", taskName); - tracingParameters.Add("taskUpdateActionType", taskUpdateActionType); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "UpdateResourceGroupLevelTaskState", 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.Security/locations/{ascLocation}/tasks/{taskName}/{taskUpdateActionType}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{ascLocation}", System.Uri.EscapeDataString(Client.AscLocation)); - _url = _url.Replace("{taskName}", System.Uri.EscapeDataString(taskName)); - _url = _url.Replace("{taskUpdateActionType}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(taskUpdateActionType, Client.SerializationSettings).Trim('"'))); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 != 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; - } - - /// - /// Recommended tasks that will help improve the security of the subscription - /// proactively - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Recommended tasks that will help improve the security of the subscription - /// proactively - /// - /// - /// 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>> ListByHomeRegionNextWithHttpMessagesAsync(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, "ListByHomeRegionNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Recommended tasks that will help improve the security of the subscription - /// proactively - /// - /// - /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(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, "ListByResourceGroupNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/TasksOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/TasksOperationsExtensions.cs deleted file mode 100644 index 45a9bdd70a7b..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/TasksOperationsExtensions.cs +++ /dev/null @@ -1,419 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for TasksOperations. - /// - public static partial class TasksOperationsExtensions - { - /// - /// Recommended tasks that will help improve the security of the subscription - /// proactively - /// - /// - /// The operations group for this extension method. - /// - /// - /// OData filter. Optional. - /// - public static IPage List(this ITasksOperations operations, string filter = default(string)) - { - return operations.ListAsync(filter).GetAwaiter().GetResult(); - } - - /// - /// Recommended tasks that will help improve the security of the subscription - /// proactively - /// - /// - /// The operations group for this extension method. - /// - /// - /// OData filter. Optional. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this ITasksOperations operations, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(filter, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Recommended tasks that will help improve the security of the subscription - /// proactively - /// - /// - /// The operations group for this extension method. - /// - /// - /// OData filter. Optional. - /// - public static IPage ListByHomeRegion(this ITasksOperations operations, string filter = default(string)) - { - return operations.ListByHomeRegionAsync(filter).GetAwaiter().GetResult(); - } - - /// - /// Recommended tasks that will help improve the security of the subscription - /// proactively - /// - /// - /// The operations group for this extension method. - /// - /// - /// OData filter. Optional. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByHomeRegionAsync(this ITasksOperations operations, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByHomeRegionWithHttpMessagesAsync(filter, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Recommended tasks that will help improve the security of the subscription - /// proactively - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the task object, will be a GUID - /// - public static SecurityTask GetSubscriptionLevelTask(this ITasksOperations operations, string taskName) - { - return operations.GetSubscriptionLevelTaskAsync(taskName).GetAwaiter().GetResult(); - } - - /// - /// Recommended tasks that will help improve the security of the subscription - /// proactively - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the task object, will be a GUID - /// - /// - /// The cancellation token. - /// - public static async Task GetSubscriptionLevelTaskAsync(this ITasksOperations operations, string taskName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetSubscriptionLevelTaskWithHttpMessagesAsync(taskName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Recommended tasks that will help improve the security of the subscription - /// proactively - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the task object, will be a GUID - /// - /// - /// Type of the action to do on the task. Possible values include: 'Activate', - /// 'Dismiss', 'Start', 'Resolve', 'Close' - /// - public static void UpdateSubscriptionLevelTaskState(this ITasksOperations operations, string taskName, string taskUpdateActionType) - { - operations.UpdateSubscriptionLevelTaskStateAsync(taskName, taskUpdateActionType).GetAwaiter().GetResult(); - } - - /// - /// Recommended tasks that will help improve the security of the subscription - /// proactively - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the task object, will be a GUID - /// - /// - /// Type of the action to do on the task. Possible values include: 'Activate', - /// 'Dismiss', 'Start', 'Resolve', 'Close' - /// - /// - /// The cancellation token. - /// - public static async Task UpdateSubscriptionLevelTaskStateAsync(this ITasksOperations operations, string taskName, string taskUpdateActionType, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.UpdateSubscriptionLevelTaskStateWithHttpMessagesAsync(taskName, taskUpdateActionType, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Recommended tasks that will help improve the security of the subscription - /// proactively - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// OData filter. Optional. - /// - public static IPage ListByResourceGroup(this ITasksOperations operations, string resourceGroupName, string filter = default(string)) - { - return operations.ListByResourceGroupAsync(resourceGroupName, filter).GetAwaiter().GetResult(); - } - - /// - /// Recommended tasks that will help improve the security of the subscription - /// proactively - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// OData filter. Optional. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByResourceGroupAsync(this ITasksOperations operations, string resourceGroupName, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, filter, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Recommended tasks that will help improve the security of the subscription - /// proactively - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// Name of the task object, will be a GUID - /// - public static SecurityTask GetResourceGroupLevelTask(this ITasksOperations operations, string resourceGroupName, string taskName) - { - return operations.GetResourceGroupLevelTaskAsync(resourceGroupName, taskName).GetAwaiter().GetResult(); - } - - /// - /// Recommended tasks that will help improve the security of the subscription - /// proactively - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// Name of the task object, will be a GUID - /// - /// - /// The cancellation token. - /// - public static async Task GetResourceGroupLevelTaskAsync(this ITasksOperations operations, string resourceGroupName, string taskName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetResourceGroupLevelTaskWithHttpMessagesAsync(resourceGroupName, taskName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Recommended tasks that will help improve the security of the subscription - /// proactively - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// Name of the task object, will be a GUID - /// - /// - /// Type of the action to do on the task. Possible values include: 'Activate', - /// 'Dismiss', 'Start', 'Resolve', 'Close' - /// - public static void UpdateResourceGroupLevelTaskState(this ITasksOperations operations, string resourceGroupName, string taskName, string taskUpdateActionType) - { - operations.UpdateResourceGroupLevelTaskStateAsync(resourceGroupName, taskName, taskUpdateActionType).GetAwaiter().GetResult(); - } - - /// - /// Recommended tasks that will help improve the security of the subscription - /// proactively - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// Name of the task object, will be a GUID - /// - /// - /// Type of the action to do on the task. Possible values include: 'Activate', - /// 'Dismiss', 'Start', 'Resolve', 'Close' - /// - /// - /// The cancellation token. - /// - public static async Task UpdateResourceGroupLevelTaskStateAsync(this ITasksOperations operations, string resourceGroupName, string taskName, string taskUpdateActionType, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.UpdateResourceGroupLevelTaskStateWithHttpMessagesAsync(resourceGroupName, taskName, taskUpdateActionType, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Recommended tasks that will help improve the security of the subscription - /// proactively - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this ITasksOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Recommended tasks that will help improve the security of the subscription - /// proactively - /// - /// - /// 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 ITasksOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Recommended tasks that will help improve the security of the subscription - /// proactively - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByHomeRegionNext(this ITasksOperations operations, string nextPageLink) - { - return operations.ListByHomeRegionNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Recommended tasks that will help improve the security of the subscription - /// proactively - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByHomeRegionNextAsync(this ITasksOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByHomeRegionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Recommended tasks that will help improve the security of the subscription - /// proactively - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByResourceGroupNext(this ITasksOperations operations, string nextPageLink) - { - return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Recommended tasks that will help improve the security of the subscription - /// proactively - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByResourceGroupNextAsync(this ITasksOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/TopologyOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/TopologyOperations.cs deleted file mode 100644 index 4a971359baa8..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/TopologyOperations.cs +++ /dev/null @@ -1,995 +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.Security -{ - 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; - - /// - /// TopologyOperations operations. - /// - internal partial class TopologyOperations : IServiceOperations, ITopologyOperations - { - /// - /// Initializes a new instance of the TopologyOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal TopologyOperations(SecurityCenterClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SecurityCenterClient - /// - public SecurityCenterClient Client { get; private set; } - - /// - /// Gets a list that allows to build a topology view of a subscription. - /// - /// - /// 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(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}$"); - } - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - 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}/providers/Microsoft.Security/topologies").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets a list that allows to build a topology view of a subscription and - /// location. - /// - /// - /// 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>> ListByHomeRegionWithHttpMessagesAsync(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 (Client.AscLocation == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.AscLocation"); - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByHomeRegion", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/topologies").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{ascLocation}", System.Uri.EscapeDataString(Client.AscLocation)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets a specific topology component. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// Name of a topology resources collection. - /// - /// - /// 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 topologyResourceName, 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 (Client.AscLocation == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.AscLocation"); - } - if (topologyResourceName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "topologyResourceName"); - } - string apiVersion = "2020-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("topologyResourceName", topologyResourceName); - tracingParameters.Add("apiVersion", apiVersion); - 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.Security/locations/{ascLocation}/topologies/{topologyResourceName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{ascLocation}", System.Uri.EscapeDataString(Client.AscLocation)); - _url = _url.Replace("{topologyResourceName}", System.Uri.EscapeDataString(topologyResourceName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets a list that allows to build a topology view of a subscription. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets a list that allows to build a topology view of a subscription and - /// location. - /// - /// - /// 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>> ListByHomeRegionNextWithHttpMessagesAsync(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, "ListByHomeRegionNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/TopologyOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/TopologyOperationsExtensions.cs deleted file mode 100644 index a9873ee82612..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/TopologyOperationsExtensions.cs +++ /dev/null @@ -1,195 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for TopologyOperations. - /// - public static partial class TopologyOperationsExtensions - { - /// - /// Gets a list that allows to build a topology view of a subscription. - /// - /// - /// The operations group for this extension method. - /// - public static IPage List(this ITopologyOperations operations) - { - return operations.ListAsync().GetAwaiter().GetResult(); - } - - /// - /// Gets a list that allows to build a topology view of a subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this ITopologyOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets a list that allows to build a topology view of a subscription and - /// location. - /// - /// - /// The operations group for this extension method. - /// - public static IPage ListByHomeRegion(this ITopologyOperations operations) - { - return operations.ListByHomeRegionAsync().GetAwaiter().GetResult(); - } - - /// - /// Gets a list that allows to build a topology view of a subscription and - /// location. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByHomeRegionAsync(this ITopologyOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByHomeRegionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets a specific topology component. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// Name of a topology resources collection. - /// - public static TopologyResource Get(this ITopologyOperations operations, string resourceGroupName, string topologyResourceName) - { - return operations.GetAsync(resourceGroupName, topologyResourceName).GetAwaiter().GetResult(); - } - - /// - /// Gets a specific topology component. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group within the user's subscription. The name is - /// case insensitive. - /// - /// - /// Name of a topology resources collection. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this ITopologyOperations operations, string resourceGroupName, string topologyResourceName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, topologyResourceName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets a list that allows to build a topology view of a subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this ITopologyOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Gets a list that allows to build a topology view of a subscription. - /// - /// - /// 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 ITopologyOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets a list that allows to build a topology view of a subscription and - /// location. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByHomeRegionNext(this ITopologyOperations operations, string nextPageLink) - { - return operations.ListByHomeRegionNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Gets a list that allows to build a topology view of a subscription and - /// location. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByHomeRegionNextAsync(this ITopologyOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByHomeRegionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/WorkspaceSettingsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/WorkspaceSettingsOperations.cs deleted file mode 100644 index e3a984e5f273..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/WorkspaceSettingsOperations.cs +++ /dev/null @@ -1,1217 +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.Security -{ - 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; - - /// - /// WorkspaceSettingsOperations operations. - /// - internal partial class WorkspaceSettingsOperations : IServiceOperations, IWorkspaceSettingsOperations - { - /// - /// Initializes a new instance of the WorkspaceSettingsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal WorkspaceSettingsOperations(SecurityCenterClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the SecurityCenterClient - /// - public SecurityCenterClient Client { get; private set; } - - /// - /// Settings about where we should store your security data and logs. If the - /// result is empty, it means that no custom-workspace configuration was set - /// - /// - /// 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(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}$"); - } - } - string apiVersion = "2017-08-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - 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}/providers/Microsoft.Security/workspaceSettings").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// Settings about where we should store your security data and logs. If the - /// result is empty, it means that no custom-workspace configuration was set - /// - /// - /// Name of the security setting - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetWithHttpMessagesAsync(string workspaceSettingName, 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 (workspaceSettingName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "workspaceSettingName"); - } - string apiVersion = "2017-08-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("workspaceSettingName", workspaceSettingName); - 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}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{workspaceSettingName}", System.Uri.EscapeDataString(workspaceSettingName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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; - } - - /// - /// creating settings about where we should store your security data and logs - /// - /// - /// Name of the security setting - /// - /// - /// The full Azure ID of the workspace to save the data in - /// - /// - /// All the VMs in this scope will send their security data to the mentioned - /// workspace unless overridden by a setting with more specific scope - /// - /// - /// 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 workspaceSettingName, string workspaceId, string scope, 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 (workspaceSettingName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "workspaceSettingName"); - } - if (workspaceId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "workspaceId"); - } - if (scope == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scope"); - } - string apiVersion = "2017-08-01-preview"; - WorkspaceSetting workspaceSetting = new WorkspaceSetting(); - if (workspaceId != null || scope != null) - { - workspaceSetting.WorkspaceId = workspaceId; - workspaceSetting.Scope = scope; - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("workspaceSettingName", workspaceSettingName); - tracingParameters.Add("workspaceSetting", workspaceSetting); - 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}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{workspaceSettingName}", System.Uri.EscapeDataString(workspaceSettingName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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(workspaceSetting != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(workspaceSetting, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Settings about where we should store your security data and logs - /// - /// - /// Name of the security setting - /// - /// - /// The full Azure ID of the workspace to save the data in - /// - /// - /// All the VMs in this scope will send their security data to the mentioned - /// workspace unless overridden by a setting with more specific scope - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> UpdateWithHttpMessagesAsync(string workspaceSettingName, string workspaceId, string scope, 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 (workspaceSettingName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "workspaceSettingName"); - } - if (workspaceId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "workspaceId"); - } - if (scope == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scope"); - } - string apiVersion = "2017-08-01-preview"; - WorkspaceSetting workspaceSetting = new WorkspaceSetting(); - if (workspaceId != null || scope != null) - { - workspaceSetting.WorkspaceId = workspaceId; - workspaceSetting.Scope = scope; - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("workspaceSettingName", workspaceSettingName); - tracingParameters.Add("workspaceSetting", workspaceSetting); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{workspaceSettingName}", System.Uri.EscapeDataString(workspaceSettingName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PATCH"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(workspaceSetting != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(workspaceSetting, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Deletes the custom workspace settings for this subscription. new VMs will - /// report to the default workspace - /// - /// - /// Name of the security setting - /// - /// - /// 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 workspaceSettingName, 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 (workspaceSettingName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "workspaceSettingName"); - } - string apiVersion = "2017-08-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("workspaceSettingName", workspaceSettingName); - 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}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{workspaceSettingName}", System.Uri.EscapeDataString(workspaceSettingName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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 != 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; - } - - /// - /// Settings about where we should store your security data and logs. If the - /// result is empty, it means that no custom-workspace configuration was set - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/WorkspaceSettingsOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/WorkspaceSettingsOperationsExtensions.cs deleted file mode 100644 index 76e7b53a84ac..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/WorkspaceSettingsOperationsExtensions.cs +++ /dev/null @@ -1,256 +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.Security -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for WorkspaceSettingsOperations. - /// - public static partial class WorkspaceSettingsOperationsExtensions - { - /// - /// Settings about where we should store your security data and logs. If the - /// result is empty, it means that no custom-workspace configuration was set - /// - /// - /// The operations group for this extension method. - /// - public static IPage List(this IWorkspaceSettingsOperations operations) - { - return operations.ListAsync().GetAwaiter().GetResult(); - } - - /// - /// Settings about where we should store your security data and logs. If the - /// result is empty, it means that no custom-workspace configuration was set - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IWorkspaceSettingsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Settings about where we should store your security data and logs. If the - /// result is empty, it means that no custom-workspace configuration was set - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the security setting - /// - public static WorkspaceSetting Get(this IWorkspaceSettingsOperations operations, string workspaceSettingName) - { - return operations.GetAsync(workspaceSettingName).GetAwaiter().GetResult(); - } - - /// - /// Settings about where we should store your security data and logs. If the - /// result is empty, it means that no custom-workspace configuration was set - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the security setting - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IWorkspaceSettingsOperations operations, string workspaceSettingName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(workspaceSettingName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// creating settings about where we should store your security data and logs - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the security setting - /// - /// - /// The full Azure ID of the workspace to save the data in - /// - /// - /// All the VMs in this scope will send their security data to the mentioned - /// workspace unless overridden by a setting with more specific scope - /// - public static WorkspaceSetting Create(this IWorkspaceSettingsOperations operations, string workspaceSettingName, string workspaceId, string scope) - { - return operations.CreateAsync(workspaceSettingName, workspaceId, scope).GetAwaiter().GetResult(); - } - - /// - /// creating settings about where we should store your security data and logs - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the security setting - /// - /// - /// The full Azure ID of the workspace to save the data in - /// - /// - /// All the VMs in this scope will send their security data to the mentioned - /// workspace unless overridden by a setting with more specific scope - /// - /// - /// The cancellation token. - /// - public static async Task CreateAsync(this IWorkspaceSettingsOperations operations, string workspaceSettingName, string workspaceId, string scope, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateWithHttpMessagesAsync(workspaceSettingName, workspaceId, scope, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Settings about where we should store your security data and logs - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the security setting - /// - /// - /// The full Azure ID of the workspace to save the data in - /// - /// - /// All the VMs in this scope will send their security data to the mentioned - /// workspace unless overridden by a setting with more specific scope - /// - public static WorkspaceSetting Update(this IWorkspaceSettingsOperations operations, string workspaceSettingName, string workspaceId, string scope) - { - return operations.UpdateAsync(workspaceSettingName, workspaceId, scope).GetAwaiter().GetResult(); - } - - /// - /// Settings about where we should store your security data and logs - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the security setting - /// - /// - /// The full Azure ID of the workspace to save the data in - /// - /// - /// All the VMs in this scope will send their security data to the mentioned - /// workspace unless overridden by a setting with more specific scope - /// - /// - /// The cancellation token. - /// - public static async Task UpdateAsync(this IWorkspaceSettingsOperations operations, string workspaceSettingName, string workspaceId, string scope, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.UpdateWithHttpMessagesAsync(workspaceSettingName, workspaceId, scope, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Deletes the custom workspace settings for this subscription. new VMs will - /// report to the default workspace - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the security setting - /// - public static void Delete(this IWorkspaceSettingsOperations operations, string workspaceSettingName) - { - operations.DeleteAsync(workspaceSettingName).GetAwaiter().GetResult(); - } - - /// - /// Deletes the custom workspace settings for this subscription. new VMs will - /// report to the default workspace - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the security setting - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IWorkspaceSettingsOperations operations, string workspaceSettingName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(workspaceSettingName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Settings about where we should store your security data and logs. If the - /// result is empty, it means that no custom-workspace configuration was set - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IWorkspaceSettingsOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Settings about where we should store your security data and logs. If the - /// result is empty, it means that no custom-workspace configuration was set - /// - /// - /// 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 IWorkspaceSettingsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -}