diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/AzSdk.RP.props b/src/SDKs/Security/Management.Security/AzSdk.RP.props similarity index 84% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/AzSdk.RP.props rename to src/SDKs/Security/Management.Security/AzSdk.RP.props index 7fb641c302de..74aa43f2c763 100644 --- a/src/SDKs/SecurityCenter/Management.SecurityCenter/AzSdk.RP.props +++ b/src/SDKs/Security/Management.Security/AzSdk.RP.props @@ -1,7 +1,7 @@ - - - - Security_2015-06-01-preview;Security_2017-08-01-preview; - $(PackageTags);$(CommonTags);$(AzureApiTag); - + + + + Security_2017-08-01-preview;Security_2015-06-01-preview; + $(PackageTags);$(CommonTags);$(AzureApiTag); + \ No newline at end of file diff --git a/src/SDKs/Security/Management.Security/Generated/AdvancedThreatProtectionOperations.cs b/src/SDKs/Security/Management.Security/Generated/AdvancedThreatProtectionOperations.cs new file mode 100644 index 000000000000..f41a9c7100d0 --- /dev/null +++ b/src/SDKs/Security/Management.Security/Generated/AdvancedThreatProtectionOperations.cs @@ -0,0 +1,436 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by 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 = "2017-08-01-preview"; + 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}", System.Uri.EscapeDataString(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 = "2017-08-01-preview"; + 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}", System.Uri.EscapeDataString(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/src/SDKs/Security/Management.Security/Generated/AdvancedThreatProtectionOperationsExtensions.cs b/src/SDKs/Security/Management.Security/Generated/AdvancedThreatProtectionOperationsExtensions.cs new file mode 100644 index 000000000000..6781f07eda08 --- /dev/null +++ b/src/SDKs/Security/Management.Security/Generated/AdvancedThreatProtectionOperationsExtensions.cs @@ -0,0 +1,101 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by 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/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/AlertsOperations.cs b/src/SDKs/Security/Management.Security/Generated/AlertsOperations.cs similarity index 99% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/AlertsOperations.cs rename to src/SDKs/Security/Management.Security/Generated/AlertsOperations.cs index 2f1403fbafe7..027705b97c52 100644 --- a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/AlertsOperations.cs +++ b/src/SDKs/Security/Management.Security/Generated/AlertsOperations.cs @@ -1433,7 +1433,7 @@ internal AlertsOperations(SecurityCenterClient client) _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("{alertUpdateActionType}", System.Uri.EscapeDataString(alertUpdateActionType)); + _url = _url.Replace("{alertUpdateActionType}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(alertUpdateActionType, Client.SerializationSettings).Trim('"'))); List _queryParameters = new List(); if (apiVersion != null) { @@ -1643,7 +1643,7 @@ internal AlertsOperations(SecurityCenterClient client) _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("{alertUpdateActionType}", System.Uri.EscapeDataString(alertUpdateActionType)); + _url = _url.Replace("{alertUpdateActionType}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(alertUpdateActionType, Client.SerializationSettings).Trim('"'))); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); List _queryParameters = new List(); if (apiVersion != null) diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/AlertsOperationsExtensions.cs b/src/SDKs/Security/Management.Security/Generated/AlertsOperationsExtensions.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/AlertsOperationsExtensions.cs rename to src/SDKs/Security/Management.Security/Generated/AlertsOperationsExtensions.cs diff --git a/src/SDKs/Security/Management.Security/Generated/AllowedConnectionsOperations.cs b/src/SDKs/Security/Management.Security/Generated/AllowedConnectionsOperations.cs new file mode 100644 index 000000000000..b71a319d63c6 --- /dev/null +++ b/src/SDKs/Security/Management.Security/Generated/AllowedConnectionsOperations.cs @@ -0,0 +1,999 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by 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 = "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/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 = "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, "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 = "2015-06-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("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/src/SDKs/Security/Management.Security/Generated/AllowedConnectionsOperationsExtensions.cs b/src/SDKs/Security/Management.Security/Generated/AllowedConnectionsOperationsExtensions.cs new file mode 100644 index 000000000000..e28c1214a53d --- /dev/null +++ b/src/SDKs/Security/Management.Security/Generated/AllowedConnectionsOperationsExtensions.cs @@ -0,0 +1,203 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by 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/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/AutoProvisioningSettingsOperations.cs b/src/SDKs/Security/Management.Security/Generated/AutoProvisioningSettingsOperations.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/AutoProvisioningSettingsOperations.cs rename to src/SDKs/Security/Management.Security/Generated/AutoProvisioningSettingsOperations.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/AutoProvisioningSettingsOperationsExtensions.cs b/src/SDKs/Security/Management.Security/Generated/AutoProvisioningSettingsOperationsExtensions.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/AutoProvisioningSettingsOperationsExtensions.cs rename to src/SDKs/Security/Management.Security/Generated/AutoProvisioningSettingsOperationsExtensions.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/CompliancesOperations.cs b/src/SDKs/Security/Management.Security/Generated/CompliancesOperations.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/CompliancesOperations.cs rename to src/SDKs/Security/Management.Security/Generated/CompliancesOperations.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/CompliancesOperationsExtensions.cs b/src/SDKs/Security/Management.Security/Generated/CompliancesOperationsExtensions.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/CompliancesOperationsExtensions.cs rename to src/SDKs/Security/Management.Security/Generated/CompliancesOperationsExtensions.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/DiscoveredSecuritySolutionsOperations.cs b/src/SDKs/Security/Management.Security/Generated/DiscoveredSecuritySolutionsOperations.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/DiscoveredSecuritySolutionsOperations.cs rename to src/SDKs/Security/Management.Security/Generated/DiscoveredSecuritySolutionsOperations.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/DiscoveredSecuritySolutionsOperationsExtensions.cs b/src/SDKs/Security/Management.Security/Generated/DiscoveredSecuritySolutionsOperationsExtensions.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/DiscoveredSecuritySolutionsOperationsExtensions.cs rename to src/SDKs/Security/Management.Security/Generated/DiscoveredSecuritySolutionsOperationsExtensions.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/ExternalSecuritySolutionsOperations.cs b/src/SDKs/Security/Management.Security/Generated/ExternalSecuritySolutionsOperations.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/ExternalSecuritySolutionsOperations.cs rename to src/SDKs/Security/Management.Security/Generated/ExternalSecuritySolutionsOperations.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/ExternalSecuritySolutionsOperationsExtensions.cs b/src/SDKs/Security/Management.Security/Generated/ExternalSecuritySolutionsOperationsExtensions.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/ExternalSecuritySolutionsOperationsExtensions.cs rename to src/SDKs/Security/Management.Security/Generated/ExternalSecuritySolutionsOperationsExtensions.cs diff --git a/src/SDKs/Security/Management.Security/Generated/IAdvancedThreatProtectionOperations.cs b/src/SDKs/Security/Management.Security/Generated/IAdvancedThreatProtectionOperations.cs new file mode 100644 index 000000000000..c87519d2675f --- /dev/null +++ b/src/SDKs/Security/Management.Security/Generated/IAdvancedThreatProtectionOperations.cs @@ -0,0 +1,76 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.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/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/IAlertsOperations.cs b/src/SDKs/Security/Management.Security/Generated/IAlertsOperations.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/IAlertsOperations.cs rename to src/SDKs/Security/Management.Security/Generated/IAlertsOperations.cs diff --git a/src/SDKs/Security/Management.Security/Generated/IAllowedConnectionsOperations.cs b/src/SDKs/Security/Management.Security/Generated/IAllowedConnectionsOperations.cs new file mode 100644 index 000000000000..3dbfd8bc6b6f --- /dev/null +++ b/src/SDKs/Security/Management.Security/Generated/IAllowedConnectionsOperations.cs @@ -0,0 +1,141 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by 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/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/IAutoProvisioningSettingsOperations.cs b/src/SDKs/Security/Management.Security/Generated/IAutoProvisioningSettingsOperations.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/IAutoProvisioningSettingsOperations.cs rename to src/SDKs/Security/Management.Security/Generated/IAutoProvisioningSettingsOperations.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/ICompliancesOperations.cs b/src/SDKs/Security/Management.Security/Generated/ICompliancesOperations.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/ICompliancesOperations.cs rename to src/SDKs/Security/Management.Security/Generated/ICompliancesOperations.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/IDiscoveredSecuritySolutionsOperations.cs b/src/SDKs/Security/Management.Security/Generated/IDiscoveredSecuritySolutionsOperations.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/IDiscoveredSecuritySolutionsOperations.cs rename to src/SDKs/Security/Management.Security/Generated/IDiscoveredSecuritySolutionsOperations.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/IExternalSecuritySolutionsOperations.cs b/src/SDKs/Security/Management.Security/Generated/IExternalSecuritySolutionsOperations.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/IExternalSecuritySolutionsOperations.cs rename to src/SDKs/Security/Management.Security/Generated/IExternalSecuritySolutionsOperations.cs diff --git a/src/SDKs/Security/Management.Security/Generated/IInformationProtectionPoliciesOperations.cs b/src/SDKs/Security/Management.Security/Generated/IInformationProtectionPoliciesOperations.cs new file mode 100644 index 000000000000..0a77a1f39dbc --- /dev/null +++ b/src/SDKs/Security/Management.Security/Generated/IInformationProtectionPoliciesOperations.cs @@ -0,0 +1,129 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.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' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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, 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/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/IJitNetworkAccessPoliciesOperations.cs b/src/SDKs/Security/Management.Security/Generated/IJitNetworkAccessPoliciesOperations.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/IJitNetworkAccessPoliciesOperations.cs rename to src/SDKs/Security/Management.Security/Generated/IJitNetworkAccessPoliciesOperations.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/ILocationsOperations.cs b/src/SDKs/Security/Management.Security/Generated/ILocationsOperations.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/ILocationsOperations.cs rename to src/SDKs/Security/Management.Security/Generated/ILocationsOperations.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/IOperations.cs b/src/SDKs/Security/Management.Security/Generated/IOperations.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/IOperations.cs rename to src/SDKs/Security/Management.Security/Generated/IOperations.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/IPricingsOperations.cs b/src/SDKs/Security/Management.Security/Generated/IPricingsOperations.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/IPricingsOperations.cs rename to src/SDKs/Security/Management.Security/Generated/IPricingsOperations.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/ISecurityCenterClient.cs b/src/SDKs/Security/Management.Security/Generated/ISecurityCenterClient.cs similarity index 76% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/ISecurityCenterClient.cs rename to src/SDKs/Security/Management.Security/Generated/ISecurityCenterClient.cs index 81a2e07411f8..ade7a7709bab 100644 --- a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/ISecurityCenterClient.cs +++ b/src/SDKs/Security/Management.Security/Generated/ISecurityCenterClient.cs @@ -53,19 +53,20 @@ public partial interface ISecurityCenterClient : System.IDisposable string AscLocation { get; set; } /// - /// Gets or sets the preferred language for the response. + /// The preferred language for the response. /// string AcceptLanguage { get; set; } /// - /// Gets or sets the retry timeout in seconds for Long Running - /// Operations. Default value is 30. + /// The retry timeout in seconds for Long Running Operations. Default + /// value is 30. /// int? LongRunningOperationRetryTimeout { get; set; } /// - /// When set to true a unique x-ms-client-request-id value is generated - /// and included in each request. Default is true. + /// Whether a unique x-ms-client-request-id should be generated. When + /// set to true a unique x-ms-client-request-id value is generated and + /// included in each request. Default is true. /// bool? GenerateClientRequestId { get; set; } @@ -95,6 +96,21 @@ public partial interface ISecurityCenterClient : System.IDisposable /// ICompliancesOperations Compliances { get; } + /// + /// Gets the IAdvancedThreatProtectionOperations. + /// + IAdvancedThreatProtectionOperations AdvancedThreatProtection { get; } + + /// + /// Gets the ISettingsOperations. + /// + ISettingsOperations Settings { get; } + + /// + /// Gets the IInformationProtectionPoliciesOperations. + /// + IInformationProtectionPoliciesOperations InformationProtectionPolicies { get; } + /// /// Gets the IOperations. /// @@ -130,5 +146,15 @@ public partial interface ISecurityCenterClient : System.IDisposable /// IExternalSecuritySolutionsOperations ExternalSecuritySolutions { get; } + /// + /// Gets the ITopologyOperations. + /// + ITopologyOperations Topology { get; } + + /// + /// Gets the IAllowedConnectionsOperations. + /// + IAllowedConnectionsOperations AllowedConnections { get; } + } } diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/ISecurityContactsOperations.cs b/src/SDKs/Security/Management.Security/Generated/ISecurityContactsOperations.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/ISecurityContactsOperations.cs rename to src/SDKs/Security/Management.Security/Generated/ISecurityContactsOperations.cs diff --git a/src/SDKs/Security/Management.Security/Generated/ISettingsOperations.cs b/src/SDKs/Security/Management.Security/Generated/ISettingsOperations.cs new file mode 100644 index 000000000000..67167cdf195f --- /dev/null +++ b/src/SDKs/Security/Management.Security/Generated/ISettingsOperations.cs @@ -0,0 +1,115 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.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 + /// + /// + /// Name of setting. Possible values include: 'MCAS', 'WDATP' + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 + /// + /// + /// Name of setting. Possible values include: 'MCAS', 'WDATP' + /// + /// + /// 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/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/ITasksOperations.cs b/src/SDKs/Security/Management.Security/Generated/ITasksOperations.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/ITasksOperations.cs rename to src/SDKs/Security/Management.Security/Generated/ITasksOperations.cs diff --git a/src/SDKs/Security/Management.Security/Generated/ITopologyOperations.cs b/src/SDKs/Security/Management.Security/Generated/ITopologyOperations.cs new file mode 100644 index 000000000000..064b65cd1f7e --- /dev/null +++ b/src/SDKs/Security/Management.Security/Generated/ITopologyOperations.cs @@ -0,0 +1,137 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.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/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/IWorkspaceSettingsOperations.cs b/src/SDKs/Security/Management.Security/Generated/IWorkspaceSettingsOperations.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/IWorkspaceSettingsOperations.cs rename to src/SDKs/Security/Management.Security/Generated/IWorkspaceSettingsOperations.cs diff --git a/src/SDKs/Security/Management.Security/Generated/InformationProtectionPoliciesOperations.cs b/src/SDKs/Security/Management.Security/Generated/InformationProtectionPoliciesOperations.cs new file mode 100644 index 000000000000..36f19cf2cc87 --- /dev/null +++ b/src/SDKs/Security/Management.Security/Generated/InformationProtectionPoliciesOperations.cs @@ -0,0 +1,811 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by 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}", System.Uri.EscapeDataString(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' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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, 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, "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}", System.Uri.EscapeDataString(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; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.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}", System.Uri.EscapeDataString(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/src/SDKs/Security/Management.Security/Generated/InformationProtectionPoliciesOperationsExtensions.cs b/src/SDKs/Security/Management.Security/Generated/InformationProtectionPoliciesOperationsExtensions.cs new file mode 100644 index 000000000000..af9ee2443fc3 --- /dev/null +++ b/src/SDKs/Security/Management.Security/Generated/InformationProtectionPoliciesOperationsExtensions.cs @@ -0,0 +1,189 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by 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 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' + /// + public static InformationProtectionPolicy CreateOrUpdate(this IInformationProtectionPoliciesOperations operations, string scope, string informationProtectionPolicyName) + { + return operations.CreateOrUpdateAsync(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 CreateOrUpdateAsync(this IInformationProtectionPoliciesOperations operations, string scope, string informationProtectionPolicyName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(scope, informationProtectionPolicyName, 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/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/JitNetworkAccessPoliciesOperations.cs b/src/SDKs/Security/Management.Security/Generated/JitNetworkAccessPoliciesOperations.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/JitNetworkAccessPoliciesOperations.cs rename to src/SDKs/Security/Management.Security/Generated/JitNetworkAccessPoliciesOperations.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/JitNetworkAccessPoliciesOperationsExtensions.cs b/src/SDKs/Security/Management.Security/Generated/JitNetworkAccessPoliciesOperationsExtensions.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/JitNetworkAccessPoliciesOperationsExtensions.cs rename to src/SDKs/Security/Management.Security/Generated/JitNetworkAccessPoliciesOperationsExtensions.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/LocationsOperations.cs b/src/SDKs/Security/Management.Security/Generated/LocationsOperations.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/LocationsOperations.cs rename to src/SDKs/Security/Management.Security/Generated/LocationsOperations.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/LocationsOperationsExtensions.cs b/src/SDKs/Security/Management.Security/Generated/LocationsOperationsExtensions.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/LocationsOperationsExtensions.cs rename to src/SDKs/Security/Management.Security/Generated/LocationsOperationsExtensions.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/AadConnectivityState.cs b/src/SDKs/Security/Management.Security/Generated/Models/AadConnectivityState.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/AadConnectivityState.cs rename to src/SDKs/Security/Management.Security/Generated/Models/AadConnectivityState.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/AadConnectivityState1.cs b/src/SDKs/Security/Management.Security/Generated/Models/AadConnectivityState1.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/AadConnectivityState1.cs rename to src/SDKs/Security/Management.Security/Generated/Models/AadConnectivityState1.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/AadExternalSecuritySolution.cs b/src/SDKs/Security/Management.Security/Generated/Models/AadExternalSecuritySolution.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/AadExternalSecuritySolution.cs rename to src/SDKs/Security/Management.Security/Generated/Models/AadExternalSecuritySolution.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/AadSolutionProperties.cs b/src/SDKs/Security/Management.Security/Generated/Models/AadSolutionProperties.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/AadSolutionProperties.cs rename to src/SDKs/Security/Management.Security/Generated/Models/AadSolutionProperties.cs diff --git a/src/SDKs/Security/Management.Security/Generated/Models/AdvancedThreatProtectionSetting.cs b/src/SDKs/Security/Management.Security/Generated/Models/AdvancedThreatProtectionSetting.cs new file mode 100644 index 000000000000..fac496f0f512 --- /dev/null +++ b/src/SDKs/Security/Management.Security/Generated/Models/AdvancedThreatProtectionSetting.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.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/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/Alert.cs b/src/SDKs/Security/Management.Security/Generated/Models/Alert.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/Alert.cs rename to src/SDKs/Security/Management.Security/Generated/Models/Alert.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/AlertConfidenceReason.cs b/src/SDKs/Security/Management.Security/Generated/Models/AlertConfidenceReason.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/AlertConfidenceReason.cs rename to src/SDKs/Security/Management.Security/Generated/Models/AlertConfidenceReason.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/AlertEntity.cs b/src/SDKs/Security/Management.Security/Generated/Models/AlertEntity.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/AlertEntity.cs rename to src/SDKs/Security/Management.Security/Generated/Models/AlertEntity.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/AlertNotifications.cs b/src/SDKs/Security/Management.Security/Generated/Models/AlertNotifications.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/AlertNotifications.cs rename to src/SDKs/Security/Management.Security/Generated/Models/AlertNotifications.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/AlertsToAdmins.cs b/src/SDKs/Security/Management.Security/Generated/Models/AlertsToAdmins.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/AlertsToAdmins.cs rename to src/SDKs/Security/Management.Security/Generated/Models/AlertsToAdmins.cs diff --git a/src/SDKs/Security/Management.Security/Generated/Models/AllowedConnectionsResource.cs b/src/SDKs/Security/Management.Security/Generated/Models/AllowedConnectionsResource.cs new file mode 100644 index 000000000000..698a71888509 --- /dev/null +++ b/src/SDKs/Security/Management.Security/Generated/Models/AllowedConnectionsResource.cs @@ -0,0 +1,101 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by 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/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/AscLocation.cs b/src/SDKs/Security/Management.Security/Generated/Models/AscLocation.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/AscLocation.cs rename to src/SDKs/Security/Management.Security/Generated/Models/AscLocation.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/AtaExternalSecuritySolution.cs b/src/SDKs/Security/Management.Security/Generated/Models/AtaExternalSecuritySolution.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/AtaExternalSecuritySolution.cs rename to src/SDKs/Security/Management.Security/Generated/Models/AtaExternalSecuritySolution.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/AtaSolutionProperties.cs b/src/SDKs/Security/Management.Security/Generated/Models/AtaSolutionProperties.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/AtaSolutionProperties.cs rename to src/SDKs/Security/Management.Security/Generated/Models/AtaSolutionProperties.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/AutoProvision.cs b/src/SDKs/Security/Management.Security/Generated/Models/AutoProvision.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/AutoProvision.cs rename to src/SDKs/Security/Management.Security/Generated/Models/AutoProvision.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/AutoProvisioningSetting.cs b/src/SDKs/Security/Management.Security/Generated/Models/AutoProvisioningSetting.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/AutoProvisioningSetting.cs rename to src/SDKs/Security/Management.Security/Generated/Models/AutoProvisioningSetting.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/CefExternalSecuritySolution.cs b/src/SDKs/Security/Management.Security/Generated/Models/CefExternalSecuritySolution.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/CefExternalSecuritySolution.cs rename to src/SDKs/Security/Management.Security/Generated/Models/CefExternalSecuritySolution.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/CefSolutionProperties.cs b/src/SDKs/Security/Management.Security/Generated/Models/CefSolutionProperties.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/CefSolutionProperties.cs rename to src/SDKs/Security/Management.Security/Generated/Models/CefSolutionProperties.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/Compliance.cs b/src/SDKs/Security/Management.Security/Generated/Models/Compliance.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/Compliance.cs rename to src/SDKs/Security/Management.Security/Generated/Models/Compliance.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/ComplianceSegment.cs b/src/SDKs/Security/Management.Security/Generated/Models/ComplianceSegment.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/ComplianceSegment.cs rename to src/SDKs/Security/Management.Security/Generated/Models/ComplianceSegment.cs diff --git a/src/SDKs/Security/Management.Security/Generated/Models/ConnectableResource.cs b/src/SDKs/Security/Management.Security/Generated/Models/ConnectableResource.cs new file mode 100644 index 000000000000..fdee3b843f08 --- /dev/null +++ b/src/SDKs/Security/Management.Security/Generated/Models/ConnectableResource.cs @@ -0,0 +1,74 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.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/src/SDKs/Security/Management.Security/Generated/Models/ConnectedResource.cs b/src/SDKs/Security/Management.Security/Generated/Models/ConnectedResource.cs new file mode 100644 index 000000000000..a9458d7b180b --- /dev/null +++ b/src/SDKs/Security/Management.Security/Generated/Models/ConnectedResource.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.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/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/ConnectedWorkspace.cs b/src/SDKs/Security/Management.Security/Generated/Models/ConnectedWorkspace.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/ConnectedWorkspace.cs rename to src/SDKs/Security/Management.Security/Generated/Models/ConnectedWorkspace.cs diff --git a/src/SDKs/Security/Management.Security/Generated/Models/ConnectionType.cs b/src/SDKs/Security/Management.Security/Generated/Models/ConnectionType.cs new file mode 100644 index 000000000000..599f04894777 --- /dev/null +++ b/src/SDKs/Security/Management.Security/Generated/Models/ConnectionType.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Security.Models +{ + + /// + /// Defines values for ConnectionType. + /// + public static class ConnectionType + { + public const string Internal = "Internal"; + public const string External = "External"; + } +} diff --git a/src/SDKs/Security/Management.Security/Generated/Models/DataExportSetting.cs b/src/SDKs/Security/Management.Security/Generated/Models/DataExportSetting.cs new file mode 100644 index 000000000000..ab7d8e077bfd --- /dev/null +++ b/src/SDKs/Security/Management.Security/Generated/Models/DataExportSetting.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.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 DataExportSetting : Setting + { + /// + /// Initializes a new instance of the DataExportSetting class. + /// + public DataExportSetting() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataExportSetting class. + /// + /// Is the data export setting is enabled + /// Resource Id + /// Resource name + /// Resource type + public DataExportSetting(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 is 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/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/DiscoveredSecuritySolution.cs b/src/SDKs/Security/Management.Security/Generated/Models/DiscoveredSecuritySolution.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/DiscoveredSecuritySolution.cs rename to src/SDKs/Security/Management.Security/Generated/Models/DiscoveredSecuritySolution.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/ExternalSecuritySolution.cs b/src/SDKs/Security/Management.Security/Generated/Models/ExternalSecuritySolution.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/ExternalSecuritySolution.cs rename to src/SDKs/Security/Management.Security/Generated/Models/ExternalSecuritySolution.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/ExternalSecuritySolutionKind.cs b/src/SDKs/Security/Management.Security/Generated/Models/ExternalSecuritySolutionKind.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/ExternalSecuritySolutionKind.cs rename to src/SDKs/Security/Management.Security/Generated/Models/ExternalSecuritySolutionKind.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/ExternalSecuritySolutionKind1.cs b/src/SDKs/Security/Management.Security/Generated/Models/ExternalSecuritySolutionKind1.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/ExternalSecuritySolutionKind1.cs rename to src/SDKs/Security/Management.Security/Generated/Models/ExternalSecuritySolutionKind1.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/ExternalSecuritySolutionProperties.cs b/src/SDKs/Security/Management.Security/Generated/Models/ExternalSecuritySolutionProperties.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/ExternalSecuritySolutionProperties.cs rename to src/SDKs/Security/Management.Security/Generated/Models/ExternalSecuritySolutionProperties.cs diff --git a/src/SDKs/Security/Management.Security/Generated/Models/InformationProtectionKeyword.cs b/src/SDKs/Security/Management.Security/Generated/Models/InformationProtectionKeyword.cs new file mode 100644 index 000000000000..081316c6a281 --- /dev/null +++ b/src/SDKs/Security/Management.Security/Generated/Models/InformationProtectionKeyword.cs @@ -0,0 +1,81 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.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/src/SDKs/Security/Management.Security/Generated/Models/InformationProtectionPolicy.cs b/src/SDKs/Security/Management.Security/Generated/Models/InformationProtectionPolicy.cs new file mode 100644 index 000000000000..c2c698211eec --- /dev/null +++ b/src/SDKs/Security/Management.Security/Generated/Models/InformationProtectionPolicy.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.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. + /// 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?), IDictionary labels = default(IDictionary), IDictionary informationTypes = default(IDictionary)) + : base(id, name, type) + { + LastModifiedUtc = lastModifiedUtc; + 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 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/src/SDKs/Security/Management.Security/Generated/Models/InformationType.cs b/src/SDKs/Security/Management.Security/Generated/Models/InformationType.cs new file mode 100644 index 000000000000..e980ded13b0c --- /dev/null +++ b/src/SDKs/Security/Management.Security/Generated/Models/InformationType.cs @@ -0,0 +1,99 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by 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 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), double? order = default(double?), System.Guid? recommendedLabelId = default(System.Guid?), bool? enabled = default(bool?), bool? custom = default(bool?), IList keywords = default(IList)) + { + DisplayName = displayName; + 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 order of the information type. + /// + [JsonProperty(PropertyName = "order")] + public double? 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/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/JitNetworkAccessPolicy.cs b/src/SDKs/Security/Management.Security/Generated/Models/JitNetworkAccessPolicy.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/JitNetworkAccessPolicy.cs rename to src/SDKs/Security/Management.Security/Generated/Models/JitNetworkAccessPolicy.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/JitNetworkAccessPolicyInitiatePort.cs b/src/SDKs/Security/Management.Security/Generated/Models/JitNetworkAccessPolicyInitiatePort.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/JitNetworkAccessPolicyInitiatePort.cs rename to src/SDKs/Security/Management.Security/Generated/Models/JitNetworkAccessPolicyInitiatePort.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/JitNetworkAccessPolicyInitiateRequest.cs b/src/SDKs/Security/Management.Security/Generated/Models/JitNetworkAccessPolicyInitiateRequest.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/JitNetworkAccessPolicyInitiateRequest.cs rename to src/SDKs/Security/Management.Security/Generated/Models/JitNetworkAccessPolicyInitiateRequest.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/JitNetworkAccessPolicyInitiateVirtualMachine.cs b/src/SDKs/Security/Management.Security/Generated/Models/JitNetworkAccessPolicyInitiateVirtualMachine.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/JitNetworkAccessPolicyInitiateVirtualMachine.cs rename to src/SDKs/Security/Management.Security/Generated/Models/JitNetworkAccessPolicyInitiateVirtualMachine.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/JitNetworkAccessPolicyVirtualMachine.cs b/src/SDKs/Security/Management.Security/Generated/Models/JitNetworkAccessPolicyVirtualMachine.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/JitNetworkAccessPolicyVirtualMachine.cs rename to src/SDKs/Security/Management.Security/Generated/Models/JitNetworkAccessPolicyVirtualMachine.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/JitNetworkAccessPortRule.cs b/src/SDKs/Security/Management.Security/Generated/Models/JitNetworkAccessPortRule.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/JitNetworkAccessPortRule.cs rename to src/SDKs/Security/Management.Security/Generated/Models/JitNetworkAccessPortRule.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/JitNetworkAccessRequest.cs b/src/SDKs/Security/Management.Security/Generated/Models/JitNetworkAccessRequest.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/JitNetworkAccessRequest.cs rename to src/SDKs/Security/Management.Security/Generated/Models/JitNetworkAccessRequest.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/JitNetworkAccessRequestPort.cs b/src/SDKs/Security/Management.Security/Generated/Models/JitNetworkAccessRequestPort.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/JitNetworkAccessRequestPort.cs rename to src/SDKs/Security/Management.Security/Generated/Models/JitNetworkAccessRequestPort.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/JitNetworkAccessRequestVirtualMachine.cs b/src/SDKs/Security/Management.Security/Generated/Models/JitNetworkAccessRequestVirtualMachine.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/JitNetworkAccessRequestVirtualMachine.cs rename to src/SDKs/Security/Management.Security/Generated/Models/JitNetworkAccessRequestVirtualMachine.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/Kind.cs b/src/SDKs/Security/Management.Security/Generated/Models/Kind.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/Kind.cs rename to src/SDKs/Security/Management.Security/Generated/Models/Kind.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/Location.cs b/src/SDKs/Security/Management.Security/Generated/Models/Location.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/Location.cs rename to src/SDKs/Security/Management.Security/Generated/Models/Location.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/Operation.cs b/src/SDKs/Security/Management.Security/Generated/Models/Operation.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/Operation.cs rename to src/SDKs/Security/Management.Security/Generated/Models/Operation.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/OperationDisplay.cs b/src/SDKs/Security/Management.Security/Generated/Models/OperationDisplay.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/OperationDisplay.cs rename to src/SDKs/Security/Management.Security/Generated/Models/OperationDisplay.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/Page.cs b/src/SDKs/Security/Management.Security/Generated/Models/Page.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/Page.cs rename to src/SDKs/Security/Management.Security/Generated/Models/Page.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/Pricing.cs b/src/SDKs/Security/Management.Security/Generated/Models/Pricing.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/Pricing.cs rename to src/SDKs/Security/Management.Security/Generated/Models/Pricing.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/PricingTier.cs b/src/SDKs/Security/Management.Security/Generated/Models/PricingTier.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/PricingTier.cs rename to src/SDKs/Security/Management.Security/Generated/Models/PricingTier.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/Protocol.cs b/src/SDKs/Security/Management.Security/Generated/Models/Protocol.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/Protocol.cs rename to src/SDKs/Security/Management.Security/Generated/Models/Protocol.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/Resource.cs b/src/SDKs/Security/Management.Security/Generated/Models/Resource.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/Resource.cs rename to src/SDKs/Security/Management.Security/Generated/Models/Resource.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/SecurityContact.cs b/src/SDKs/Security/Management.Security/Generated/Models/SecurityContact.cs similarity index 91% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/SecurityContact.cs rename to src/SDKs/Security/Management.Security/Generated/Models/SecurityContact.cs index 41310b3fb3cf..74cfac436c2d 100644 --- a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/SecurityContact.cs +++ b/src/SDKs/Security/Management.Security/Generated/Models/SecurityContact.cs @@ -33,8 +33,6 @@ public SecurityContact() /// Initializes a new instance of the SecurityContact class. /// /// The email of this security contact - /// The phone number of this security - /// contact /// Whether to send security alerts /// notifications to the security contact. Possible values include: /// 'On', 'Off' @@ -44,7 +42,9 @@ public SecurityContact() /// Resource Id /// Resource name /// Resource type - public SecurityContact(string email, string phone, string alertNotifications, string alertsToAdmins, string id = default(string), string name = default(string), string type = default(string)) + /// 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; @@ -97,10 +97,6 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "Email"); } - if (Phone == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Phone"); - } if (AlertNotifications == null) { throw new ValidationException(ValidationRules.CannotBeNull, "AlertNotifications"); diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/SecurityFamily.cs b/src/SDKs/Security/Management.Security/Generated/Models/SecurityFamily.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/SecurityFamily.cs rename to src/SDKs/Security/Management.Security/Generated/Models/SecurityFamily.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/SecurityTask.cs b/src/SDKs/Security/Management.Security/Generated/Models/SecurityTask.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/SecurityTask.cs rename to src/SDKs/Security/Management.Security/Generated/Models/SecurityTask.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/SecurityTaskParameters.cs b/src/SDKs/Security/Management.Security/Generated/Models/SecurityTaskParameters.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/SecurityTaskParameters.cs rename to src/SDKs/Security/Management.Security/Generated/Models/SecurityTaskParameters.cs diff --git a/src/SDKs/Security/Management.Security/Generated/Models/SensitivityLabel.cs b/src/SDKs/Security/Management.Security/Generated/Models/SensitivityLabel.cs new file mode 100644 index 000000000000..5e50c727c52e --- /dev/null +++ b/src/SDKs/Security/Management.Security/Generated/Models/SensitivityLabel.cs @@ -0,0 +1,69 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.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 order of the sensitivity label. + /// Indicates whether the label is enabled or + /// not. + public SensitivityLabel(string displayName = default(string), double? order = default(double?), bool? enabled = default(bool?)) + { + DisplayName = displayName; + 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 order of the sensitivity label. + /// + [JsonProperty(PropertyName = "order")] + public double? 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/src/SDKs/Security/Management.Security/Generated/Models/Setting.cs b/src/SDKs/Security/Management.Security/Generated/Models/Setting.cs new file mode 100644 index 000000000000..6cd12ba7f0cf --- /dev/null +++ b/src/SDKs/Security/Management.Security/Generated/Models/Setting.cs @@ -0,0 +1,67 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Security.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Represents a security setting in Azure Security Center. + /// + public partial class Setting + { + /// + /// 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)) + { + Id = id; + Name = name; + Type = type; + 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; } + + } +} diff --git a/src/SDKs/Security/Management.Security/Generated/Models/SettingKind.cs b/src/SDKs/Security/Management.Security/Generated/Models/SettingKind.cs new file mode 100644 index 000000000000..2d4cd0ee2fe6 --- /dev/null +++ b/src/SDKs/Security/Management.Security/Generated/Models/SettingKind.cs @@ -0,0 +1,21 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Security.Models +{ + + /// + /// Defines values for SettingKind. + /// + public static class SettingKind + { + public const string DataExportSetting = "DataExportSetting"; + } +} diff --git a/src/SDKs/Security/Management.Security/Generated/Models/SettingKind1.cs b/src/SDKs/Security/Management.Security/Generated/Models/SettingKind1.cs new file mode 100644 index 000000000000..fc645a08a6e2 --- /dev/null +++ b/src/SDKs/Security/Management.Security/Generated/Models/SettingKind1.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Security.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The kind of the security setting + /// + public partial class SettingKind1 + { + /// + /// Initializes a new instance of the SettingKind1 class. + /// + public SettingKind1() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SettingKind1 class. + /// + /// the kind of the settings string. Possible values + /// include: 'DataExportSetting' + public SettingKind1(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 settings string. Possible values + /// include: 'DataExportSetting' + /// + [JsonProperty(PropertyName = "kind")] + public string Kind { get; set; } + + } +} diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/Status.cs b/src/SDKs/Security/Management.Security/Generated/Models/Status.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/Status.cs rename to src/SDKs/Security/Management.Security/Generated/Models/Status.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/StatusReason.cs b/src/SDKs/Security/Management.Security/Generated/Models/StatusReason.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/StatusReason.cs rename to src/SDKs/Security/Management.Security/Generated/Models/StatusReason.cs diff --git a/src/SDKs/Security/Management.Security/Generated/Models/TopologyResource.cs b/src/SDKs/Security/Management.Security/Generated/Models/TopologyResource.cs new file mode 100644 index 000000000000..0b7bb6c3c668 --- /dev/null +++ b/src/SDKs/Security/Management.Security/Generated/Models/TopologyResource.cs @@ -0,0 +1,96 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.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/src/SDKs/Security/Management.Security/Generated/Models/TopologySingleResource.cs b/src/SDKs/Security/Management.Security/Generated/Models/TopologySingleResource.cs new file mode 100644 index 000000000000..389401335b55 --- /dev/null +++ b/src/SDKs/Security/Management.Security/Generated/Models/TopologySingleResource.cs @@ -0,0 +1,115 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.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/src/SDKs/Security/Management.Security/Generated/Models/TopologySingleResourceChild.cs b/src/SDKs/Security/Management.Security/Generated/Models/TopologySingleResourceChild.cs new file mode 100644 index 000000000000..186ba225522b --- /dev/null +++ b/src/SDKs/Security/Management.Security/Generated/Models/TopologySingleResourceChild.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.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/src/SDKs/Security/Management.Security/Generated/Models/TopologySingleResourceParent.cs b/src/SDKs/Security/Management.Security/Generated/Models/TopologySingleResourceParent.cs new file mode 100644 index 000000000000..6d3f5e55d010 --- /dev/null +++ b/src/SDKs/Security/Management.Security/Generated/Models/TopologySingleResourceParent.cs @@ -0,0 +1,52 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.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/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/WorkspaceSetting.cs b/src/SDKs/Security/Management.Security/Generated/Models/WorkspaceSetting.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Models/WorkspaceSetting.cs rename to src/SDKs/Security/Management.Security/Generated/Models/WorkspaceSetting.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Operations.cs b/src/SDKs/Security/Management.Security/Generated/Operations.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/Operations.cs rename to src/SDKs/Security/Management.Security/Generated/Operations.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/OperationsExtensions.cs b/src/SDKs/Security/Management.Security/Generated/OperationsExtensions.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/OperationsExtensions.cs rename to src/SDKs/Security/Management.Security/Generated/OperationsExtensions.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/PricingsOperations.cs b/src/SDKs/Security/Management.Security/Generated/PricingsOperations.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/PricingsOperations.cs rename to src/SDKs/Security/Management.Security/Generated/PricingsOperations.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/PricingsOperationsExtensions.cs b/src/SDKs/Security/Management.Security/Generated/PricingsOperationsExtensions.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/PricingsOperationsExtensions.cs rename to src/SDKs/Security/Management.Security/Generated/PricingsOperationsExtensions.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/SdkInfo_SecurityCenter.cs b/src/SDKs/Security/Management.Security/Generated/SdkInfo_SecurityCenter.cs similarity index 56% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/SdkInfo_SecurityCenter.cs rename to src/SDKs/Security/Management.Security/Generated/SdkInfo_SecurityCenter.cs index 30d267223106..fabf14c52cc5 100644 --- a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/SdkInfo_SecurityCenter.cs +++ b/src/SDKs/Security/Management.Security/Generated/SdkInfo_SecurityCenter.cs @@ -19,20 +19,36 @@ public static IEnumerable> ApiInfo_SecurityCenter { return new Tuple[] { + new Tuple("Security", "AdvancedThreatProtection", "2017-08-01-preview"), new Tuple("Security", "Alerts", "2015-06-01-preview"), + new Tuple("Security", "AllowedConnections", "2015-06-01-preview"), new Tuple("Security", "AutoProvisioningSettings", "2017-08-01-preview"), new Tuple("Security", "Compliances", "2017-08-01-preview"), new Tuple("Security", "DiscoveredSecuritySolutions", "2015-06-01-preview"), new Tuple("Security", "ExternalSecuritySolutions", "2015-06-01-preview"), + new Tuple("Security", "InformationProtectionPolicies", "2017-08-01-preview"), new Tuple("Security", "JitNetworkAccessPolicies", "2015-06-01-preview"), new Tuple("Security", "Locations", "2015-06-01-preview"), new Tuple("Security", "Operations", "2015-06-01-preview"), new Tuple("Security", "Pricings", "2017-08-01-preview"), new Tuple("Security", "SecurityContacts", "2017-08-01-preview"), + new Tuple("Security", "Settings", "2017-08-01-preview"), new Tuple("Security", "Tasks", "2015-06-01-preview"), + new Tuple("Security", "Topology", "2015-06-01-preview"), new Tuple("Security", "WorkspaceSettings", "2017-08-01-preview"), }.AsEnumerable(); } } + // BEGIN: Code Generation Metadata Section + public static readonly String AutoRestVersion = "latest"; + public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4283"; + 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=latest --reflect-api-versions --csharp-sdks-folder=C:\\Rome\\APIvTeam\\azure-sdk-for-net\\src\\SDKs"; + public static readonly String GithubForkName = "Azure"; + public static readonly String GithubBranchName = "master"; + public static readonly String GithubCommidId = "c4244e69a8da780083f6c8430f47c80f3d6154db"; + public static readonly String CodeGenerationErrors = ""; + public static readonly String GithubRepoName = "azure-rest-api-specs"; + // END: Code Generation Metadata Section } } + diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/SecurityCenterClient.cs b/src/SDKs/Security/Management.Security/Generated/SecurityCenterClient.cs similarity index 80% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/SecurityCenterClient.cs rename to src/SDKs/Security/Management.Security/Generated/SecurityCenterClient.cs index 36e1eb321bb8..d09286d522fb 100644 --- a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/SecurityCenterClient.cs +++ b/src/SDKs/Security/Management.Security/Generated/SecurityCenterClient.cs @@ -59,19 +59,20 @@ public partial class SecurityCenterClient : ServiceClient, public string AscLocation { get; set; } /// - /// Gets or sets the preferred language for the response. + /// The preferred language for the response. /// public string AcceptLanguage { get; set; } /// - /// Gets or sets the retry timeout in seconds for Long Running Operations. - /// Default value is 30. + /// The retry timeout in seconds for Long Running Operations. Default value is + /// 30. /// public int? LongRunningOperationRetryTimeout { get; set; } /// - /// When set to true a unique x-ms-client-request-id value is generated and - /// included in each request. Default is true. + /// Whether a unique x-ms-client-request-id should be generated. When set to + /// true a unique x-ms-client-request-id value is generated and included in + /// each request. Default is true. /// public bool? GenerateClientRequestId { get; set; } @@ -100,6 +101,21 @@ public partial class SecurityCenterClient : ServiceClient, /// public virtual ICompliancesOperations Compliances { get; private set; } + /// + /// Gets the IAdvancedThreatProtectionOperations. + /// + public virtual IAdvancedThreatProtectionOperations AdvancedThreatProtection { get; private set; } + + /// + /// Gets the ISettingsOperations. + /// + public virtual ISettingsOperations Settings { get; private set; } + + /// + /// Gets the IInformationProtectionPoliciesOperations. + /// + public virtual IInformationProtectionPoliciesOperations InformationProtectionPolicies { get; private set; } + /// /// Gets the IOperations. /// @@ -135,6 +151,29 @@ public partial class SecurityCenterClient : ServiceClient, /// public virtual IExternalSecuritySolutionsOperations ExternalSecuritySolutions { get; private set; } + /// + /// Gets the ITopologyOperations. + /// + public virtual ITopologyOperations Topology { get; private set; } + + /// + /// Gets the IAllowedConnectionsOperations. + /// + public virtual IAllowedConnectionsOperations AllowedConnections { get; private set; } + + /// + /// Initializes a new instance of the SecurityCenterClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling SecurityCenterClient.Dispose(). False: will not dispose provided httpClient + protected SecurityCenterClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + Initialize(); + } + /// /// Initializes a new instance of the SecurityCenterClient class. /// @@ -230,6 +269,33 @@ public SecurityCenterClient(ServiceClientCredentials credentials, params Delegat } } + /// + /// Initializes a new instance of the SecurityCenterClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling SecurityCenterClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public SecurityCenterClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + /// /// Initializes a new instance of the SecurityCenterClient class. /// @@ -341,6 +407,9 @@ private void Initialize() WorkspaceSettings = new WorkspaceSettingsOperations(this); AutoProvisioningSettings = new AutoProvisioningSettingsOperations(this); Compliances = new CompliancesOperations(this); + AdvancedThreatProtection = new AdvancedThreatProtectionOperations(this); + Settings = new SettingsOperations(this); + InformationProtectionPolicies = new InformationProtectionPoliciesOperations(this); Operations = new Operations(this); Locations = new LocationsOperations(this); Tasks = new TasksOperations(this); @@ -348,6 +417,8 @@ private void Initialize() DiscoveredSecuritySolutions = new DiscoveredSecuritySolutionsOperations(this); JitNetworkAccessPolicies = new JitNetworkAccessPoliciesOperations(this); ExternalSecuritySolutions = new ExternalSecuritySolutionsOperations(this); + Topology = new TopologyOperations(this); + AllowedConnections = new AllowedConnectionsOperations(this); BaseUri = new System.Uri("https://management.azure.com"); AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; @@ -378,6 +449,8 @@ private void Initialize() new Iso8601TimeSpanConverter() } }; + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("kind")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("kind")); SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("kind")); DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("kind")); CustomInitialize(); diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/SecurityContactsOperations.cs b/src/SDKs/Security/Management.Security/Generated/SecurityContactsOperations.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/SecurityContactsOperations.cs rename to src/SDKs/Security/Management.Security/Generated/SecurityContactsOperations.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/SecurityContactsOperationsExtensions.cs b/src/SDKs/Security/Management.Security/Generated/SecurityContactsOperationsExtensions.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/SecurityContactsOperationsExtensions.cs rename to src/SDKs/Security/Management.Security/Generated/SecurityContactsOperationsExtensions.cs diff --git a/src/SDKs/Security/Management.Security/Generated/SettingsOperations.cs b/src/SDKs/Security/Management.Security/Generated/SettingsOperations.cs new file mode 100644 index 000000000000..dd82ce649762 --- /dev/null +++ b/src/SDKs/Security/Management.Security/Generated/SettingsOperations.cs @@ -0,0 +1,808 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by 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 = "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/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 + /// + /// + /// Name of setting. Possible values include: 'MCAS', 'WDATP' + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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/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 + /// + /// + /// Name of setting. Possible values include: 'MCAS', 'WDATP' + /// + /// + /// 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 = "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("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/src/SDKs/Security/Management.Security/Generated/SettingsOperationsExtensions.cs b/src/SDKs/Security/Management.Security/Generated/SettingsOperationsExtensions.cs new file mode 100644 index 000000000000..a81cbb5b8c06 --- /dev/null +++ b/src/SDKs/Security/Management.Security/Generated/SettingsOperationsExtensions.cs @@ -0,0 +1,161 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.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. + /// + /// + /// Name of setting. Possible values include: 'MCAS', 'WDATP' + /// + 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. + /// + /// + /// Name of setting. Possible values include: 'MCAS', 'WDATP' + /// + /// + /// 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. + /// + /// + /// Name of setting. Possible values include: 'MCAS', 'WDATP' + /// + /// + /// 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. + /// + /// + /// Name of setting. Possible values include: 'MCAS', 'WDATP' + /// + /// + /// 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/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/TasksOperations.cs b/src/SDKs/Security/Management.Security/Generated/TasksOperations.cs similarity index 99% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/TasksOperations.cs rename to src/SDKs/Security/Management.Security/Generated/TasksOperations.cs index 7f16ee354316..c987c9b3155a 100644 --- a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/TasksOperations.cs +++ b/src/SDKs/Security/Management.Security/Generated/TasksOperations.cs @@ -711,7 +711,7 @@ internal TasksOperations(SecurityCenterClient client) _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(taskUpdateActionType)); + _url = _url.Replace("{taskUpdateActionType}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(taskUpdateActionType, Client.SerializationSettings).Trim('"'))); List _queryParameters = new List(); if (apiVersion != null) { @@ -1368,7 +1368,7 @@ internal TasksOperations(SecurityCenterClient client) _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(taskUpdateActionType)); + _url = _url.Replace("{taskUpdateActionType}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(taskUpdateActionType, Client.SerializationSettings).Trim('"'))); List _queryParameters = new List(); if (apiVersion != null) { diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/TasksOperationsExtensions.cs b/src/SDKs/Security/Management.Security/Generated/TasksOperationsExtensions.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/TasksOperationsExtensions.cs rename to src/SDKs/Security/Management.Security/Generated/TasksOperationsExtensions.cs diff --git a/src/SDKs/Security/Management.Security/Generated/TopologyOperations.cs b/src/SDKs/Security/Management.Security/Generated/TopologyOperations.cs new file mode 100644 index 000000000000..81ff455dfaec --- /dev/null +++ b/src/SDKs/Security/Management.Security/Generated/TopologyOperations.cs @@ -0,0 +1,995 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by 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 = "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/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 = "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, "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 = "2015-06-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("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/src/SDKs/Security/Management.Security/Generated/TopologyOperationsExtensions.cs b/src/SDKs/Security/Management.Security/Generated/TopologyOperationsExtensions.cs new file mode 100644 index 000000000000..a9873ee82612 --- /dev/null +++ b/src/SDKs/Security/Management.Security/Generated/TopologyOperationsExtensions.cs @@ -0,0 +1,195 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by 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/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/WorkspaceSettingsOperations.cs b/src/SDKs/Security/Management.Security/Generated/WorkspaceSettingsOperations.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/WorkspaceSettingsOperations.cs rename to src/SDKs/Security/Management.Security/Generated/WorkspaceSettingsOperations.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/WorkspaceSettingsOperationsExtensions.cs b/src/SDKs/Security/Management.Security/Generated/WorkspaceSettingsOperationsExtensions.cs similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Generated/WorkspaceSettingsOperationsExtensions.cs rename to src/SDKs/Security/Management.Security/Generated/WorkspaceSettingsOperationsExtensions.cs diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Microsoft.Azure.Management.SecurityCenter.csproj b/src/SDKs/Security/Management.Security/Microsoft.Azure.Management.SecurityCenter.csproj similarity index 96% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Microsoft.Azure.Management.SecurityCenter.csproj rename to src/SDKs/Security/Management.Security/Microsoft.Azure.Management.SecurityCenter.csproj index 5337c4c8b0e6..1d80e3241612 100644 --- a/src/SDKs/SecurityCenter/Management.SecurityCenter/Microsoft.Azure.Management.SecurityCenter.csproj +++ b/src/SDKs/Security/Management.Security/Microsoft.Azure.Management.SecurityCenter.csproj @@ -6,7 +6,7 @@ Microsoft.Azure.Management.SecurityCenter Provides developers with libraries for the updated Azure Security Center platform under Azure Resource manager to view and manage security posture in and outside Azure. - 0.10.0-preview + 0.11.0 Microsoft.Azure.Management.SecurityCenter management;security center;security; Taking dependency on 10.0.3 version of Newtonsoft nuget package. diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/Properties/AssemblyInfo.cs b/src/SDKs/Security/Management.Security/Properties/AssemblyInfo.cs similarity index 89% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/Properties/AssemblyInfo.cs rename to src/SDKs/Security/Management.Security/Properties/AssemblyInfo.cs index 961ddbc9ad64..49c230466c85 100644 --- a/src/SDKs/SecurityCenter/Management.SecurityCenter/Properties/AssemblyInfo.cs +++ b/src/SDKs/Security/Management.Security/Properties/AssemblyInfo.cs @@ -7,8 +7,8 @@ [assembly: AssemblyTitle("Microsoft Azure Security Center Library")] [assembly: AssemblyDescription("Provides management functionality for Microsoft Azure Security Center Resources.")] -[assembly: AssemblyVersion("0.10.0.0")] -[assembly: AssemblyFileVersion("0.10.0.0")] +[assembly: AssemblyVersion("0.11.0.0")] +[assembly: AssemblyFileVersion("0.11.0.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("Microsoft Azure .NET SDK")] diff --git a/src/SDKs/SecurityCenter/Management.SecurityCenter/generate.ps1 b/src/SDKs/Security/Management.Security/generate.ps1 similarity index 100% rename from src/SDKs/SecurityCenter/Management.SecurityCenter/generate.ps1 rename to src/SDKs/Security/Management.Security/generate.ps1 diff --git a/src/SDKs/SecurityCenter/SecurityCenter.sln b/src/SDKs/Security/Security.sln similarity index 91% rename from src/SDKs/SecurityCenter/SecurityCenter.sln rename to src/SDKs/Security/Security.sln index 3471469fb26c..50d7cb283105 100644 --- a/src/SDKs/SecurityCenter/SecurityCenter.sln +++ b/src/SDKs/Security/Security.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.27428.2011 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Azure.Management.SecurityCenter", "Management.SecurityCenter\Microsoft.Azure.Management.SecurityCenter.csproj", "{53CEC855-E510-487A-9C4F-DE99DB0EF552}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Azure.Management.SecurityCenter", "Management.Security\Microsoft.Azure.Management.SecurityCenter.csproj", "{53CEC855-E510-487A-9C4F-DE99DB0EF552}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SecurityCenter.Tests", "SecurityCenter.Tests\SecurityCenter.Tests.csproj", "{97B79E13-9C1E-4979-B0C4-1690879D258F}" EndProject diff --git a/src/SDKs/Security/SecurityCenter.Tests/AdvancedThreatProtection/AdvancedThreatProtectionTests.cs b/src/SDKs/Security/SecurityCenter.Tests/AdvancedThreatProtection/AdvancedThreatProtectionTests.cs new file mode 100644 index 000000000000..604b5f9a3ac8 --- /dev/null +++ b/src/SDKs/Security/SecurityCenter.Tests/AdvancedThreatProtection/AdvancedThreatProtectionTests.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +using System.Net; +using Microsoft.Azure.Management.Security; +using Microsoft.Azure.Management.Security.Models; +using Microsoft.Azure.Test.HttpRecorder; +using Microsoft.Rest.Azure; +using Microsoft.Rest.ClientRuntime.Azure.TestFramework; +using SecurityCenter.Tests.Helpers; +using Xunit; + +namespace SecurityCenter.Tests +{ + public class AdvancedThreatProtectionTests : TestBase + { + #region Test setup + + private static string SubscriptionId = "487bb485-b5b0-471e-9c0d-10717612f869"; + private static string RgName = "DefaultResourceGroup-CUS"; + private static string StorageAccountName = "samplestorageaccount2"; + + public static TestEnvironment TestEnvironment { get; private set; } + + private static SecurityCenterClient GetSecurityCenterClient(MockContext context) + { + if (TestEnvironment == null && HttpMockServer.Mode == HttpRecorderMode.Record) + { + TestEnvironment = TestEnvironmentFactory.GetTestEnvironment(); + } + + var handler = new RecordedDelegatingHandler { StatusCodeToReturn = HttpStatusCode.OK, IsPassThrough = true }; + + var securityCenterClient = HttpMockServer.Mode == HttpRecorderMode.Record + ? context.GetServiceClient(TestEnvironment, handlers: handler) + : context.GetServiceClient(handlers: handler); + + securityCenterClient.AscLocation = "centralus"; + + return securityCenterClient; + } + + #endregion + + #region AdvancThreatProtection Tests + + [Fact] + public void AdvancedThreatProtection_Get() + { + using (var context = MockContext.Start(this.GetType().FullName)) + { + var securityCenterClient = GetSecurityCenterClient(context); + var resourceId = $"/subscriptions/{SubscriptionId}/resourceGroups/{RgName}/providers/Microsoft.Storage/storageAccounts/{StorageAccountName}"; + var setting = securityCenterClient.AdvancedThreatProtection.Get(resourceId); + ValidateAdvancedThreatProtectionSetting(setting); + } + } + + [Fact] + public void AdvancedThreatProtection_CreateOrUpdate() + { + using (var context = MockContext.Start(this.GetType().FullName)) + { + var securityCenterClient = GetSecurityCenterClient(context); + var resourceId = $"/subscriptions/{SubscriptionId}/resourceGroups/{RgName}/providers/Microsoft.Storage/storageAccounts/{StorageAccountName}"; + var setting = securityCenterClient.AdvancedThreatProtection.Create(resourceId, isEnabled: true); + ValidateAdvancedThreatProtectionSetting(setting); + } + } + + #endregion + + #region Validations + + private void ValidateAdvancedThreatProtections(IPage AdvancedThreatProtectionPage) + { + Assert.True(AdvancedThreatProtectionPage.IsAny()); + + AdvancedThreatProtectionPage.ForEach(ValidateAdvancedThreatProtectionSetting); + } + + private void ValidateAdvancedThreatProtectionSetting(AdvancedThreatProtectionSetting setting) + { + Assert.NotNull(setting); + } + + #endregion + } +} diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/Alerts/SecurityAlertsTests.cs b/src/SDKs/Security/SecurityCenter.Tests/Alerts/SecurityAlertsTests.cs similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/Alerts/SecurityAlertsTests.cs rename to src/SDKs/Security/SecurityCenter.Tests/Alerts/SecurityAlertsTests.cs diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/AutoProvisionningSettings/AutoProvisioningSettingsTests.cs b/src/SDKs/Security/SecurityCenter.Tests/AutoProvisionningSettings/AutoProvisioningSettingsTests.cs similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/AutoProvisionningSettings/AutoProvisioningSettingsTests.cs rename to src/SDKs/Security/SecurityCenter.Tests/AutoProvisionningSettings/AutoProvisioningSettingsTests.cs diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/Compliances/CompliancesTests.cs b/src/SDKs/Security/SecurityCenter.Tests/Compliances/CompliancesTests.cs similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/Compliances/CompliancesTests.cs rename to src/SDKs/Security/SecurityCenter.Tests/Compliances/CompliancesTests.cs diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/DiscoveredSecuritySolutions/DiscoveredSecuritySolutionsTests.cs b/src/SDKs/Security/SecurityCenter.Tests/DiscoveredSecuritySolutions/DiscoveredSecuritySolutionsTests.cs similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/DiscoveredSecuritySolutions/DiscoveredSecuritySolutionsTests.cs rename to src/SDKs/Security/SecurityCenter.Tests/DiscoveredSecuritySolutions/DiscoveredSecuritySolutionsTests.cs diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/ExternalSecuritySolutions/ExternalSecuritySolutionsTests.cs b/src/SDKs/Security/SecurityCenter.Tests/ExternalSecuritySolutions/ExternalSecuritySolutionsTests.cs similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/ExternalSecuritySolutions/ExternalSecuritySolutionsTests.cs rename to src/SDKs/Security/SecurityCenter.Tests/ExternalSecuritySolutions/ExternalSecuritySolutionsTests.cs diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/Helpers/RecordedDelegatingHandler.cs b/src/SDKs/Security/SecurityCenter.Tests/Helpers/RecordedDelegatingHandler.cs similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/Helpers/RecordedDelegatingHandler.cs rename to src/SDKs/Security/SecurityCenter.Tests/Helpers/RecordedDelegatingHandler.cs diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/JitNetworkAccessPolicies/JitNetworkAccessPoliciesTests.cs b/src/SDKs/Security/SecurityCenter.Tests/JitNetworkAccessPolicies/JitNetworkAccessPoliciesTests.cs similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/JitNetworkAccessPolicies/JitNetworkAccessPoliciesTests.cs rename to src/SDKs/Security/SecurityCenter.Tests/JitNetworkAccessPolicies/JitNetworkAccessPoliciesTests.cs diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/Locations/LocationsTests.cs b/src/SDKs/Security/SecurityCenter.Tests/Locations/LocationsTests.cs similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/Locations/LocationsTests.cs rename to src/SDKs/Security/SecurityCenter.Tests/Locations/LocationsTests.cs diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/Operations/OperationsTests.cs b/src/SDKs/Security/SecurityCenter.Tests/Operations/OperationsTests.cs similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/Operations/OperationsTests.cs rename to src/SDKs/Security/SecurityCenter.Tests/Operations/OperationsTests.cs diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/Pricings/PricingsTests.cs b/src/SDKs/Security/SecurityCenter.Tests/Pricings/PricingsTests.cs similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/Pricings/PricingsTests.cs rename to src/SDKs/Security/SecurityCenter.Tests/Pricings/PricingsTests.cs diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SecurityCenter.Tests.csproj b/src/SDKs/Security/SecurityCenter.Tests/SecurityCenter.Tests.csproj similarity index 86% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SecurityCenter.Tests.csproj rename to src/SDKs/Security/SecurityCenter.Tests/SecurityCenter.Tests.csproj index d421ceda96b6..d2ef67c64111 100644 --- a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SecurityCenter.Tests.csproj +++ b/src/SDKs/Security/SecurityCenter.Tests/SecurityCenter.Tests.csproj @@ -8,7 +8,7 @@ true - + diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SecurityContacts/SecurityContactsTests.cs b/src/SDKs/Security/SecurityCenter.Tests/SecurityContacts/SecurityContactsTests.cs similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SecurityContacts/SecurityContactsTests.cs rename to src/SDKs/Security/SecurityCenter.Tests/SecurityContacts/SecurityContactsTests.cs diff --git a/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.AdvancedThreatProtectionTests/AdvancedThreatProtection_CreateOrUpdate.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.AdvancedThreatProtectionTests/AdvancedThreatProtection_CreateOrUpdate.json new file mode 100644 index 000000000000..0de17ad524dc --- /dev/null +++ b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.AdvancedThreatProtectionTests/AdvancedThreatProtection_CreateOrUpdate.json @@ -0,0 +1,77 @@ +{ + "Entries": [ + { + "RequestUri": "/%2Fsubscriptions%2F487bb485-b5b0-471e-9c0d-10717612f869%2FresourceGroups%2FDefaultResourceGroup-CUS%2Fproviders%2FMicrosoft.Storage%2FstorageAccounts%2Fsamplestorageaccount2/providers/Microsoft.Security/advancedThreatProtectionSettings/current?api-version=2017-08-01-preview", + "EncodedRequestUri": "LyUyRnN1YnNjcmlwdGlvbnMlMkY0ODdiYjQ4NS1iNWIwLTQ3MWUtOWMwZC0xMDcxNzYxMmY4NjklMkZyZXNvdXJjZUdyb3VwcyUyRkRlZmF1bHRSZXNvdXJjZUdyb3VwLUNVUyUyRnByb3ZpZGVycyUyRk1pY3Jvc29mdC5TdG9yYWdlJTJGc3RvcmFnZUFjY291bnRzJTJGc2FtcGxlc3RvcmFnZWFjY291bnQyL3Byb3ZpZGVycy9NaWNyb3NvZnQuU2VjdXJpdHkvYWR2YW5jZWRUaHJlYXRQcm90ZWN0aW9uU2V0dGluZ3MvY3VycmVudD9hcGktdmVyc2lvbj0yMDE3LTA4LTAxLXByZXZpZXc=", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"isEnabled\": true\r\n }\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "8f8184c4-0879-4e22-860b-b25d52635960" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.26814.03", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.17763.", + "Microsoft.Azure.Management.Security.SecurityCenterClient/0.10.0.0" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "51" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ + "249" + ], + "x-ms-request-id": [ + "1b735b0f-d797-4a12-a7ce-9d3d2717bf9e" + ], + "x-ms-correlation-request-id": [ + "1b735b0f-d797-4a12-a7ce-9d3d2717bf9e" + ], + "x-ms-routing-request-id": [ + "WESTEUROPE:20181121T124658Z:1b735b0f-d797-4a12-a7ce-9d3d2717bf9e" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Wed, 21 Nov 2018 12:46:57 GMT" + ], + "Content-Length": [ + "346" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"isEnabled\": true\r\n },\r\n \"id\": \"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/DefaultResourceGroup-CUS/providers/Microsoft.Storage/storageAccounts/samplestorageaccount2/providers/Microsoft.Security/advancedThreatProtectionSettings/current\",\r\n \"name\": \"current\",\r\n \"type\": \"Microsoft.Security/advancedThreatProtectionSettings\"\r\n}", + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "487bb485-b5b0-471e-9c0d-10717612f869" + } +} \ No newline at end of file diff --git a/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.AdvancedThreatProtectionTests/AdvancedThreatProtection_Get.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.AdvancedThreatProtectionTests/AdvancedThreatProtection_Get.json new file mode 100644 index 000000000000..dcf2f2c9e897 --- /dev/null +++ b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.AdvancedThreatProtectionTests/AdvancedThreatProtection_Get.json @@ -0,0 +1,71 @@ +{ + "Entries": [ + { + "RequestUri": "/%2Fsubscriptions%2F487bb485-b5b0-471e-9c0d-10717612f869%2FresourceGroups%2FDefaultResourceGroup-CUS%2Fproviders%2FMicrosoft.Storage%2FstorageAccounts%2Fsamplestorageaccount2/providers/Microsoft.Security/advancedThreatProtectionSettings/current?api-version=2017-08-01-preview", + "EncodedRequestUri": "LyUyRnN1YnNjcmlwdGlvbnMlMkY0ODdiYjQ4NS1iNWIwLTQ3MWUtOWMwZC0xMDcxNzYxMmY4NjklMkZyZXNvdXJjZUdyb3VwcyUyRkRlZmF1bHRSZXNvdXJjZUdyb3VwLUNVUyUyRnByb3ZpZGVycyUyRk1pY3Jvc29mdC5TdG9yYWdlJTJGc3RvcmFnZUFjY291bnRzJTJGc2FtcGxlc3RvcmFnZWFjY291bnQyL3Byb3ZpZGVycy9NaWNyb3NvZnQuU2VjdXJpdHkvYWR2YW5jZWRUaHJlYXRQcm90ZWN0aW9uU2V0dGluZ3MvY3VycmVudD9hcGktdmVyc2lvbj0yMDE3LTA4LTAxLXByZXZpZXc=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "b4a80d43-b623-4072-8be0-cbf5eab7afc4" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.26814.03", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.17763.", + "Microsoft.Azure.Management.Security.SecurityCenterClient/0.10.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ + "749" + ], + "x-ms-request-id": [ + "4b23a346-aeed-4040-b226-4d2270111508" + ], + "x-ms-correlation-request-id": [ + "4b23a346-aeed-4040-b226-4d2270111508" + ], + "x-ms-routing-request-id": [ + "WESTEUROPE:20181121T124656Z:4b23a346-aeed-4040-b226-4d2270111508" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Wed, 21 Nov 2018 12:46:56 GMT" + ], + "Content-Length": [ + "346" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"isEnabled\": true\r\n },\r\n \"id\": \"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/resourceGroups/DefaultResourceGroup-CUS/providers/Microsoft.Storage/storageAccounts/samplestorageaccount2/providers/Microsoft.Security/advancedThreatProtectionSettings/current\",\r\n \"name\": \"current\",\r\n \"type\": \"Microsoft.Security/advancedThreatProtectionSettings\"\r\n}", + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "487bb485-b5b0-471e-9c0d-10717612f869" + } +} \ No newline at end of file diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.AutoProvisioningSettingsTests/AutoProvisioningSettings_Create.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.AutoProvisioningSettingsTests/AutoProvisioningSettings_Create.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.AutoProvisioningSettingsTests/AutoProvisioningSettings_Create.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.AutoProvisioningSettingsTests/AutoProvisioningSettings_Create.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.AutoProvisioningSettingsTests/AutoProvisioningSettings_Get.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.AutoProvisioningSettingsTests/AutoProvisioningSettings_Get.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.AutoProvisioningSettingsTests/AutoProvisioningSettings_Get.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.AutoProvisioningSettingsTests/AutoProvisioningSettings_Get.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.AutoProvisioningSettingsTests/AutoProvisioningSettings_List.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.AutoProvisioningSettingsTests/AutoProvisioningSettings_List.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.AutoProvisioningSettingsTests/AutoProvisioningSettings_List.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.AutoProvisioningSettingsTests/AutoProvisioningSettings_List.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.CompliancesTests/Compliances_Get.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.CompliancesTests/Compliances_Get.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.CompliancesTests/Compliances_Get.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.CompliancesTests/Compliances_Get.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.CompliancesTests/Compliances_List.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.CompliancesTests/Compliances_List.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.CompliancesTests/Compliances_List.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.CompliancesTests/Compliances_List.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.DiscoveredSecuritySolutionsTests/DiscoveredSecuritySolutions_Get.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.DiscoveredSecuritySolutionsTests/DiscoveredSecuritySolutions_Get.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.DiscoveredSecuritySolutionsTests/DiscoveredSecuritySolutions_Get.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.DiscoveredSecuritySolutionsTests/DiscoveredSecuritySolutions_Get.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.DiscoveredSecuritySolutionsTests/DiscoveredSecuritySolutions_List.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.DiscoveredSecuritySolutionsTests/DiscoveredSecuritySolutions_List.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.DiscoveredSecuritySolutionsTests/DiscoveredSecuritySolutions_List.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.DiscoveredSecuritySolutionsTests/DiscoveredSecuritySolutions_List.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.DiscoveredSecuritySolutionsTests/DiscoveredSecuritySolutions_ListByHomeRegion.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.DiscoveredSecuritySolutionsTests/DiscoveredSecuritySolutions_ListByHomeRegion.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.DiscoveredSecuritySolutionsTests/DiscoveredSecuritySolutions_ListByHomeRegion.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.DiscoveredSecuritySolutionsTests/DiscoveredSecuritySolutions_ListByHomeRegion.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.ExternalSecuritySolutionsTests/ExternalSecuritySolutions_Get.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.ExternalSecuritySolutionsTests/ExternalSecuritySolutions_Get.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.ExternalSecuritySolutionsTests/ExternalSecuritySolutions_Get.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.ExternalSecuritySolutionsTests/ExternalSecuritySolutions_Get.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.ExternalSecuritySolutionsTests/ExternalSecuritySolutions_List.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.ExternalSecuritySolutionsTests/ExternalSecuritySolutions_List.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.ExternalSecuritySolutionsTests/ExternalSecuritySolutions_List.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.ExternalSecuritySolutionsTests/ExternalSecuritySolutions_List.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.ExternalSecuritySolutionsTests/ExternalSecuritySolutions_ListByHomeRegion.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.ExternalSecuritySolutionsTests/ExternalSecuritySolutions_ListByHomeRegion.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.ExternalSecuritySolutionsTests/ExternalSecuritySolutions_ListByHomeRegion.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.ExternalSecuritySolutionsTests/ExternalSecuritySolutions_ListByHomeRegion.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.JitNetworkAccessPoliciesTests/JitNetworkAccessPolicies_CreateOrUpdate.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.JitNetworkAccessPoliciesTests/JitNetworkAccessPolicies_CreateOrUpdate.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.JitNetworkAccessPoliciesTests/JitNetworkAccessPolicies_CreateOrUpdate.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.JitNetworkAccessPoliciesTests/JitNetworkAccessPolicies_CreateOrUpdate.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.JitNetworkAccessPoliciesTests/JitNetworkAccessPolicies_Delete.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.JitNetworkAccessPoliciesTests/JitNetworkAccessPolicies_Delete.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.JitNetworkAccessPoliciesTests/JitNetworkAccessPolicies_Delete.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.JitNetworkAccessPoliciesTests/JitNetworkAccessPolicies_Delete.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.JitNetworkAccessPoliciesTests/JitNetworkAccessPolicies_Get.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.JitNetworkAccessPoliciesTests/JitNetworkAccessPolicies_Get.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.JitNetworkAccessPoliciesTests/JitNetworkAccessPolicies_Get.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.JitNetworkAccessPoliciesTests/JitNetworkAccessPolicies_Get.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.JitNetworkAccessPoliciesTests/JitNetworkAccessPolicies_Initiate.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.JitNetworkAccessPoliciesTests/JitNetworkAccessPolicies_Initiate.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.JitNetworkAccessPoliciesTests/JitNetworkAccessPolicies_Initiate.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.JitNetworkAccessPoliciesTests/JitNetworkAccessPolicies_Initiate.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.JitNetworkAccessPoliciesTests/JitNetworkAccessPolicies_List.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.JitNetworkAccessPoliciesTests/JitNetworkAccessPolicies_List.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.JitNetworkAccessPoliciesTests/JitNetworkAccessPolicies_List.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.JitNetworkAccessPoliciesTests/JitNetworkAccessPolicies_List.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.JitNetworkAccessPoliciesTests/JitNetworkAccessPolicies_ListByRegion.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.JitNetworkAccessPoliciesTests/JitNetworkAccessPolicies_ListByRegion.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.JitNetworkAccessPoliciesTests/JitNetworkAccessPolicies_ListByRegion.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.JitNetworkAccessPoliciesTests/JitNetworkAccessPolicies_ListByRegion.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.JitNetworkAccessPoliciesTests/JitNetworkAccessPolicies_ListByResourceGroup.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.JitNetworkAccessPoliciesTests/JitNetworkAccessPolicies_ListByResourceGroup.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.JitNetworkAccessPoliciesTests/JitNetworkAccessPolicies_ListByResourceGroup.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.JitNetworkAccessPoliciesTests/JitNetworkAccessPolicies_ListByResourceGroup.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.JitNetworkAccessPoliciesTests/JitNetworkAccessPolicies_ListByResourceGroupAndRegion.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.JitNetworkAccessPoliciesTests/JitNetworkAccessPolicies_ListByResourceGroupAndRegion.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.JitNetworkAccessPoliciesTests/JitNetworkAccessPolicies_ListByResourceGroupAndRegion.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.JitNetworkAccessPoliciesTests/JitNetworkAccessPolicies_ListByResourceGroupAndRegion.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.LocationsTests/SecurityLocations_Get.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.LocationsTests/SecurityLocations_Get.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.LocationsTests/SecurityLocations_Get.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.LocationsTests/SecurityLocations_Get.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.LocationsTests/SecurityLocations_List.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.LocationsTests/SecurityLocations_List.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.LocationsTests/SecurityLocations_List.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.LocationsTests/SecurityLocations_List.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.OperationsTests/SecurityOperations_List.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.OperationsTests/SecurityOperations_List.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.OperationsTests/SecurityOperations_List.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.OperationsTests/SecurityOperations_List.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.PricingsTests/Pricings_CreateOrUpdateResourceGroupPricing.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.PricingsTests/Pricings_CreateOrUpdateResourceGroupPricing.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.PricingsTests/Pricings_CreateOrUpdateResourceGroupPricing.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.PricingsTests/Pricings_CreateOrUpdateResourceGroupPricing.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.PricingsTests/Pricings_GetResourceGroupPricing.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.PricingsTests/Pricings_GetResourceGroupPricing.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.PricingsTests/Pricings_GetResourceGroupPricing.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.PricingsTests/Pricings_GetResourceGroupPricing.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.PricingsTests/Pricings_GetSubscriptionPricing.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.PricingsTests/Pricings_GetSubscriptionPricing.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.PricingsTests/Pricings_GetSubscriptionPricing.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.PricingsTests/Pricings_GetSubscriptionPricing.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.PricingsTests/Pricings_List.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.PricingsTests/Pricings_List.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.PricingsTests/Pricings_List.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.PricingsTests/Pricings_List.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.PricingsTests/Pricings_ListByResourceGroup.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.PricingsTests/Pricings_ListByResourceGroup.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.PricingsTests/Pricings_ListByResourceGroup.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.PricingsTests/Pricings_ListByResourceGroup.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.PricingsTests/Pricings_UpdateSubscriptionPricing.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.PricingsTests/Pricings_UpdateSubscriptionPricing.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.PricingsTests/Pricings_UpdateSubscriptionPricing.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.PricingsTests/Pricings_UpdateSubscriptionPricing.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityAlertsTests/SecurityAlerts_GetResourceGroupLevelAlerts.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityAlertsTests/SecurityAlerts_GetResourceGroupLevelAlerts.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityAlertsTests/SecurityAlerts_GetResourceGroupLevelAlerts.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityAlertsTests/SecurityAlerts_GetResourceGroupLevelAlerts.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityAlertsTests/SecurityAlerts_GetSubscriptionLevelAlert.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityAlertsTests/SecurityAlerts_GetSubscriptionLevelAlert.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityAlertsTests/SecurityAlerts_GetSubscriptionLevelAlert.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityAlertsTests/SecurityAlerts_GetSubscriptionLevelAlert.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityAlertsTests/SecurityAlerts_List.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityAlertsTests/SecurityAlerts_List.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityAlertsTests/SecurityAlerts_List.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityAlertsTests/SecurityAlerts_List.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityAlertsTests/SecurityAlerts_ListByResourceGroup.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityAlertsTests/SecurityAlerts_ListByResourceGroup.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityAlertsTests/SecurityAlerts_ListByResourceGroup.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityAlertsTests/SecurityAlerts_ListByResourceGroup.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityAlertsTests/SecurityAlerts_ListResourceGroupLevelAlertsByRegion.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityAlertsTests/SecurityAlerts_ListResourceGroupLevelAlertsByRegion.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityAlertsTests/SecurityAlerts_ListResourceGroupLevelAlertsByRegion.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityAlertsTests/SecurityAlerts_ListResourceGroupLevelAlertsByRegion.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityAlertsTests/SecurityAlerts_ListSubscriptionLevelAlertsByRegion.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityAlertsTests/SecurityAlerts_ListSubscriptionLevelAlertsByRegion.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityAlertsTests/SecurityAlerts_ListSubscriptionLevelAlertsByRegion.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityAlertsTests/SecurityAlerts_ListSubscriptionLevelAlertsByRegion.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityAlertsTests/SecurityAlerts_UpdateResourceGroupLevelAlertState.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityAlertsTests/SecurityAlerts_UpdateResourceGroupLevelAlertState.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityAlertsTests/SecurityAlerts_UpdateResourceGroupLevelAlertState.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityAlertsTests/SecurityAlerts_UpdateResourceGroupLevelAlertState.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityAlertsTests/SecurityAlerts_UpdateSubscriptionLevelAlertState.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityAlertsTests/SecurityAlerts_UpdateSubscriptionLevelAlertState.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityAlertsTests/SecurityAlerts_UpdateSubscriptionLevelAlertState.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityAlertsTests/SecurityAlerts_UpdateSubscriptionLevelAlertState.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityContactsTests/SecurityContacts_Create.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityContactsTests/SecurityContacts_Create.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityContactsTests/SecurityContacts_Create.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityContactsTests/SecurityContacts_Create.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityContactsTests/SecurityContacts_Delete.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityContactsTests/SecurityContacts_Delete.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityContactsTests/SecurityContacts_Delete.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityContactsTests/SecurityContacts_Delete.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityContactsTests/SecurityContacts_Get.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityContactsTests/SecurityContacts_Get.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityContactsTests/SecurityContacts_Get.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityContactsTests/SecurityContacts_Get.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityContactsTests/SecurityContacts_List.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityContactsTests/SecurityContacts_List.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityContactsTests/SecurityContacts_List.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityContactsTests/SecurityContacts_List.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityContactsTests/SecurityContacts_Update.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityContactsTests/SecurityContacts_Update.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityContactsTests/SecurityContacts_Update.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityContactsTests/SecurityContacts_Update.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityTasksTests/SecurityTaskRecommendations_GetResourceGroupLevelTask.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityTasksTests/SecurityTaskRecommendations_GetResourceGroupLevelTask.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityTasksTests/SecurityTaskRecommendations_GetResourceGroupLevelTask.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityTasksTests/SecurityTaskRecommendations_GetResourceGroupLevelTask.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityTasksTests/SecurityTaskRecommendations_GetSubscriptionLevelTask.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityTasksTests/SecurityTaskRecommendations_GetSubscriptionLevelTask.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityTasksTests/SecurityTaskRecommendations_GetSubscriptionLevelTask.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityTasksTests/SecurityTaskRecommendations_GetSubscriptionLevelTask.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityTasksTests/SecurityTaskRecommendations_List.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityTasksTests/SecurityTaskRecommendations_List.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityTasksTests/SecurityTaskRecommendations_List.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityTasksTests/SecurityTaskRecommendations_List.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityTasksTests/SecurityTaskRecommendations_ListByHomeRegion.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityTasksTests/SecurityTaskRecommendations_ListByHomeRegion.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityTasksTests/SecurityTaskRecommendations_ListByHomeRegion.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityTasksTests/SecurityTaskRecommendations_ListByHomeRegion.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityTasksTests/SecurityTaskRecommendations_ListByResourceGroup.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityTasksTests/SecurityTaskRecommendations_ListByResourceGroup.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityTasksTests/SecurityTaskRecommendations_ListByResourceGroup.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityTasksTests/SecurityTaskRecommendations_ListByResourceGroup.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityTasksTests/SecurityTaskRecommendations_UpdateResourceGroupLevelTask.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityTasksTests/SecurityTaskRecommendations_UpdateResourceGroupLevelTask.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityTasksTests/SecurityTaskRecommendations_UpdateResourceGroupLevelTask.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityTasksTests/SecurityTaskRecommendations_UpdateResourceGroupLevelTask.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityTasksTests/SecurityTaskRecommendations_UpdateSubscriptionLevelTask.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityTasksTests/SecurityTaskRecommendations_UpdateSubscriptionLevelTask.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityTasksTests/SecurityTaskRecommendations_UpdateSubscriptionLevelTask.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SecurityTasksTests/SecurityTaskRecommendations_UpdateSubscriptionLevelTask.json diff --git a/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SettingsTests/Settings_Get.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SettingsTests/Settings_Get.json new file mode 100644 index 000000000000..659d381a3f7c --- /dev/null +++ b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SettingsTests/Settings_Get.json @@ -0,0 +1,71 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/providers/Microsoft.Security/settings/MCAS?api-version=2017-08-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDg3YmI0ODUtYjViMC00NzFlLTljMGQtMTA3MTc2MTJmODY5L3Byb3ZpZGVycy9NaWNyb3NvZnQuU2VjdXJpdHkvc2V0dGluZ3MvTUNBUz9hcGktdmVyc2lvbj0yMDE3LTA4LTAxLXByZXZpZXc=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "d0307a6f-2694-4503-9701-8125055eea70" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.26814.03", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.17763.", + "Microsoft.Azure.Management.Security.SecurityCenterClient/0.10.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "c7c8cce4-51dd-4038-8f34-2b98d93029fe" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ + "749" + ], + "x-ms-correlation-request-id": [ + "340e776e-43c0-49f1-859c-9e5af32c1cb3" + ], + "x-ms-routing-request-id": [ + "WESTEUROPE:20181121T124705Z:340e776e-43c0-49f1-859c-9e5af32c1cb3" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Wed, 21 Nov 2018 12:47:04 GMT" + ], + "Content-Length": [ + "212" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/providers/Microsoft.Security/settings/MCAS\",\r\n \"name\": \"MCAS\",\r\n \"type\": \"Microsoft.Security/settings\",\r\n \"kind\": \"DataExportSettings\",\r\n \"properties\": {\r\n \"enabled\": true\r\n }\r\n}", + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "487bb485-b5b0-471e-9c0d-10717612f869" + } +} \ No newline at end of file diff --git a/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SettingsTests/Settings_List.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SettingsTests/Settings_List.json new file mode 100644 index 000000000000..c14a99389bdf --- /dev/null +++ b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.SettingsTests/Settings_List.json @@ -0,0 +1,71 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/providers/Microsoft.Security/settings?api-version=2017-08-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDg3YmI0ODUtYjViMC00NzFlLTljMGQtMTA3MTc2MTJmODY5L3Byb3ZpZGVycy9NaWNyb3NvZnQuU2VjdXJpdHkvc2V0dGluZ3M/YXBpLXZlcnNpb249MjAxNy0wOC0wMS1wcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "4420c7ae-4901-4a83-9830-ba970bf6965c" + ], + "Accept-Language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.26814.03", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.17763.", + "Microsoft.Azure.Management.Security.SecurityCenterClient/0.10.0.0" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "e811800e-1b28-4201-85fc-b7afad805b05" + ], + "Server": [ + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-ratelimit-remaining-subscription-resource-requests": [ + "749" + ], + "x-ms-correlation-request-id": [ + "1d14086a-f422-4fa5-bacc-cba06f0eda18" + ], + "x-ms-routing-request-id": [ + "WESTEUROPE:20181121T124705Z:1d14086a-f422-4fa5-bacc-cba06f0eda18" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "Date": [ + "Wed, 21 Nov 2018 12:47:05 GMT" + ], + "Content-Length": [ + "439" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"id\": \"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/providers/Microsoft.Security/settings/MCAS\",\r\n \"name\": \"MCAS\",\r\n \"type\": \"Microsoft.Security/settings\",\r\n \"kind\": \"DataExportSettings\",\r\n \"properties\": {\r\n \"enabled\": true\r\n }\r\n },\r\n {\r\n \"id\": \"/subscriptions/487bb485-b5b0-471e-9c0d-10717612f869/providers/Microsoft.Security/settings/WDATP\",\r\n \"name\": \"WDATP\",\r\n \"type\": \"Microsoft.Security/settings\",\r\n \"kind\": \"DataExportSettings\",\r\n \"properties\": {\r\n \"enabled\": true\r\n }\r\n }\r\n ]\r\n}", + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "487bb485-b5b0-471e-9c0d-10717612f869" + } +} \ No newline at end of file diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.WorkspaceSettingsTests/WorkspaceSettings_Create.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.WorkspaceSettingsTests/WorkspaceSettings_Create.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.WorkspaceSettingsTests/WorkspaceSettings_Create.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.WorkspaceSettingsTests/WorkspaceSettings_Create.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.WorkspaceSettingsTests/WorkspaceSettings_Delete.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.WorkspaceSettingsTests/WorkspaceSettings_Delete.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.WorkspaceSettingsTests/WorkspaceSettings_Delete.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.WorkspaceSettingsTests/WorkspaceSettings_Delete.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.WorkspaceSettingsTests/WorkspaceSettings_Get.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.WorkspaceSettingsTests/WorkspaceSettings_Get.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.WorkspaceSettingsTests/WorkspaceSettings_Get.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.WorkspaceSettingsTests/WorkspaceSettings_Get.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.WorkspaceSettingsTests/WorkspaceSettings_List.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.WorkspaceSettingsTests/WorkspaceSettings_List.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.WorkspaceSettingsTests/WorkspaceSettings_List.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.WorkspaceSettingsTests/WorkspaceSettings_List.json diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.WorkspaceSettingsTests/WorkspaceSettings_Update.json b/src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.WorkspaceSettingsTests/WorkspaceSettings_Update.json similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.WorkspaceSettingsTests/WorkspaceSettings_Update.json rename to src/SDKs/Security/SecurityCenter.Tests/SessionRecords/SecurityCenter.Tests.WorkspaceSettingsTests/WorkspaceSettings_Update.json diff --git a/src/SDKs/Security/SecurityCenter.Tests/Settings/SettingsTests.cs b/src/SDKs/Security/SecurityCenter.Tests/Settings/SettingsTests.cs new file mode 100644 index 000000000000..a7bfba701ca9 --- /dev/null +++ b/src/SDKs/Security/SecurityCenter.Tests/Settings/SettingsTests.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +using System.Net; +using Microsoft.Azure.Management.Security; +using Microsoft.Azure.Management.Security.Models; +using Microsoft.Azure.Test.HttpRecorder; +using Microsoft.Rest.Azure; +using Microsoft.Rest.ClientRuntime.Azure.TestFramework; +using SecurityCenter.Tests.Helpers; +using Xunit; + +namespace SecurityCenter.Tests +{ + public class SettingsTests : TestBase + { + #region Test setup + + private static string SubscriptionId = "487bb485-b5b0-471e-9c0d-10717612f869"; + private static string SettingName = "MCAS"; + + public static TestEnvironment TestEnvironment { get; private set; } + + private static SecurityCenterClient GetSecurityCenterClient(MockContext context) + { + if (TestEnvironment == null && HttpMockServer.Mode == HttpRecorderMode.Record) + { + TestEnvironment = TestEnvironmentFactory.GetTestEnvironment(); + TestEnvironment.SubscriptionId = SubscriptionId; + } + + var handler = new RecordedDelegatingHandler { StatusCodeToReturn = HttpStatusCode.OK, IsPassThrough = true }; + + var securityCenterClient = HttpMockServer.Mode == HttpRecorderMode.Record + ? context.GetServiceClient(TestEnvironment, handlers: handler) + : context.GetServiceClient(handlers: handler); + + securityCenterClient.AscLocation = "centralus"; + + return securityCenterClient; + } + + #endregion + + #region Settings Tests + + [Fact] + public void Settings_List() + { + using (var context = MockContext.Start(this.GetType().FullName)) + { + var securityCenterClient = GetSecurityCenterClient(context); + + var settings = securityCenterClient.Settings.List(); + ValidateSettings(settings); + } + } + + [Fact] + public void Settings_Get() + { + using (var context = MockContext.Start(this.GetType().FullName)) + { + var securityCenterClient = GetSecurityCenterClient(context); + var setting = securityCenterClient.Settings.Get(SettingName); + ValidateSetting(setting); + } + } + + #endregion + + #region Validations + + private void ValidateSettings(IPage SettingsPage) + { + Assert.True(SettingsPage.IsAny()); + + SettingsPage.ForEach(ValidateSetting); + } + + private void ValidateSetting(Setting setting) + { + Assert.NotNull(setting); + } + + #endregion + } +} diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/Tasks/SecurityTasksTests.cs b/src/SDKs/Security/SecurityCenter.Tests/Tasks/SecurityTasksTests.cs similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/Tasks/SecurityTasksTests.cs rename to src/SDKs/Security/SecurityCenter.Tests/Tasks/SecurityTasksTests.cs diff --git a/src/SDKs/SecurityCenter/SecurityCenter.Tests/WorkspaceSettings/WorkspaceSettingsTests.cs b/src/SDKs/Security/SecurityCenter.Tests/WorkspaceSettings/WorkspaceSettingsTests.cs similarity index 100% rename from src/SDKs/SecurityCenter/SecurityCenter.Tests/WorkspaceSettings/WorkspaceSettingsTests.cs rename to src/SDKs/Security/SecurityCenter.Tests/WorkspaceSettings/WorkspaceSettingsTests.cs diff --git a/src/SDKs/_metadata/security_resource-manager.txt b/src/SDKs/_metadata/security_resource-manager.txt index 4903dc78a176..d2a0dc81c255 100644 --- a/src/SDKs/_metadata/security_resource-manager.txt +++ b/src/SDKs/_metadata/security_resource-manager.txt @@ -3,18 +3,12 @@ AutoRest installed successfully. Commencing code generation Generating CSharp code Executing AutoRest command -cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/security/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=C:\Users\chlahav\Documents\WindowsPowerShell\Modules\CodeGenerationModules\AutoRestCodeGenerationModule -2018-07-24 18:16:36 UTC -1) azure-rest-api-specs repository information +cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/security/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=C:\Rome\APIvTeam\azure-sdk-for-net\src\SDKs +2018-11-19 08:45:04 UTC +Azure-rest-api-specs repository information GitHub fork: Azure Branch: master -Commit: 30d7f17bff767fa03539e749a69bac82e0cd22d8 - -2) AutoRest information +Commit: c4244e69a8da780083f6c8430f47c80f3d6154db +AutoRest information Requested version: latest -Bootstrapper version: autorest@2.0.4282 - - -Latest installed version: - - +Bootstrapper version: autorest@2.0.4283