diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IIotDefenderSettingsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IIotDefenderSettingsOperations.cs index bed2a48cabac..a1bdc65137c0 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IIotDefenderSettingsOperations.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IIotDefenderSettingsOperations.cs @@ -15,6 +15,7 @@ namespace Microsoft.Azure.Management.Security using Models; using System.Collections; using System.Collections.Generic; + using System.IO; using System.Threading; using System.Threading.Tasks; @@ -122,5 +123,24 @@ public partial interface IIotDefenderSettingsOperations /// Thrown when a required parameter is null /// Task> PackageDownloadsMethodWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Download manager activation data defined for this 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> DownloadManagerActivationWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IIotSensorsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IIotSensorsOperations.cs index 4af820d975d9..0dc770886024 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IIotSensorsOperations.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IIotSensorsOperations.cs @@ -72,7 +72,7 @@ public partial interface IIotSensorsOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string scope, string iotSensorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string scope, string iotSensorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create or update IoT sensor /// @@ -83,6 +83,12 @@ public partial interface IIotSensorsOperations /// /// Name of the IoT sensor /// + /// + /// TI Automatic mode status of the IoT sensor + /// + /// + /// Zone of the IoT sensor + /// /// /// The headers that will be added to request. /// @@ -98,7 +104,7 @@ public partial interface IIotSensorsOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string scope, string iotSensorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string scope, string iotSensorName, bool? tiAutomaticUpdates = default(bool?), string zone = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete IoT sensor /// @@ -148,5 +154,57 @@ public partial interface IIotSensorsOperations /// Thrown when a required parameter is null /// Task> DownloadActivationWithHttpMessagesAsync(string scope, string iotSensorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Download file for reset password of the sensor + /// + /// + /// Scope of the query (IoT Hub, + /// /providers/Microsoft.Devices/iotHubs/myHub) + /// + /// + /// Name of the IoT sensor + /// + /// + /// The appliance id of the sensor. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> DownloadResetPasswordWithHttpMessagesAsync(string scope, string iotSensorName, string applianceId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Trigger threat intelligence package update + /// + /// + /// Scope of the query (IoT Hub, + /// /providers/Microsoft.Devices/iotHubs/myHub) + /// + /// + /// Name of the IoT sensor + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task TriggerTiPackageUpdateWithHttpMessagesAsync(string scope, string iotSensorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IIotSitesOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IIotSitesOperations.cs new file mode 100644 index 000000000000..f3812984e2b5 --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IIotSitesOperations.cs @@ -0,0 +1,122 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Security +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// IotSitesOperations operations. + /// + public partial interface IIotSitesOperations + { + /// + /// List IoT sites + /// + /// + /// Scope of the query (IoT Hub, + /// /providers/Microsoft.Devices/iotHubs/myHub) + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ListWithHttpMessagesAsync(string scope, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get IoT site + /// + /// + /// Scope of the query (IoT Hub, + /// /providers/Microsoft.Devices/iotHubs/myHub) + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update IoT site + /// + /// + /// Scope of the query (IoT Hub, + /// /providers/Microsoft.Devices/iotHubs/myHub) + /// + /// + /// Display name of the IoT site + /// + /// + /// Tags of the IoT site + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// 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 displayName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete IoT site + /// + /// + /// Scope of the query (IoT Hub, + /// /providers/Microsoft.Devices/iotHubs/myHub) + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string scope, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IOnPremiseIotSensorsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IOnPremiseIotSensorsOperations.cs index c0a284754602..7c268a868213 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IOnPremiseIotSensorsOperations.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IOnPremiseIotSensorsOperations.cs @@ -128,5 +128,30 @@ public partial interface IOnPremiseIotSensorsOperations /// Thrown when a required parameter is null /// Task> DownloadActivationWithHttpMessagesAsync(string onPremiseIotSensorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Download file for reset password of the sensor + /// + /// + /// Name of the on-premise IoT sensor + /// + /// + /// The appliance id of the sensor. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> DownloadResetPasswordWithHttpMessagesAsync(string onPremiseIotSensorName, string applianceId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISecurityCenterClient.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISecurityCenterClient.cs index 9e8b01ad5fbd..ad24ed17b024 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISecurityCenterClient.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/ISecurityCenterClient.cs @@ -336,5 +336,10 @@ public partial interface ISecurityCenterClient : System.IDisposable /// IOnPremiseIotSensorsOperations OnPremiseIotSensors { get; } + /// + /// Gets the IIotSitesOperations. + /// + IIotSitesOperations IotSites { get; } + } } diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotDefenderSettingsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotDefenderSettingsOperations.cs index 40ddad2dc077..40070cf82a9a 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotDefenderSettingsOperations.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotDefenderSettingsOperations.cs @@ -16,6 +16,7 @@ namespace Microsoft.Azure.Management.Security using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; + using System.IO; using System.Linq; using System.Net; using System.Net.Http; @@ -990,5 +991,175 @@ internal IotDefenderSettingsOperations(SecurityCenterClient client) return _result; } + /// + /// Download manager activation data defined for this 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> DownloadManagerActivationWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + string apiVersion = "2020-08-06-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, "DownloadManagerActivation", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/iotDefenderSettings/default/downloadManagerActivation").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("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _result.Body = await _httpResponse.Content.ReadAsStreamAsync().ConfigureAwait(false); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + } } diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotDefenderSettingsOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotDefenderSettingsOperationsExtensions.cs index caddc0e95049..dd2ad1cbf095 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotDefenderSettingsOperationsExtensions.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotDefenderSettingsOperationsExtensions.cs @@ -15,6 +15,7 @@ namespace Microsoft.Azure.Management.Security using Models; using System.Collections; using System.Collections.Generic; + using System.IO; using System.Threading; using System.Threading.Tasks; @@ -174,5 +175,32 @@ public static PackageDownloads PackageDownloadsMethod(this IIotDefenderSettingsO } } + /// + /// Download manager activation data defined for this subscription + /// + /// + /// The operations group for this extension method. + /// + public static Stream DownloadManagerActivation(this IIotDefenderSettingsOperations operations) + { + return operations.DownloadManagerActivationAsync().GetAwaiter().GetResult(); + } + + /// + /// Download manager activation data defined for this subscription + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task DownloadManagerActivationAsync(this IIotDefenderSettingsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + var _result = await operations.DownloadManagerActivationWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false); + _result.Request.Dispose(); + return _result.Body; + } + } } diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSensorsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSensorsOperations.cs index 45873dc507b1..d451cefed908 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSensorsOperations.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSensorsOperations.cs @@ -261,7 +261,7 @@ internal IotSensorsOperations(SecurityCenterClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string scope, string iotSensorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string scope, string iotSensorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (scope == null) { @@ -388,7 +388,7 @@ internal IotSensorsOperations(SecurityCenterClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -401,7 +401,7 @@ internal IotSensorsOperations(SecurityCenterClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -429,6 +429,12 @@ internal IotSensorsOperations(SecurityCenterClient client) /// /// Name of the IoT sensor /// + /// + /// TI Automatic mode status of the IoT sensor + /// + /// + /// Zone of the IoT sensor + /// /// /// Headers that will be added to request. /// @@ -450,7 +456,7 @@ internal IotSensorsOperations(SecurityCenterClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string scope, string iotSensorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string scope, string iotSensorName, bool? tiAutomaticUpdates = default(bool?), string zone = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (scope == null) { @@ -461,6 +467,12 @@ internal IotSensorsOperations(SecurityCenterClient client) throw new ValidationException(ValidationRules.CannotBeNull, "iotSensorName"); } string apiVersion = "2020-08-06-preview"; + IotSensorsModel iotSensorsModel = new IotSensorsModel(); + if (tiAutomaticUpdates != null || zone != null) + { + iotSensorsModel.TiAutomaticUpdates = tiAutomaticUpdates; + iotSensorsModel.Zone = zone; + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -471,6 +483,7 @@ internal IotSensorsOperations(SecurityCenterClient client) tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("scope", scope); tracingParameters.Add("iotSensorName", iotSensorName); + tracingParameters.Add("iotSensorsModel", iotSensorsModel); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -522,6 +535,12 @@ internal IotSensorsOperations(SecurityCenterClient client) // Serialize Request string _requestContent = null; + if(iotSensorsModel != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(iotSensorsModel, 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) { @@ -577,7 +596,7 @@ internal IotSensorsOperations(SecurityCenterClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -590,7 +609,7 @@ internal IotSensorsOperations(SecurityCenterClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -608,7 +627,7 @@ internal IotSensorsOperations(SecurityCenterClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -971,5 +990,364 @@ internal IotSensorsOperations(SecurityCenterClient client) return _result; } + /// + /// Download file for reset password of the sensor + /// + /// + /// Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub) + /// + /// + /// Name of the IoT sensor + /// + /// + /// The appliance id of the sensor. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> DownloadResetPasswordWithHttpMessagesAsync(string scope, string iotSensorName, string applianceId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + if (iotSensorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "iotSensorName"); + } + string apiVersion = "2020-08-06-preview"; + ResetPasswordInput body = new ResetPasswordInput(); + if (applianceId != null) + { + body.ApplianceId = applianceId; + } + // 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("iotSensorName", iotSensorName); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "DownloadResetPassword", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.Security/iotSensors/{iotSensorName}/downloadResetPassword").ToString(); + _url = _url.Replace("{scope}", scope); + _url = _url.Replace("{iotSensorName}", System.Uri.EscapeDataString(iotSensorName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _result.Body = await _httpResponse.Content.ReadAsStreamAsync().ConfigureAwait(false); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Trigger threat intelligence package update + /// + /// + /// Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub) + /// + /// + /// Name of the IoT sensor + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task TriggerTiPackageUpdateWithHttpMessagesAsync(string scope, string iotSensorName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + if (iotSensorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "iotSensorName"); + } + string apiVersion = "2020-08-06-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("iotSensorName", iotSensorName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "TriggerTiPackageUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.Security/iotSensors/{iotSensorName}/triggerTiPackageUpdate").ToString(); + _url = _url.Replace("{scope}", scope); + _url = _url.Replace("{iotSensorName}", System.Uri.EscapeDataString(iotSensorName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + } } diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSensorsOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSensorsOperationsExtensions.cs index c5d3a27e2f22..b4d0da207386 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSensorsOperationsExtensions.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSensorsOperationsExtensions.cs @@ -68,7 +68,7 @@ public static IotSensorsList List(this IIotSensorsOperations operations, string /// /// Name of the IoT sensor /// - public static IotSensor Get(this IIotSensorsOperations operations, string scope, string iotSensorName) + public static IotSensorsModel Get(this IIotSensorsOperations operations, string scope, string iotSensorName) { return operations.GetAsync(scope, iotSensorName).GetAwaiter().GetResult(); } @@ -88,7 +88,7 @@ public static IotSensor Get(this IIotSensorsOperations operations, string scope, /// /// The cancellation token. /// - public static async Task GetAsync(this IIotSensorsOperations operations, string scope, string iotSensorName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IIotSensorsOperations operations, string scope, string iotSensorName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetWithHttpMessagesAsync(scope, iotSensorName, null, cancellationToken).ConfigureAwait(false)) { @@ -108,9 +108,15 @@ public static IotSensor Get(this IIotSensorsOperations operations, string scope, /// /// Name of the IoT sensor /// - public static IotSensor CreateOrUpdate(this IIotSensorsOperations operations, string scope, string iotSensorName) + /// + /// TI Automatic mode status of the IoT sensor + /// + /// + /// Zone of the IoT sensor + /// + public static IotSensorsModel CreateOrUpdate(this IIotSensorsOperations operations, string scope, string iotSensorName, bool? tiAutomaticUpdates = default(bool?), string zone = default(string)) { - return operations.CreateOrUpdateAsync(scope, iotSensorName).GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(scope, iotSensorName, tiAutomaticUpdates, zone).GetAwaiter().GetResult(); } /// @@ -125,12 +131,18 @@ public static IotSensor CreateOrUpdate(this IIotSensorsOperations operations, st /// /// Name of the IoT sensor /// + /// + /// TI Automatic mode status of the IoT sensor + /// + /// + /// Zone of the IoT sensor + /// /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IIotSensorsOperations operations, string scope, string iotSensorName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this IIotSensorsOperations operations, string scope, string iotSensorName, bool? tiAutomaticUpdates = default(bool?), string zone = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(scope, iotSensorName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(scope, iotSensorName, tiAutomaticUpdates, zone, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -212,5 +224,87 @@ public static Stream DownloadActivation(this IIotSensorsOperations operations, s return _result.Body; } + /// + /// Download file for reset password of the sensor + /// + /// + /// The operations group for this extension method. + /// + /// + /// Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub) + /// + /// + /// Name of the IoT sensor + /// + /// + /// The appliance id of the sensor. + /// + public static Stream DownloadResetPassword(this IIotSensorsOperations operations, string scope, string iotSensorName, string applianceId = default(string)) + { + return operations.DownloadResetPasswordAsync(scope, iotSensorName, applianceId).GetAwaiter().GetResult(); + } + + /// + /// Download file for reset password of the sensor + /// + /// + /// The operations group for this extension method. + /// + /// + /// Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub) + /// + /// + /// Name of the IoT sensor + /// + /// + /// The appliance id of the sensor. + /// + /// + /// The cancellation token. + /// + public static async Task DownloadResetPasswordAsync(this IIotSensorsOperations operations, string scope, string iotSensorName, string applianceId = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + var _result = await operations.DownloadResetPasswordWithHttpMessagesAsync(scope, iotSensorName, applianceId, null, cancellationToken).ConfigureAwait(false); + _result.Request.Dispose(); + return _result.Body; + } + + /// + /// Trigger threat intelligence package update + /// + /// + /// The operations group for this extension method. + /// + /// + /// Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub) + /// + /// + /// Name of the IoT sensor + /// + public static void TriggerTiPackageUpdate(this IIotSensorsOperations operations, string scope, string iotSensorName) + { + operations.TriggerTiPackageUpdateAsync(scope, iotSensorName).GetAwaiter().GetResult(); + } + + /// + /// Trigger threat intelligence package update + /// + /// + /// The operations group for this extension method. + /// + /// + /// Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub) + /// + /// + /// Name of the IoT sensor + /// + /// + /// The cancellation token. + /// + public static async Task TriggerTiPackageUpdateAsync(this IIotSensorsOperations operations, string scope, string iotSensorName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.TriggerTiPackageUpdateWithHttpMessagesAsync(scope, iotSensorName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + } } diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSitesOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSitesOperations.cs new file mode 100644 index 000000000000..8a429fe9ed7f --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSitesOperations.cs @@ -0,0 +1,794 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by 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; + + /// + /// IotSitesOperations operations. + /// + internal partial class IotSitesOperations : IServiceOperations, IIotSitesOperations + { + /// + /// Initializes a new instance of the IotSitesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal IotSitesOperations(SecurityCenterClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SecurityCenterClient + /// + public SecurityCenterClient Client { get; private set; } + + /// + /// List IoT sites + /// + /// + /// Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub) + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ListWithHttpMessagesAsync(string scope, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + string apiVersion = "2020-08-06-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/iotSites").ToString(); + _url = _url.Replace("{scope}", scope); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get IoT site + /// + /// + /// Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub) + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + string apiVersion = "2020-08-06-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, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.Security/iotSites/default").ToString(); + _url = _url.Replace("{scope}", scope); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update IoT site + /// + /// + /// Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub) + /// + /// + /// Display name of the IoT site + /// + /// + /// Tags of the IoT site + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a 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 displayName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + if (displayName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "displayName"); + } + string apiVersion = "2020-08-06-preview"; + IotSitesModel iotSitesModel = new IotSitesModel(); + if (displayName != null || tags != null) + { + iotSitesModel.DisplayName = displayName; + iotSitesModel.Tags = tags; + } + // 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("iotSitesModel", iotSitesModel); + 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/iotSites/default").ToString(); + _url = _url.Replace("{scope}", scope); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("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(iotSitesModel != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(iotSitesModel, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete IoT site + /// + /// + /// Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub) + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task DeleteWithHttpMessagesAsync(string scope, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + string apiVersion = "2020-08-06-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, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.Security/iotSites/default").ToString(); + _url = _url.Replace("{scope}", scope); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSitesOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSitesOperationsExtensions.cs new file mode 100644 index 000000000000..91350e58c066 --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/IotSitesOperationsExtensions.cs @@ -0,0 +1,172 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Security +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for IotSitesOperations. + /// + public static partial class IotSitesOperationsExtensions + { + /// + /// List IoT sites + /// + /// + /// The operations group for this extension method. + /// + /// + /// Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub) + /// + public static IotSitesList List(this IIotSitesOperations operations, string scope) + { + return operations.ListAsync(scope).GetAwaiter().GetResult(); + } + + /// + /// List IoT sites + /// + /// + /// The operations group for this extension method. + /// + /// + /// Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub) + /// + /// + /// The cancellation token. + /// + public static async Task ListAsync(this IIotSitesOperations operations, string scope, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(scope, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get IoT site + /// + /// + /// The operations group for this extension method. + /// + /// + /// Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub) + /// + public static IotSitesModel Get(this IIotSitesOperations operations, string scope) + { + return operations.GetAsync(scope).GetAwaiter().GetResult(); + } + + /// + /// Get IoT site + /// + /// + /// The operations group for this extension method. + /// + /// + /// Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub) + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IIotSitesOperations operations, string scope, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(scope, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update IoT site + /// + /// + /// The operations group for this extension method. + /// + /// + /// Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub) + /// + /// + /// Display name of the IoT site + /// + /// + /// Tags of the IoT site + /// + public static IotSitesModel CreateOrUpdate(this IIotSitesOperations operations, string scope, string displayName, IDictionary tags = default(IDictionary)) + { + return operations.CreateOrUpdateAsync(scope, displayName, tags).GetAwaiter().GetResult(); + } + + /// + /// Create or update IoT site + /// + /// + /// The operations group for this extension method. + /// + /// + /// Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub) + /// + /// + /// Display name of the IoT site + /// + /// + /// Tags of the IoT site + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IIotSitesOperations operations, string scope, string displayName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(scope, displayName, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete IoT site + /// + /// + /// The operations group for this extension method. + /// + /// + /// Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub) + /// + public static void Delete(this IIotSitesOperations operations, string scope) + { + operations.DeleteAsync(scope).GetAwaiter().GetResult(); + } + + /// + /// Delete IoT site + /// + /// + /// The operations group for this extension method. + /// + /// + /// Scope of the query (IoT Hub, /providers/Microsoft.Devices/iotHubs/myHub) + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IIotSitesOperations operations, string scope, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(scope, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ActiveConnectionsNotInAllowedRange.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ActiveConnectionsNotInAllowedRange.cs index 3c4aefd5b0a4..1d901cbc4a88 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ActiveConnectionsNotInAllowedRange.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ActiveConnectionsNotInAllowedRange.cs @@ -10,13 +10,11 @@ namespace Microsoft.Azure.Management.Security.Models { - using Newtonsoft.Json; using System.Linq; /// /// Number of active connections is not in allowed range. /// - [Newtonsoft.Json.JsonObject("ActiveConnectionsNotInAllowedRange")] public partial class ActiveConnectionsNotInAllowedRange : TimeWindowCustomAlertRule { /// diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AdditionalData.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AdditionalData.cs index efcb3ced1b86..a052f822516a 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AdditionalData.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AdditionalData.cs @@ -10,13 +10,11 @@ namespace Microsoft.Azure.Management.Security.Models { - using Newtonsoft.Json; using System.Linq; /// /// Details of the sub-assessment /// - [Newtonsoft.Json.JsonObject("AdditionalData")] public partial class AdditionalData { /// diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AllowlistCustomAlertRule.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AllowlistCustomAlertRule.cs index 9033e1abbffb..4f1823712b08 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AllowlistCustomAlertRule.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AllowlistCustomAlertRule.cs @@ -20,7 +20,6 @@ namespace Microsoft.Azure.Management.Security.Models /// A custom alert rule that checks if a value (depends on the custom alert /// type) is allowed. /// - [Newtonsoft.Json.JsonObject("AllowlistCustomAlertRule")] public partial class AllowlistCustomAlertRule : ListCustomAlertRule { /// diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AmqpC2DMessagesNotInAllowedRange.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AmqpC2DMessagesNotInAllowedRange.cs index 83fcf7eef6d5..1ec0be41d31f 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AmqpC2DMessagesNotInAllowedRange.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AmqpC2DMessagesNotInAllowedRange.cs @@ -10,14 +10,12 @@ namespace Microsoft.Azure.Management.Security.Models { - using Newtonsoft.Json; using System.Linq; /// /// Number of cloud to device messages (AMQP protocol) is not in allowed /// range. /// - [Newtonsoft.Json.JsonObject("AmqpC2DMessagesNotInAllowedRange")] public partial class AmqpC2DMessagesNotInAllowedRange : TimeWindowCustomAlertRule { /// diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AmqpC2DRejectedMessagesNotInAllowedRange.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AmqpC2DRejectedMessagesNotInAllowedRange.cs index 61375802e9ea..27ca3c49286e 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AmqpC2DRejectedMessagesNotInAllowedRange.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AmqpC2DRejectedMessagesNotInAllowedRange.cs @@ -10,14 +10,12 @@ namespace Microsoft.Azure.Management.Security.Models { - using Newtonsoft.Json; using System.Linq; /// /// Number of rejected cloud to device messages (AMQP protocol) is not in /// allowed range. /// - [Newtonsoft.Json.JsonObject("AmqpC2DRejectedMessagesNotInAllowedRange")] public partial class AmqpC2DRejectedMessagesNotInAllowedRange : TimeWindowCustomAlertRule { /// diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AmqpD2CMessagesNotInAllowedRange.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AmqpD2CMessagesNotInAllowedRange.cs index fd6dd48b1060..8061c59a72ce 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AmqpD2CMessagesNotInAllowedRange.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AmqpD2CMessagesNotInAllowedRange.cs @@ -10,14 +10,12 @@ namespace Microsoft.Azure.Management.Security.Models { - using Newtonsoft.Json; using System.Linq; /// /// Number of device to cloud messages (AMQP protocol) is not in allowed /// range. /// - [Newtonsoft.Json.JsonObject("AmqpD2CMessagesNotInAllowedRange")] public partial class AmqpD2CMessagesNotInAllowedRange : TimeWindowCustomAlertRule { /// diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AuthenticationDetailsProperties.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AuthenticationDetailsProperties.cs index bf9f8117be03..4e15389c098a 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AuthenticationDetailsProperties.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AuthenticationDetailsProperties.cs @@ -18,7 +18,6 @@ namespace Microsoft.Azure.Management.Security.Models /// /// Settings for cloud authentication management /// - [Newtonsoft.Json.JsonObject("AuthenticationDetailsProperties")] public partial class AuthenticationDetailsProperties { /// diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AutomationAction.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AutomationAction.cs index e486a3ba01b9..921ecb8ffaf1 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AutomationAction.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AutomationAction.cs @@ -10,13 +10,11 @@ namespace Microsoft.Azure.Management.Security.Models { - using Newtonsoft.Json; using System.Linq; /// /// The action that should be triggered. /// - [Newtonsoft.Json.JsonObject("AutomationAction")] public partial class AutomationAction { /// diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AutomationSource.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AutomationSource.cs index 8bdc7a2c40c1..d166a2614f9e 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AutomationSource.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/AutomationSource.cs @@ -35,7 +35,9 @@ public AutomationSource() /// Initializes a new instance of the AutomationSource class. /// /// A valid event source type. Possible - /// values include: 'Assessments', 'SubAssessments', 'Alerts' + /// values include: 'Assessments', 'SubAssessments', 'Alerts', + /// 'SecureScores', 'SecureScoreControls', + /// 'RegulatoryComplianceAssessment' /// A set of rules which evaluate upon event /// interception. A logical disjunction is applied between defined rule /// sets (logical 'or'). @@ -53,7 +55,8 @@ public AutomationSource() /// /// Gets or sets a valid event source type. Possible values include: - /// 'Assessments', 'SubAssessments', 'Alerts' + /// 'Assessments', 'SubAssessments', 'Alerts', 'SecureScores', + /// 'SecureScoreControls', 'RegulatoryComplianceAssessment' /// [JsonProperty(PropertyName = "eventSource")] public string EventSource { get; set; } diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ConnectionToIpNotAllowed.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ConnectionToIpNotAllowed.cs index 19cc63c8934c..16d02941054a 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ConnectionToIpNotAllowed.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ConnectionToIpNotAllowed.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Management.Security.Models { - using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; @@ -19,7 +18,6 @@ namespace Microsoft.Azure.Management.Security.Models /// Outbound connection to an ip that isn't allowed. Allow list consists of /// ipv4 or ipv6 range in CIDR notation. /// - [Newtonsoft.Json.JsonObject("ConnectionToIpNotAllowed")] public partial class ConnectionToIpNotAllowed : AllowlistCustomAlertRule { /// diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/CustomAlertRule.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/CustomAlertRule.cs index a581bbf4f832..c52d16896c22 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/CustomAlertRule.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/CustomAlertRule.cs @@ -16,7 +16,6 @@ namespace Microsoft.Azure.Management.Security.Models /// /// A custom alert rule. /// - [Newtonsoft.Json.JsonObject("CustomAlertRule")] public partial class CustomAlertRule { /// diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/DataExportSettings.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/DataExportSettings.cs index 3c01ebcc5c17..9d743cb001b5 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/DataExportSettings.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/DataExportSettings.cs @@ -18,7 +18,6 @@ namespace Microsoft.Azure.Management.Security.Models /// /// Represents a data export setting /// - [Newtonsoft.Json.JsonObject("DataExportSettings")] [Rest.Serialization.JsonTransformation] public partial class DataExportSettings : Setting { diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/DenylistCustomAlertRule.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/DenylistCustomAlertRule.cs index 1bfe4ef2944a..fefdebb7ccad 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/DenylistCustomAlertRule.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/DenylistCustomAlertRule.cs @@ -20,7 +20,6 @@ namespace Microsoft.Azure.Management.Security.Models /// A custom alert rule that checks if a value (depends on the custom alert /// type) is denied. /// - [Newtonsoft.Json.JsonObject("DenylistCustomAlertRule")] public partial class DenylistCustomAlertRule : ListCustomAlertRule { /// diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Device.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Device.cs index 3b43ed623c18..1e41a249b2cf 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Device.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Device.cs @@ -269,16 +269,13 @@ public Device() /// public virtual void Validate() { - if (RiskScore != null) + if (RiskScore > 100) { - if (RiskScore > 100) - { - throw new ValidationException(ValidationRules.InclusiveMaximum, "RiskScore", 100); - } - if (RiskScore < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "RiskScore", 0); - } + throw new ValidationException(ValidationRules.InclusiveMaximum, "RiskScore", 100); + } + if (RiskScore < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "RiskScore", 0); } } } diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/DirectMethodInvokesNotInAllowedRange.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/DirectMethodInvokesNotInAllowedRange.cs index 5965d3547967..efb160b104ec 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/DirectMethodInvokesNotInAllowedRange.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/DirectMethodInvokesNotInAllowedRange.cs @@ -10,13 +10,11 @@ namespace Microsoft.Azure.Management.Security.Models { - using Newtonsoft.Json; using System.Linq; /// /// Number of direct method invokes is not in allowed range. /// - [Newtonsoft.Json.JsonObject("DirectMethodInvokesNotInAllowedRange")] public partial class DirectMethodInvokesNotInAllowedRange : TimeWindowCustomAlertRule { /// diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/EventSource.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/EventSource.cs index 33c257f4f0b4..170dc529c798 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/EventSource.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/EventSource.cs @@ -19,5 +19,8 @@ public static class EventSource public const string Assessments = "Assessments"; public const string SubAssessments = "SubAssessments"; public const string Alerts = "Alerts"; + public const string SecureScores = "SecureScores"; + public const string SecureScoreControls = "SecureScoreControls"; + public const string RegulatoryComplianceAssessment = "RegulatoryComplianceAssessment"; } } diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ExternalSecuritySolution.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ExternalSecuritySolution.cs index 6391dffca8f2..119f870c19ad 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ExternalSecuritySolution.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ExternalSecuritySolution.cs @@ -18,7 +18,6 @@ namespace Microsoft.Azure.Management.Security.Models /// sends information to an OMS workspace and whose data is displayed by /// Azure Security Center. /// - [Newtonsoft.Json.JsonObject("ExternalSecuritySolution")] public partial class ExternalSecuritySolution { /// diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/FailedLocalLoginsNotInAllowedRange.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/FailedLocalLoginsNotInAllowedRange.cs index 940afb4c7ce2..d2d8d1166ae2 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/FailedLocalLoginsNotInAllowedRange.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/FailedLocalLoginsNotInAllowedRange.cs @@ -10,13 +10,11 @@ namespace Microsoft.Azure.Management.Security.Models { - using Newtonsoft.Json; using System.Linq; /// /// Number of failed local logins is not in allowed range. /// - [Newtonsoft.Json.JsonObject("FailedLocalLoginsNotInAllowedRange")] public partial class FailedLocalLoginsNotInAllowedRange : TimeWindowCustomAlertRule { /// diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/FileUploadsNotInAllowedRange.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/FileUploadsNotInAllowedRange.cs index b35c49246449..55109af42dc0 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/FileUploadsNotInAllowedRange.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/FileUploadsNotInAllowedRange.cs @@ -10,13 +10,11 @@ namespace Microsoft.Azure.Management.Security.Models { - using Newtonsoft.Json; using System.Linq; /// /// Number of file uploads is not in allowed range. /// - [Newtonsoft.Json.JsonObject("FileUploadsNotInAllowedRange")] public partial class FileUploadsNotInAllowedRange : TimeWindowCustomAlertRule { /// diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/HttpC2DMessagesNotInAllowedRange.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/HttpC2DMessagesNotInAllowedRange.cs index b4c92a0347b1..21b2e8bf7d9e 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/HttpC2DMessagesNotInAllowedRange.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/HttpC2DMessagesNotInAllowedRange.cs @@ -10,14 +10,12 @@ namespace Microsoft.Azure.Management.Security.Models { - using Newtonsoft.Json; using System.Linq; /// /// Number of cloud to device messages (HTTP protocol) is not in allowed /// range. /// - [Newtonsoft.Json.JsonObject("HttpC2DMessagesNotInAllowedRange")] public partial class HttpC2DMessagesNotInAllowedRange : TimeWindowCustomAlertRule { /// diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/HttpC2DRejectedMessagesNotInAllowedRange.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/HttpC2DRejectedMessagesNotInAllowedRange.cs index a9d06f027578..73f69e0b71b0 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/HttpC2DRejectedMessagesNotInAllowedRange.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/HttpC2DRejectedMessagesNotInAllowedRange.cs @@ -10,14 +10,12 @@ namespace Microsoft.Azure.Management.Security.Models { - using Newtonsoft.Json; using System.Linq; /// /// Number of rejected cloud to device messages (HTTP protocol) is not in /// allowed range. /// - [Newtonsoft.Json.JsonObject("HttpC2DRejectedMessagesNotInAllowedRange")] public partial class HttpC2DRejectedMessagesNotInAllowedRange : TimeWindowCustomAlertRule { /// diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/HttpD2CMessagesNotInAllowedRange.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/HttpD2CMessagesNotInAllowedRange.cs index d9ecd22c241b..820edd41c00a 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/HttpD2CMessagesNotInAllowedRange.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/HttpD2CMessagesNotInAllowedRange.cs @@ -10,14 +10,12 @@ namespace Microsoft.Azure.Management.Security.Models { - using Newtonsoft.Json; using System.Linq; /// /// Number of device to cloud messages (HTTP protocol) is not in allowed /// range. /// - [Newtonsoft.Json.JsonObject("HttpD2CMessagesNotInAllowedRange")] public partial class HttpD2CMessagesNotInAllowedRange : TimeWindowCustomAlertRule { /// diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IotSensor.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IotSensor.cs deleted file mode 100644 index a78e65a6ae6b..000000000000 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IotSensor.cs +++ /dev/null @@ -1,55 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Security.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// IoT sensor - /// - public partial class IotSensor : Resource - { - /// - /// Initializes a new instance of the IotSensor class. - /// - public IotSensor() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the IotSensor class. - /// - /// Resource Id - /// Resource name - /// Resource type - /// IoT sensor properties - public IotSensor(string id = default(string), string name = default(string), string type = default(string), object properties = default(object)) - : base(id, name, type) - { - Properties = properties; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets ioT sensor properties - /// - [JsonProperty(PropertyName = "properties")] - public object Properties { get; set; } - - } -} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IotSensorsList.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IotSensorsList.cs index aac5bc83d934..f432097bf7e1 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IotSensorsList.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IotSensorsList.cs @@ -32,7 +32,7 @@ public IotSensorsList() /// Initializes a new instance of the IotSensorsList class. /// /// List data - public IotSensorsList(IList value = default(IList)) + public IotSensorsList(IList value = default(IList)) { Value = value; CustomInit(); @@ -47,7 +47,7 @@ public IotSensorsList() /// Gets list data /// [JsonProperty(PropertyName = "value")] - public IList Value { get; private set; } + public IList Value { get; private set; } } } diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IotSensorsModel.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IotSensorsModel.cs new file mode 100644 index 000000000000..b626bbc146cc --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IotSensorsModel.cs @@ -0,0 +1,138 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (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; + + /// + /// IoT sensor model + /// + [Rest.Serialization.JsonTransformation] + public partial class IotSensorsModel : Resource + { + /// + /// Initializes a new instance of the IotSensorsModel class. + /// + public IotSensorsModel() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IotSensorsModel class. + /// + /// Resource Id + /// Resource name + /// Resource type + /// Last connectivity time of the IoT + /// sensor + /// Creation time of the IoT sensor + /// Dynamic mode status of the IoT + /// sensor + /// Learning mode status of the IoT + /// sensor + /// Status of the IoT sensor. Possible + /// values include: 'Ok', 'Disconnected', 'Unavailable' + /// Version of the IoT sensor + /// TI Automatic mode status of the + /// IoT sensor + /// TI Status of the IoT sensor. Possible values + /// include: 'Ok', 'Failed', 'InProgress', 'UpdateAvailable' + /// TI Version of the IoT sensor + /// Zone of the IoT sensor + public IotSensorsModel(string id = default(string), string name = default(string), string type = default(string), string connectivityTime = default(string), string creationTime = default(string), bool? dynamicLearning = default(bool?), bool? learningMode = default(bool?), string sensorStatus = default(string), string sensorVersion = default(string), bool? tiAutomaticUpdates = default(bool?), string tiStatus = default(string), string tiVersion = default(string), string zone = default(string)) + : base(id, name, type) + { + ConnectivityTime = connectivityTime; + CreationTime = creationTime; + DynamicLearning = dynamicLearning; + LearningMode = learningMode; + SensorStatus = sensorStatus; + SensorVersion = sensorVersion; + TiAutomaticUpdates = tiAutomaticUpdates; + TiStatus = tiStatus; + TiVersion = tiVersion; + Zone = zone; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets last connectivity time of the IoT sensor + /// + [JsonProperty(PropertyName = "properties.connectivityTime")] + public string ConnectivityTime { get; private set; } + + /// + /// Gets creation time of the IoT sensor + /// + [JsonProperty(PropertyName = "properties.creationTime")] + public string CreationTime { get; private set; } + + /// + /// Gets dynamic mode status of the IoT sensor + /// + [JsonProperty(PropertyName = "properties.dynamicLearning")] + public bool? DynamicLearning { get; private set; } + + /// + /// Gets learning mode status of the IoT sensor + /// + [JsonProperty(PropertyName = "properties.learningMode")] + public bool? LearningMode { get; private set; } + + /// + /// Gets status of the IoT sensor. Possible values include: 'Ok', + /// 'Disconnected', 'Unavailable' + /// + [JsonProperty(PropertyName = "properties.sensorStatus")] + public string SensorStatus { get; private set; } + + /// + /// Gets version of the IoT sensor + /// + [JsonProperty(PropertyName = "properties.sensorVersion")] + public string SensorVersion { get; private set; } + + /// + /// Gets or sets TI Automatic mode status of the IoT sensor + /// + [JsonProperty(PropertyName = "properties.tiAutomaticUpdates")] + public bool? TiAutomaticUpdates { get; set; } + + /// + /// Gets TI Status of the IoT sensor. Possible values include: 'Ok', + /// 'Failed', 'InProgress', 'UpdateAvailable' + /// + [JsonProperty(PropertyName = "properties.tiStatus")] + public string TiStatus { get; private set; } + + /// + /// Gets TI Version of the IoT sensor + /// + [JsonProperty(PropertyName = "properties.tiVersion")] + public string TiVersion { get; private set; } + + /// + /// Gets or sets zone of the IoT sensor + /// + [JsonProperty(PropertyName = "properties.zone")] + public string Zone { get; set; } + + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/PackageDownloadsThreatIntelligence.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IotSitesList.cs similarity index 58% rename from sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/PackageDownloadsThreatIntelligence.cs rename to sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IotSitesList.cs index 38058ad743fc..cfedc65bd774 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/PackageDownloadsThreatIntelligence.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IotSitesList.cs @@ -11,30 +11,30 @@ namespace Microsoft.Azure.Management.Security.Models { using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// - /// All downloads for threat intelligence + /// List of IoT sites /// - public partial class PackageDownloadsThreatIntelligence + public partial class IotSitesList { /// - /// Initializes a new instance of the - /// PackageDownloadsThreatIntelligence class. + /// Initializes a new instance of the IotSitesList class. /// - public PackageDownloadsThreatIntelligence() + public IotSitesList() { CustomInit(); } /// - /// Initializes a new instance of the - /// PackageDownloadsThreatIntelligence class. + /// Initializes a new instance of the IotSitesList class. /// - /// Download link - public PackageDownloadsThreatIntelligence(string link = default(string)) + /// List data + public IotSitesList(IList value = default(IList)) { - Link = link; + Value = value; CustomInit(); } @@ -44,10 +44,10 @@ public PackageDownloadsThreatIntelligence() partial void CustomInit(); /// - /// Gets or sets download link + /// Gets list data /// - [JsonProperty(PropertyName = "link")] - public string Link { get; set; } + [JsonProperty(PropertyName = "value")] + public IList Value { get; private set; } } } diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IotSitesModel.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IotSitesModel.cs new file mode 100644 index 000000000000..dd4e63552255 --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/IotSitesModel.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 Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// IoT site model + /// + [Rest.Serialization.JsonTransformation] + public partial class IotSitesModel : Resource + { + /// + /// Initializes a new instance of the IotSitesModel class. + /// + public IotSitesModel() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IotSitesModel class. + /// + /// Display name of the IoT site + /// Resource Id + /// Resource name + /// Resource type + /// Tags of the IoT site + public IotSitesModel(string displayName, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary)) + : base(id, name, type) + { + DisplayName = displayName; + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets display name of the IoT site + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets tags of the IoT site + /// + [JsonProperty(PropertyName = "properties.tags")] + public IDictionary Tags { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DisplayName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DisplayName"); + } + } + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ListCustomAlertRule.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ListCustomAlertRule.cs index 763959ad3860..528d183316de 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ListCustomAlertRule.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ListCustomAlertRule.cs @@ -16,7 +16,6 @@ namespace Microsoft.Azure.Management.Security.Models /// /// A List custom alert rule. /// - [Newtonsoft.Json.JsonObject("ListCustomAlertRule")] public partial class ListCustomAlertRule : CustomAlertRule { /// diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/LocalUserNotAllowed.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/LocalUserNotAllowed.cs index 27e661e467c1..0005bd059e44 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/LocalUserNotAllowed.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/LocalUserNotAllowed.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Management.Security.Models { - using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; @@ -19,7 +18,6 @@ namespace Microsoft.Azure.Management.Security.Models /// Login by a local user that isn't allowed. Allow list consists of login /// names to allow. /// - [Newtonsoft.Json.JsonObject("LocalUserNotAllowed")] public partial class LocalUserNotAllowed : AllowlistCustomAlertRule { /// diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/MqttC2DMessagesNotInAllowedRange.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/MqttC2DMessagesNotInAllowedRange.cs index 50ce5fe30a68..3df534833527 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/MqttC2DMessagesNotInAllowedRange.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/MqttC2DMessagesNotInAllowedRange.cs @@ -10,14 +10,12 @@ namespace Microsoft.Azure.Management.Security.Models { - using Newtonsoft.Json; using System.Linq; /// /// Number of cloud to device messages (MQTT protocol) is not in allowed /// range. /// - [Newtonsoft.Json.JsonObject("MqttC2DMessagesNotInAllowedRange")] public partial class MqttC2DMessagesNotInAllowedRange : TimeWindowCustomAlertRule { /// diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/MqttC2DRejectedMessagesNotInAllowedRange.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/MqttC2DRejectedMessagesNotInAllowedRange.cs index 55fb3039b11a..6607cb5285c9 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/MqttC2DRejectedMessagesNotInAllowedRange.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/MqttC2DRejectedMessagesNotInAllowedRange.cs @@ -10,14 +10,12 @@ namespace Microsoft.Azure.Management.Security.Models { - using Newtonsoft.Json; using System.Linq; /// /// Number of rejected cloud to device messages (MQTT protocol) is not in /// allowed range. /// - [Newtonsoft.Json.JsonObject("MqttC2DRejectedMessagesNotInAllowedRange")] public partial class MqttC2DRejectedMessagesNotInAllowedRange : TimeWindowCustomAlertRule { /// diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/MqttD2CMessagesNotInAllowedRange.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/MqttD2CMessagesNotInAllowedRange.cs index 358bb0c6e4f8..1bba936ed591 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/MqttD2CMessagesNotInAllowedRange.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/MqttD2CMessagesNotInAllowedRange.cs @@ -10,14 +10,12 @@ namespace Microsoft.Azure.Management.Security.Models { - using Newtonsoft.Json; using System.Linq; /// /// Number of device to cloud messages (MQTT protocol) is not in allowed /// range. /// - [Newtonsoft.Json.JsonObject("MqttD2CMessagesNotInAllowedRange")] public partial class MqttD2CMessagesNotInAllowedRange : TimeWindowCustomAlertRule { /// diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/PackageDownloads.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/PackageDownloads.cs index fc5f9bb7fc97..a2c83f1cb017 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/PackageDownloads.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/PackageDownloads.cs @@ -11,6 +11,8 @@ namespace Microsoft.Azure.Management.Security.Models { using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// @@ -34,11 +36,21 @@ public PackageDownloads() /// Manager /// All downloads for threat /// intelligence - public PackageDownloads(PackageDownloadsSensor sensor = default(PackageDownloadsSensor), PackageDownloadsCentralManager centralManager = default(PackageDownloadsCentralManager), PackageDownloadsThreatIntelligence threatIntelligence = default(PackageDownloadsThreatIntelligence)) + /// SNMP Server file + /// Used for local configuration export + /// Authorized devices + /// import template + /// Authorized + /// devices import template + public PackageDownloads(PackageDownloadsSensor sensor = default(PackageDownloadsSensor), PackageDownloadsCentralManager centralManager = default(PackageDownloadsCentralManager), IList threatIntelligence = default(IList), IList snmp = default(IList), IList wmiTool = default(IList), IList authorizedDevicesImportTemplate = default(IList), IList deviceInformationUpdateImportTemplate = default(IList)) { Sensor = sensor; CentralManager = centralManager; ThreatIntelligence = threatIntelligence; + Snmp = snmp; + WmiTool = wmiTool; + AuthorizedDevicesImportTemplate = authorizedDevicesImportTemplate; + DeviceInformationUpdateImportTemplate = deviceInformationUpdateImportTemplate; CustomInit(); } @@ -63,7 +75,31 @@ public PackageDownloads() /// Gets all downloads for threat intelligence /// [JsonProperty(PropertyName = "threatIntelligence")] - public PackageDownloadsThreatIntelligence ThreatIntelligence { get; private set; } + public IList ThreatIntelligence { get; private set; } + + /// + /// Gets SNMP Server file + /// + [JsonProperty(PropertyName = "snmp")] + public IList Snmp { get; private set; } + + /// + /// Gets used for local configuration export + /// + [JsonProperty(PropertyName = "wmiTool")] + public IList WmiTool { get; private set; } + + /// + /// Gets authorized devices import template + /// + [JsonProperty(PropertyName = "authorizedDevicesImportTemplate")] + public IList AuthorizedDevicesImportTemplate { get; private set; } + + /// + /// Gets authorized devices import template + /// + [JsonProperty(PropertyName = "deviceInformationUpdateImportTemplate")] + public IList DeviceInformationUpdateImportTemplate { get; private set; } } } diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/PackageDownloadsCentralManager.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/PackageDownloadsCentralManager.cs index f2172606f5e2..442c6c7b7aa8 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/PackageDownloadsCentralManager.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/PackageDownloadsCentralManager.cs @@ -36,7 +36,7 @@ public PackageDownloadsCentralManager() /// Contains full package downloads /// Central Manager upgrade package downloads (on /// existing installations) - public PackageDownloadsCentralManager(PackageDownloadsCentralManagerFull full = default(PackageDownloadsCentralManagerFull), IList upgrade = default(IList)) + public PackageDownloadsCentralManager(PackageDownloadsCentralManagerFull full = default(PackageDownloadsCentralManagerFull), IList upgrade = default(IList)) { Full = full; Upgrade = upgrade; @@ -59,7 +59,7 @@ public PackageDownloadsCentralManager() /// installations) /// [JsonProperty(PropertyName = "upgrade")] - public IList Upgrade { get; private set; } + public IList Upgrade { get; private set; } } } diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/PackageDownloadsSensor.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/PackageDownloadsSensor.cs index 06a65fb7899c..dd5b1b86174c 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/PackageDownloadsSensor.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/PackageDownloadsSensor.cs @@ -34,7 +34,7 @@ public PackageDownloadsSensor() /// Contains full package downloads /// Sensor upgrade package downloads (on existing /// installations) - public PackageDownloadsSensor(PackageDownloadsSensorFull full = default(PackageDownloadsSensorFull), IList upgrade = default(IList)) + public PackageDownloadsSensor(PackageDownloadsSensorFull full = default(PackageDownloadsSensorFull), IList upgrade = default(IList)) { Full = full; Upgrade = upgrade; @@ -57,7 +57,7 @@ public PackageDownloadsSensor() /// installations) /// [JsonProperty(PropertyName = "upgrade")] - public IList Upgrade { get; set; } + public IList Upgrade { get; set; } } } diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ProcessNotAllowed.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ProcessNotAllowed.cs index 66e7dc1f46f9..a69d3dc5f932 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ProcessNotAllowed.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ProcessNotAllowed.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Management.Security.Models { - using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; @@ -19,7 +18,6 @@ namespace Microsoft.Azure.Management.Security.Models /// Execution of a process that isn't allowed. Allow list consists of /// process names to allow. /// - [Newtonsoft.Json.JsonObject("ProcessNotAllowed")] public partial class ProcessNotAllowed : AllowlistCustomAlertRule { /// diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/QueuePurgesNotInAllowedRange.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/QueuePurgesNotInAllowedRange.cs index e7a506d93b60..6845776d0aed 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/QueuePurgesNotInAllowedRange.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/QueuePurgesNotInAllowedRange.cs @@ -10,13 +10,11 @@ namespace Microsoft.Azure.Management.Security.Models { - using Newtonsoft.Json; using System.Linq; /// /// Number of device queue purges is not in allowed range. /// - [Newtonsoft.Json.JsonObject("QueuePurgesNotInAllowedRange")] public partial class QueuePurgesNotInAllowedRange : TimeWindowCustomAlertRule { /// diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SettingResource.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ResetPasswordInput.cs similarity index 57% rename from sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SettingResource.cs rename to sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ResetPasswordInput.cs index 1f6f76dbf11a..c4f92216e4a0 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SettingResource.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ResetPasswordInput.cs @@ -14,28 +14,25 @@ namespace Microsoft.Azure.Management.Security.Models using System.Linq; /// - /// The kind of the security setting + /// Reset password input. /// - [Newtonsoft.Json.JsonObject("SettingResource")] - public partial class SettingResource : Resource + public partial class ResetPasswordInput { /// - /// Initializes a new instance of the SettingResource class. + /// Initializes a new instance of the ResetPasswordInput class. /// - public SettingResource() + public ResetPasswordInput() { CustomInit(); } /// - /// Initializes a new instance of the SettingResource class. + /// Initializes a new instance of the ResetPasswordInput class. /// - /// Resource Id - /// Resource name - /// Resource type - public SettingResource(string id = default(string), string name = default(string), string type = default(string)) - : base(id, name, type) + /// The appliance id of the sensor. + public ResetPasswordInput(string applianceId = default(string)) { + ApplianceId = applianceId; CustomInit(); } @@ -44,5 +41,11 @@ public SettingResource() /// partial void CustomInit(); + /// + /// Gets or sets the appliance id of the sensor. + /// + [JsonProperty(PropertyName = "applianceId")] + public string ApplianceId { get; set; } + } } diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ResourceDetails.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ResourceDetails.cs index 6ab1d4f7544f..14c1aa733667 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ResourceDetails.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ResourceDetails.cs @@ -10,13 +10,11 @@ namespace Microsoft.Azure.Management.Security.Models { - using Newtonsoft.Json; using System.Linq; /// /// Details of the resource that was assessed /// - [Newtonsoft.Json.JsonObject("ResourceDetails")] public partial class ResourceDetails { /// diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ResourceIdentifier.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ResourceIdentifier.cs index 261c4ea106f6..bc31b41d1edd 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ResourceIdentifier.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ResourceIdentifier.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Management.Security.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -18,7 +17,6 @@ namespace Microsoft.Azure.Management.Security.Models /// alert to the right product exposure group (tenant, workspace, /// subscription etc.). /// - [Newtonsoft.Json.JsonObject("ResourceIdentifier")] public partial class ResourceIdentifier { /// diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecureScoreControlDefinitionItem.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecureScoreControlDefinitionItem.cs index 8692c1b52ee5..b00aa0b76545 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecureScoreControlDefinitionItem.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecureScoreControlDefinitionItem.cs @@ -110,16 +110,13 @@ public virtual void Validate() throw new ValidationException(ValidationRules.MaxLength, "Description", 256); } } - if (MaxScore != null) + if (MaxScore > 10) { - if (MaxScore > 10) - { - throw new ValidationException(ValidationRules.InclusiveMaximum, "MaxScore", 10); - } - if (MaxScore < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "MaxScore", 0); - } + throw new ValidationException(ValidationRules.InclusiveMaximum, "MaxScore", 10); + } + if (MaxScore < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "MaxScore", 0); } } } diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecureScoreControlDetails.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecureScoreControlDetails.cs index a85e38cb2ff4..731ad402ecdc 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecureScoreControlDetails.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecureScoreControlDetails.cs @@ -135,37 +135,25 @@ public SecureScoreControlDetails() /// public virtual void Validate() { - if (Max != null) + if (Max < 0) { - if (Max < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Max", 0); - } + throw new ValidationException(ValidationRules.InclusiveMinimum, "Max", 0); } - if (Current != null) + if (Current < 0) { - if (Current < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Current", 0); - } + throw new ValidationException(ValidationRules.InclusiveMinimum, "Current", 0); } - if (Percentage != null) + if (Percentage > 1) { - if (Percentage > 1) - { - throw new ValidationException(ValidationRules.InclusiveMaximum, "Percentage", 1); - } - if (Percentage < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Percentage", 0); - } + throw new ValidationException(ValidationRules.InclusiveMaximum, "Percentage", 1); } - if (Weight != null) + if (Percentage < 0) { - if (Weight < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Weight", 0); - } + throw new ValidationException(ValidationRules.InclusiveMinimum, "Percentage", 0); + } + if (Weight < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Weight", 0); } if (Definition != null) { diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecureScoreControlScore.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecureScoreControlScore.cs index c13205cd0a70..0c5bcb1169af 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecureScoreControlScore.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecureScoreControlScore.cs @@ -78,38 +78,29 @@ public SecureScoreControlScore() /// public virtual void Validate() { - if (Max != null) + if (Max > 10) { - if (Max > 10) - { - throw new ValidationException(ValidationRules.InclusiveMaximum, "Max", 10); - } - if (Max < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Max", 0); - } + throw new ValidationException(ValidationRules.InclusiveMaximum, "Max", 10); } - if (Current != null) + if (Max < 0) { - if (Current > 10) - { - throw new ValidationException(ValidationRules.InclusiveMaximum, "Current", 10); - } - if (Current < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Current", 0); - } + throw new ValidationException(ValidationRules.InclusiveMinimum, "Max", 0); } - if (Percentage != null) + if (Current > 10) { - if (Percentage > 1) - { - throw new ValidationException(ValidationRules.InclusiveMaximum, "Percentage", 1); - } - if (Percentage < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Percentage", 0); - } + throw new ValidationException(ValidationRules.InclusiveMaximum, "Current", 10); + } + if (Current < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Current", 0); + } + if (Percentage > 1) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "Percentage", 1); + } + if (Percentage < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Percentage", 0); } } } diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecureScoreItem.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecureScoreItem.cs index aa0e2ba185d2..eef77dd1344f 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecureScoreItem.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SecureScoreItem.cs @@ -99,37 +99,25 @@ public SecureScoreItem() /// public virtual void Validate() { - if (Max != null) + if (Max < 0) { - if (Max < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Max", 0); - } + throw new ValidationException(ValidationRules.InclusiveMinimum, "Max", 0); } - if (Current != null) + if (Current < 0) { - if (Current < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Current", 0); - } + throw new ValidationException(ValidationRules.InclusiveMinimum, "Current", 0); } - if (Percentage != null) + if (Percentage > 1) { - if (Percentage > 1) - { - throw new ValidationException(ValidationRules.InclusiveMaximum, "Percentage", 1); - } - if (Percentage < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Percentage", 0); - } + throw new ValidationException(ValidationRules.InclusiveMaximum, "Percentage", 1); } - if (Weight != null) + if (Percentage < 0) { - if (Weight < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Weight", 0); - } + throw new ValidationException(ValidationRules.InclusiveMinimum, "Percentage", 0); + } + if (Weight < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Weight", 0); } } } diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SensorStatus.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SensorStatus.cs new file mode 100644 index 000000000000..a104e1a8c5f8 --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/SensorStatus.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Security.Models +{ + + /// + /// Defines values for SensorStatus. + /// + public static class SensorStatus + { + public const string Ok = "Ok"; + public const string Disconnected = "Disconnected"; + public const string Unavailable = "Unavailable"; + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Setting.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Setting.cs index 3d55e2d4a964..6b8f43e31e7d 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Setting.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/Setting.cs @@ -10,14 +10,12 @@ namespace Microsoft.Azure.Management.Security.Models { - using Newtonsoft.Json; using System.Linq; /// - /// Represents a security setting in Azure Security Center. + /// The kind of the security setting /// - [Newtonsoft.Json.JsonObject("Setting")] - public partial class Setting : SettingResource + public partial class Setting : Resource { /// /// Initializes a new instance of the Setting class. diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ThresholdCustomAlertRule.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ThresholdCustomAlertRule.cs index 7df8da76196b..47f1dfdf2e8f 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ThresholdCustomAlertRule.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/ThresholdCustomAlertRule.cs @@ -17,7 +17,6 @@ namespace Microsoft.Azure.Management.Security.Models /// A custom alert rule that checks if a value (depends on the custom alert /// type) is within the given range. /// - [Newtonsoft.Json.JsonObject("ThresholdCustomAlertRule")] public partial class ThresholdCustomAlertRule : CustomAlertRule { /// diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/TiStatus.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/TiStatus.cs new file mode 100644 index 000000000000..2a6295e5ffdc --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/TiStatus.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Security.Models +{ + + /// + /// Defines values for TiStatus. + /// + public static class TiStatus + { + public const string Ok = "Ok"; + public const string Failed = "Failed"; + public const string InProgress = "InProgress"; + public const string UpdateAvailable = "UpdateAvailable"; + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/TimeWindowCustomAlertRule.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/TimeWindowCustomAlertRule.cs index eaeb685da1b5..e6fdc3230f94 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/TimeWindowCustomAlertRule.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/TimeWindowCustomAlertRule.cs @@ -17,7 +17,6 @@ namespace Microsoft.Azure.Management.Security.Models /// A custom alert rule that checks if the number of activities (depends on /// the custom alert type) in a time window is within the given range. /// - [Newtonsoft.Json.JsonObject("TimeWindowCustomAlertRule")] public partial class TimeWindowCustomAlertRule : ThresholdCustomAlertRule { /// diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/TwinUpdatesNotInAllowedRange.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/TwinUpdatesNotInAllowedRange.cs index e0b4415251e9..047ed484cb7e 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/TwinUpdatesNotInAllowedRange.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/TwinUpdatesNotInAllowedRange.cs @@ -10,13 +10,11 @@ namespace Microsoft.Azure.Management.Security.Models { - using Newtonsoft.Json; using System.Linq; /// /// Number of twin updates is not in allowed range. /// - [Newtonsoft.Json.JsonObject("TwinUpdatesNotInAllowedRange")] public partial class TwinUpdatesNotInAllowedRange : TimeWindowCustomAlertRule { /// diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/UnauthorizedOperationsNotInAllowedRange.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/UnauthorizedOperationsNotInAllowedRange.cs index f57c05fd4648..757b89fe6a5f 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/UnauthorizedOperationsNotInAllowedRange.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/UnauthorizedOperationsNotInAllowedRange.cs @@ -10,13 +10,11 @@ namespace Microsoft.Azure.Management.Security.Models { - using Newtonsoft.Json; using System.Linq; /// /// Number of unauthorized operations is not in allowed range. /// - [Newtonsoft.Json.JsonObject("UnauthorizedOperationsNotInAllowedRange")] public partial class UnauthorizedOperationsNotInAllowedRange : TimeWindowCustomAlertRule { /// diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/UpgradePackageDownloadInfo.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/UpgradePackageDownloadInfo.cs new file mode 100644 index 000000000000..9751d1f752e7 --- /dev/null +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/Models/UpgradePackageDownloadInfo.cs @@ -0,0 +1,56 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Security.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Information on a specific package upgrade download + /// + public partial class UpgradePackageDownloadInfo : PackageDownloadInfo + { + /// + /// Initializes a new instance of the UpgradePackageDownloadInfo class. + /// + public UpgradePackageDownloadInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UpgradePackageDownloadInfo class. + /// + /// Version number + /// Download link + /// Kind of the version. Possible values + /// include: 'Latest', 'Previous', 'Preview' + /// Minimum base version for upgrade + public UpgradePackageDownloadInfo(string version = default(string), string link = default(string), string versionKind = default(string), string fromVersion = default(string)) + : base(version, link, versionKind) + { + FromVersion = fromVersion; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets minimum base version for upgrade + /// + [JsonProperty(PropertyName = "fromVersion")] + public string FromVersion { get; private set; } + + } +} diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/OnPremiseIotSensorsOperations.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/OnPremiseIotSensorsOperations.cs index 256212b665bc..71d998ed9f73 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/OnPremiseIotSensorsOperations.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/OnPremiseIotSensorsOperations.cs @@ -986,5 +986,199 @@ internal OnPremiseIotSensorsOperations(SecurityCenterClient client) return _result; } + /// + /// Download file for reset password of the sensor + /// + /// + /// Name of the on-premise IoT sensor + /// + /// + /// The appliance id of the sensor. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> DownloadResetPasswordWithHttpMessagesAsync(string onPremiseIotSensorName, string applianceId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Client.SubscriptionId, "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$")) + { + throw new ValidationException(ValidationRules.Pattern, "Client.SubscriptionId", "^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$"); + } + } + if (onPremiseIotSensorName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "onPremiseIotSensorName"); + } + string apiVersion = "2020-08-06-preview"; + ResetPasswordInput body = new ResetPasswordInput(); + if (applianceId != null) + { + body.ApplianceId = applianceId; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("onPremiseIotSensorName", onPremiseIotSensorName); + tracingParameters.Add("body", body); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "DownloadResetPassword", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Security/onPremiseIotSensors/{onPremiseIotSensorName}/downloadResetPassword").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{onPremiseIotSensorName}", System.Uri.EscapeDataString(onPremiseIotSensorName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(body != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _result.Body = await _httpResponse.Content.ReadAsStreamAsync().ConfigureAwait(false); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + } } diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/OnPremiseIotSensorsOperationsExtensions.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/OnPremiseIotSensorsOperationsExtensions.cs index 47615b98c03c..b078ef2c46b5 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/OnPremiseIotSensorsOperationsExtensions.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/OnPremiseIotSensorsOperationsExtensions.cs @@ -182,5 +182,44 @@ public static Stream DownloadActivation(this IOnPremiseIotSensorsOperations oper return _result.Body; } + /// + /// Download file for reset password of the sensor + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the on-premise IoT sensor + /// + /// + /// The appliance id of the sensor. + /// + public static Stream DownloadResetPassword(this IOnPremiseIotSensorsOperations operations, string onPremiseIotSensorName, string applianceId = default(string)) + { + return operations.DownloadResetPasswordAsync(onPremiseIotSensorName, applianceId).GetAwaiter().GetResult(); + } + + /// + /// Download file for reset password of the sensor + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the on-premise IoT sensor + /// + /// + /// The appliance id of the sensor. + /// + /// + /// The cancellation token. + /// + public static async Task DownloadResetPasswordAsync(this IOnPremiseIotSensorsOperations operations, string onPremiseIotSensorName, string applianceId = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + var _result = await operations.DownloadResetPasswordWithHttpMessagesAsync(onPremiseIotSensorName, applianceId, null, cancellationToken).ConfigureAwait(false); + _result.Request.Dispose(); + return _result.Body; + } + } } diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SdkInfo_SecurityCenter.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SdkInfo_SecurityCenter.cs index 19968c9a9ea6..cbb7ba139487 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SdkInfo_SecurityCenter.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SdkInfo_SecurityCenter.cs @@ -53,6 +53,7 @@ public static IEnumerable> ApiInfo_SecurityCenter new Tuple("Security", "IotSecuritySolutionsAnalyticsAggregatedAlert", "2019-08-01"), new Tuple("Security", "IotSecuritySolutionsAnalyticsRecommendation", "2019-08-01"), new Tuple("Security", "IotSensors", "2020-08-06-preview"), + new Tuple("Security", "IotSites", "2020-08-06-preview"), new Tuple("Security", "JitNetworkAccessPolicies", "2020-01-01"), new Tuple("Security", "Locations", "2015-06-01-preview"), new Tuple("Security", "OnPremiseIotSensors", "2020-08-06-preview"), @@ -80,16 +81,5 @@ public static IEnumerable> ApiInfo_SecurityCenter }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "v2"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4413"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/security/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=C:\\Rome\\apiVteam\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "32b4d058d54d206bdf6b336677a3182feab7c07b"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - diff --git a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecurityCenterClient.cs b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecurityCenterClient.cs index fa6209f9af3b..1c3d201fc132 100644 --- a/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecurityCenterClient.cs +++ b/sdk/securitycenter/Microsoft.Azure.Management.SecurityCenter/src/Generated/SecurityCenterClient.cs @@ -341,6 +341,11 @@ public partial class SecurityCenterClient : ServiceClient, /// public virtual IOnPremiseIotSensorsOperations OnPremiseIotSensors { get; private set; } + /// + /// Gets the IIotSitesOperations. + /// + public virtual IIotSitesOperations IotSites { get; private set; } + /// /// Initializes a new instance of the SecurityCenterClient class. /// @@ -635,6 +640,7 @@ private void Initialize() DevicesForHub = new DevicesForHubOperations(this); Device = new DeviceOperations(this); OnPremiseIotSensors = new OnPremiseIotSensorsOperations(this); + IotSites = new IotSitesOperations(this); BaseUri = new System.Uri("https://management.azure.com"); AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; @@ -665,8 +671,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")); SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("ruleType")); DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("ruleType")); SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("source"));